all repos — fluxbox @ 8bc11006a5ac8c10a539e5a38cdf62205ff386ad

custom fork of the fluxbox windowmanager

Patch from Glen Whitney

A priori, there is no reason why the workspace warping functionality should
treat the horizontal and vertical directions at all differently. Even if
traditionally horizontal warping was more common, for some in recent times
as aspect ratios tend to become larger, stacking virtual workspaces
vertically may make more sense. Similarly, some might want to traverse
an array of workspaces in column-major, rather than row-major, order.

Prior to this commit, there were extra parameters for vertical warping (a
controlling flag and an offset for how many workspaces to jump) as opposed
to horizontal warping. Also it was impossible to allow vertical warping while
disallowing vertical warping.

This commit makes all of the parameters and behavior for horizontal and
vertical warping equivalent. For backwards compatibility, there is an
overarching flag controlling whether warping occurs at all, as well as a
separate control flag and offset for each of horizontal and vertical warping.

The relevant init file resources and default values are:

session.screen0.workspaceWarping: true
session.screen0.workspaceWarpingHorizontal: true
session.screen0.workspaceWarpingVertical: true
session.screen0.workspaceWarpingHorizontalOffset: 1
session.screen0.workspaceWarpingVerticalOffset: 1
Mark Tiefenbruck mark@fluxbox.org
commit

8bc11006a5ac8c10a539e5a38cdf62205ff386ad

parent

0279936d835d7d88537bcf1208035787c02ced59

M doc/asciidoc/fluxbox.txtdoc/asciidoc/fluxbox.txt

@@ -415,8 +415,12 @@ If enabled, you will see the window content while dragging it. Otherwise

only an outline of the window will be shown. *Workspace Warping*::: - If enabled, you can drag windows from one workspace to another. The previous - workspace is to the left, the next workspace is to the right. + If enabled, you can drag windows from one workspace to another. There are + parameters to set independently whether this warping happens horizontally + and/or vertically, and in each direction you can set the number of + workspaces to jump when warping (to allow for a virtual rectangular grid + of workspaces). When warping, lower-numbered workspaces are above/to the + left, and higher-numbered workspaces below/to the right. Window Menu ~~~~~~~~~~~
M doc/fluxbox.1.indoc/fluxbox.1.in

@@ -828,7 +828,12 @@ .RE

.PP \fBWorkspace Warping\fR .RS 4 -If enabled, you can drag windows from one workspace to another\&. The previous workspace is to the left, the next workspace is to the right\&. +If enabled, you can drag windows from one workspace to another\&. There are +parameters to set independently whether this warping happens horizontally +and/or vertically, and in each direction you can set the number of workspaces +to jump when warping (to allow for a virtual rectangular grid of +workspaces)\&. When warping, lower-numbered workspaces are above/to the left, and +higher-numbered workspaces below/to the right\&. .RE .SS "Window Menu" .sp
M src/Screen.hhsrc/Screen.hh

@@ -95,7 +95,9 @@

bool isRootColormapInstalled() const { return root_colormap_installed; } bool isScreenManaged() const { return m_state.managed; } bool isWorkspaceWarping() const { return (m_workspaces_list.size() > 1) && *resource.workspace_warping; } - bool isWorkspaceWarpingVertical() const { return *resource.workspace_warping_vertical; } + bool isWorkspaceWarpingHorizontal() const { return isWorkspaceWarping() && *resource.workspace_warping_horizontal; } + bool isWorkspaceWarpingVertical() const { return isWorkspaceWarping() && *resource.workspace_warping_vertical; } + int getWorkspaceWarpingHorizontalOffset() const { return *resource.workspace_warping_horizontal_offset; } int getWorkspaceWarpingVerticalOffset() const { return *resource.workspace_warping_vertical_offset; } bool doAutoRaise() const { return *resource.auto_raise; } bool clickRaises() const { return *resource.click_raises; }
M src/ScreenResource.ccsrc/ScreenResource.cc

@@ -89,7 +89,9 @@ max_ignore_inc(rm, true, scrname+".maxIgnoreIncrement", altscrname+".MaxIgnoreIncrement"),

max_disable_move(rm, false, scrname+".maxDisableMove", altscrname+".MaxDisableMove"), max_disable_resize(rm, false, scrname+".maxDisableResize", altscrname+".MaxDisableResize"), workspace_warping(rm, true, scrname+".workspacewarping", altscrname+".WorkspaceWarping"), + workspace_warping_horizontal(rm, true, scrname+".workspacewarpinghorizontal", altscrname+".WorkspaceWarpingHorizontal"), workspace_warping_vertical(rm, true, scrname+".workspacewarpingvertical", altscrname+".WorkspaceWarpingVertical"), + workspace_warping_horizontal_offset(rm, 1, scrname+".workspacewarpinghorizontaloffset", altscrname+".WorkspaceWarpingHorizontalOffset"), workspace_warping_vertical_offset(rm, 1, scrname+".workspacewarpingverticaloffset", altscrname+".WorkspaceWarpingVerticalOffset"), show_window_pos(rm, false, scrname+".showwindowposition", altscrname+".ShowWindowPosition"), auto_raise(rm, true, scrname+".autoRaise", altscrname+".AutoRaise"),
M src/ScreenResource.hhsrc/ScreenResource.hh

@@ -38,6 +38,7 @@ max_ignore_inc,

max_disable_move, max_disable_resize, workspace_warping, + workspace_warping_horizontal, workspace_warping_vertical, show_window_pos, auto_raise,

@@ -56,7 +57,8 @@ menu_alpha,

menu_delay, tab_width, tooltip_delay, - workspace_warping_vertical_offset; + workspace_warping_horizontal_offset, + workspace_warping_vertical_offset; FbTk::Resource<bool> allow_remote_actions; FbTk::Resource<bool> clientmenu_use_pixmap; FbTk::Resource<bool> tabs_use_pixmap;
M src/Window.ccsrc/Window.cc

@@ -2578,6 +2578,7 @@ //

const int warp_pad = screen().getEdgeSnapThreshold(); const int workspaces = screen().numberOfWorkspaces(); const bool is_warping = screen().isWorkspaceWarping(); + const bool is_warping_horzntal = screen().isWorkspaceWarpingHorizontal(); const bool is_warping_vertical = screen().isWorkspaceWarpingVertical(); if ((moved_x || moved_y) && is_warping) {

@@ -2590,12 +2591,13 @@ int bt_left = warp_pad;

int bt_top = int(screen().height()) - warp_pad - 1; int bt_bottom = warp_pad; - if (moved_x) { + if (moved_x && is_warping_horzntal) { + const int warp_offset = screen().getWorkspaceWarpingHorizontalOffset(); if (me.x_root >= bt_right && moved_x > 0) { //warp right - new_id = (cur_id + 1) % workspaces; + new_id = (cur_id + warp_offset) % workspaces; m_last_resize_x = 0; } else if (me.x_root <= bt_left && moved_x < 0) { //warp left - new_id = (cur_id + -1) % workspaces; + new_id = (cur_id + workspaces - warp_offset) % workspaces; m_last_resize_x = screen().width() - 1; } }