diff --git a/doc/asciidoc/fluxbox.txt b/doc/asciidoc/fluxbox.txt index de967911..a646a660 100644 --- a/doc/asciidoc/fluxbox.txt +++ b/doc/asciidoc/fluxbox.txt @@ -415,8 +415,12 @@ titlebars, not window contents. 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 ~~~~~~~~~~~ diff --git a/doc/fluxbox.1.in b/doc/fluxbox.1.in index 8d0c1b8d..b86ef410 100644 --- a/doc/fluxbox.1.in +++ b/doc/fluxbox.1.in @@ -828,7 +828,12 @@ If enabled, you will see the window content while dragging it\&. Otherwise only .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 diff --git a/src/Screen.hh b/src/Screen.hh index 83c5cb56..1e03b784 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -95,7 +95,9 @@ public: 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; } diff --git a/src/ScreenResource.cc b/src/ScreenResource.cc index c5e00277..08a2df11 100644 --- a/src/ScreenResource.cc +++ b/src/ScreenResource.cc @@ -89,7 +89,9 @@ ScreenResource::ScreenResource(FbTk::ResourceManager& rm, 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"), diff --git a/src/ScreenResource.hh b/src/ScreenResource.hh index 120ecf9d..5aac6ddc 100644 --- a/src/ScreenResource.hh +++ b/src/ScreenResource.hh @@ -38,6 +38,7 @@ struct ScreenResource { max_disable_move, max_disable_resize, workspace_warping, + workspace_warping_horizontal, workspace_warping_vertical, show_window_pos, auto_raise, @@ -56,7 +57,8 @@ struct ScreenResource { menu_delay, tab_width, tooltip_delay, - workspace_warping_vertical_offset; + workspace_warping_horizontal_offset, + workspace_warping_vertical_offset; FbTk::Resource allow_remote_actions; FbTk::Resource clientmenu_use_pixmap; FbTk::Resource tabs_use_pixmap; diff --git a/src/Window.cc b/src/Window.cc index 1f2d1847..d761016d 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -2578,6 +2578,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { 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 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { 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; } }