aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2021-07-06 23:56:20 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2021-07-06 23:56:20 (GMT)
commit8bc11006a5ac8c10a539e5a38cdf62205ff386ad (patch)
tree54e3ef1fe6fb25f56d59d9b9e96b4eec6467ef82
parent0279936d835d7d88537bcf1208035787c02ced59 (diff)
downloadfluxbox-8bc11006a5ac8c10a539e5a38cdf62205ff386ad.zip
fluxbox-8bc11006a5ac8c10a539e5a38cdf62205ff386ad.tar.bz2
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
-rw-r--r--doc/asciidoc/fluxbox.txt8
-rw-r--r--doc/fluxbox.1.in7
-rw-r--r--src/Screen.hh4
-rw-r--r--src/ScreenResource.cc2
-rw-r--r--src/ScreenResource.hh4
-rw-r--r--src/Window.cc8
6 files changed, 25 insertions, 8 deletions
diff --git a/doc/asciidoc/fluxbox.txt b/doc/asciidoc/fluxbox.txt
index de96791..a646a66 100644
--- a/doc/asciidoc/fluxbox.txt
+++ b/doc/asciidoc/fluxbox.txt
@@ -415,8 +415,12 @@ titlebars, not window contents.
415 only an outline of the window will be shown. 415 only an outline of the window will be shown.
416 416
417*Workspace Warping*::: 417*Workspace Warping*:::
418 If enabled, you can drag windows from one workspace to another. The previous 418 If enabled, you can drag windows from one workspace to another. There are
419 workspace is to the left, the next workspace is to the right. 419 parameters to set independently whether this warping happens horizontally
420 and/or vertically, and in each direction you can set the number of
421 workspaces to jump when warping (to allow for a virtual rectangular grid
422 of workspaces). When warping, lower-numbered workspaces are above/to the
423 left, and higher-numbered workspaces below/to the right.
420 424
421Window Menu 425Window Menu
422~~~~~~~~~~~ 426~~~~~~~~~~~
diff --git a/doc/fluxbox.1.in b/doc/fluxbox.1.in
index 8d0c1b8..b86ef41 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
828.PP 828.PP
829\fBWorkspace Warping\fR 829\fBWorkspace Warping\fR
830.RS 4 830.RS 4
831If enabled, you can drag windows from one workspace to another\&. The previous workspace is to the left, the next workspace is to the right\&. 831If enabled, you can drag windows from one workspace to another\&. There are
832parameters to set independently whether this warping happens horizontally
833and/or vertically, and in each direction you can set the number of workspaces
834to jump when warping (to allow for a virtual rectangular grid of
835workspaces)\&. When warping, lower-numbered workspaces are above/to the left, and
836higher-numbered workspaces below/to the right\&.
832.RE 837.RE
833.SS "Window Menu" 838.SS "Window Menu"
834.sp 839.sp
diff --git a/src/Screen.hh b/src/Screen.hh
index 83c5cb5..1e03b78 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -95,7 +95,9 @@ public:
95 bool isRootColormapInstalled() const { return root_colormap_installed; } 95 bool isRootColormapInstalled() const { return root_colormap_installed; }
96 bool isScreenManaged() const { return m_state.managed; } 96 bool isScreenManaged() const { return m_state.managed; }
97 bool isWorkspaceWarping() const { return (m_workspaces_list.size() > 1) && *resource.workspace_warping; } 97 bool isWorkspaceWarping() const { return (m_workspaces_list.size() > 1) && *resource.workspace_warping; }
98 bool isWorkspaceWarpingVertical() const { return *resource.workspace_warping_vertical; } 98 bool isWorkspaceWarpingHorizontal() const { return isWorkspaceWarping() && *resource.workspace_warping_horizontal; }
99 bool isWorkspaceWarpingVertical() const { return isWorkspaceWarping() && *resource.workspace_warping_vertical; }
100 int getWorkspaceWarpingHorizontalOffset() const { return *resource.workspace_warping_horizontal_offset; }
99 int getWorkspaceWarpingVerticalOffset() const { return *resource.workspace_warping_vertical_offset; } 101 int getWorkspaceWarpingVerticalOffset() const { return *resource.workspace_warping_vertical_offset; }
100 bool doAutoRaise() const { return *resource.auto_raise; } 102 bool doAutoRaise() const { return *resource.auto_raise; }
101 bool clickRaises() const { return *resource.click_raises; } 103 bool clickRaises() const { return *resource.click_raises; }
diff --git a/src/ScreenResource.cc b/src/ScreenResource.cc
index c5e0027..08a2df1 100644
--- a/src/ScreenResource.cc
+++ b/src/ScreenResource.cc
@@ -89,7 +89,9 @@ ScreenResource::ScreenResource(FbTk::ResourceManager& rm,
89 max_disable_move(rm, false, scrname+".maxDisableMove", altscrname+".MaxDisableMove"), 89 max_disable_move(rm, false, scrname+".maxDisableMove", altscrname+".MaxDisableMove"),
90 max_disable_resize(rm, false, scrname+".maxDisableResize", altscrname+".MaxDisableResize"), 90 max_disable_resize(rm, false, scrname+".maxDisableResize", altscrname+".MaxDisableResize"),
91 workspace_warping(rm, true, scrname+".workspacewarping", altscrname+".WorkspaceWarping"), 91 workspace_warping(rm, true, scrname+".workspacewarping", altscrname+".WorkspaceWarping"),
92 workspace_warping_horizontal(rm, true, scrname+".workspacewarpinghorizontal", altscrname+".WorkspaceWarpingHorizontal"),
92 workspace_warping_vertical(rm, true, scrname+".workspacewarpingvertical", altscrname+".WorkspaceWarpingVertical"), 93 workspace_warping_vertical(rm, true, scrname+".workspacewarpingvertical", altscrname+".WorkspaceWarpingVertical"),
94 workspace_warping_horizontal_offset(rm, 1, scrname+".workspacewarpinghorizontaloffset", altscrname+".WorkspaceWarpingHorizontalOffset"),
93 workspace_warping_vertical_offset(rm, 1, scrname+".workspacewarpingverticaloffset", altscrname+".WorkspaceWarpingVerticalOffset"), 95 workspace_warping_vertical_offset(rm, 1, scrname+".workspacewarpingverticaloffset", altscrname+".WorkspaceWarpingVerticalOffset"),
94 show_window_pos(rm, false, scrname+".showwindowposition", altscrname+".ShowWindowPosition"), 96 show_window_pos(rm, false, scrname+".showwindowposition", altscrname+".ShowWindowPosition"),
95 auto_raise(rm, true, scrname+".autoRaise", altscrname+".AutoRaise"), 97 auto_raise(rm, true, scrname+".autoRaise", altscrname+".AutoRaise"),
diff --git a/src/ScreenResource.hh b/src/ScreenResource.hh
index 120ecf9..5aac6dd 100644
--- a/src/ScreenResource.hh
+++ b/src/ScreenResource.hh
@@ -38,6 +38,7 @@ struct ScreenResource {
38 max_disable_move, 38 max_disable_move,
39 max_disable_resize, 39 max_disable_resize,
40 workspace_warping, 40 workspace_warping,
41 workspace_warping_horizontal,
41 workspace_warping_vertical, 42 workspace_warping_vertical,
42 show_window_pos, 43 show_window_pos,
43 auto_raise, 44 auto_raise,
@@ -56,7 +57,8 @@ struct ScreenResource {
56 menu_delay, 57 menu_delay,
57 tab_width, 58 tab_width,
58 tooltip_delay, 59 tooltip_delay,
59 workspace_warping_vertical_offset; 60 workspace_warping_horizontal_offset,
61 workspace_warping_vertical_offset;
60 FbTk::Resource<bool> allow_remote_actions; 62 FbTk::Resource<bool> allow_remote_actions;
61 FbTk::Resource<bool> clientmenu_use_pixmap; 63 FbTk::Resource<bool> clientmenu_use_pixmap;
62 FbTk::Resource<bool> tabs_use_pixmap; 64 FbTk::Resource<bool> tabs_use_pixmap;
diff --git a/src/Window.cc b/src/Window.cc
index 1f2d184..d761016 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2578,6 +2578,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2578 const int warp_pad = screen().getEdgeSnapThreshold(); 2578 const int warp_pad = screen().getEdgeSnapThreshold();
2579 const int workspaces = screen().numberOfWorkspaces(); 2579 const int workspaces = screen().numberOfWorkspaces();
2580 const bool is_warping = screen().isWorkspaceWarping(); 2580 const bool is_warping = screen().isWorkspaceWarping();
2581 const bool is_warping_horzntal = screen().isWorkspaceWarpingHorizontal();
2581 const bool is_warping_vertical = screen().isWorkspaceWarpingVertical(); 2582 const bool is_warping_vertical = screen().isWorkspaceWarpingVertical();
2582 2583
2583 if ((moved_x || moved_y) && is_warping) { 2584 if ((moved_x || moved_y) && is_warping) {
@@ -2590,12 +2591,13 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2590 int bt_top = int(screen().height()) - warp_pad - 1; 2591 int bt_top = int(screen().height()) - warp_pad - 1;
2591 int bt_bottom = warp_pad; 2592 int bt_bottom = warp_pad;
2592 2593
2593 if (moved_x) { 2594 if (moved_x && is_warping_horzntal) {
2595 const int warp_offset = screen().getWorkspaceWarpingHorizontalOffset();
2594 if (me.x_root >= bt_right && moved_x > 0) { //warp right 2596 if (me.x_root >= bt_right && moved_x > 0) { //warp right
2595 new_id = (cur_id + 1) % workspaces; 2597 new_id = (cur_id + warp_offset) % workspaces;
2596 m_last_resize_x = 0; 2598 m_last_resize_x = 0;
2597 } else if (me.x_root <= bt_left && moved_x < 0) { //warp left 2599 } else if (me.x_root <= bt_left && moved_x < 0) { //warp left
2598 new_id = (cur_id + -1) % workspaces; 2600 new_id = (cur_id + workspaces - warp_offset) % workspaces;
2599 m_last_resize_x = screen().width() - 1; 2601 m_last_resize_x = screen().width() - 1;
2600 } 2602 }
2601 } 2603 }