diff options
author | rathnor <rathnor> | 2003-09-29 12:53:58 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-09-29 12:53:58 (GMT) |
commit | 10ce5372d99251d65ff0d4e65c6e19cf05bb208a (patch) | |
tree | 554880caa9be789ff07b38393f36b9aba8e875b7 /src | |
parent | 48cc8772e32ad9cb56a0086840be41e72e94c41e (diff) | |
download | fluxbox-10ce5372d99251d65ff0d4e65c6e19cf05bb208a.zip fluxbox-10ce5372d99251d65ff0d4e65c6e19cf05bb208a.tar.bz2 |
quadrant-resizing (Thanks Mathias Gumz)
Diffstat (limited to 'src')
-rw-r--r-- | src/FbWinFrameTheme.cc | 5 | ||||
-rw-r--r-- | src/FbWinFrameTheme.hh | 10 | ||||
-rw-r--r-- | src/Screen.cc | 3 | ||||
-rw-r--r-- | src/Screen.hh | 7 | ||||
-rw-r--r-- | src/Window.cc | 132 | ||||
-rw-r--r-- | src/Window.hh | 16 |
6 files changed, 85 insertions, 88 deletions
diff --git a/src/FbWinFrameTheme.cc b/src/FbWinFrameTheme.cc index 5ac0d3d..67a618d 100644 --- a/src/FbWinFrameTheme.cc +++ b/src/FbWinFrameTheme.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbWinFrameTheme.cc,v 1.12 2003/09/12 23:37:12 fluxgen Exp $ | 22 | // $Id: FbWinFrameTheme.cc,v 1.13 2003/09/29 12:53:58 rathnor Exp $ |
23 | 23 | ||
24 | #include "FbWinFrameTheme.hh" | 24 | #include "FbWinFrameTheme.hh" |
25 | #include "App.hh" | 25 | #include "App.hh" |
@@ -78,7 +78,8 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num): | |||
78 | m_cursor_move = XCreateFontCursor(disp, XC_fleur); | 78 | m_cursor_move = XCreateFontCursor(disp, XC_fleur); |
79 | m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle); | 79 | m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle); |
80 | m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle); | 80 | m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle); |
81 | 81 | m_cursor_upper_right_angle = XCreateFontCursor(disp, XC_ur_angle); | |
82 | m_cursor_upper_left_angle = XCreateFontCursor(disp, XC_ul_angle); | ||
82 | } | 83 | } |
83 | 84 | ||
84 | FbWinFrameTheme::~FbWinFrameTheme() { | 85 | FbWinFrameTheme::~FbWinFrameTheme() { |
diff --git a/src/FbWinFrameTheme.hh b/src/FbWinFrameTheme.hh index 6b4edd4..712f4be 100644 --- a/src/FbWinFrameTheme.hh +++ b/src/FbWinFrameTheme.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbWinFrameTheme.hh,v 1.11 2003/09/12 23:37:12 fluxgen Exp $ | 22 | // $Id: FbWinFrameTheme.hh,v 1.12 2003/09/29 12:53:58 rathnor Exp $ |
23 | 23 | ||
24 | #ifndef FBWINFRAMETHEME_HH | 24 | #ifndef FBWINFRAMETHEME_HH |
25 | #define FBWINFRAMETHEME_HH | 25 | #define FBWINFRAMETHEME_HH |
@@ -90,6 +90,8 @@ public: | |||
90 | inline Cursor moveCursor() const { return m_cursor_move; } | 90 | inline Cursor moveCursor() const { return m_cursor_move; } |
91 | inline Cursor lowerLeftAngleCursor() const { return m_cursor_lower_left_angle; } | 91 | inline Cursor lowerLeftAngleCursor() const { return m_cursor_lower_left_angle; } |
92 | inline Cursor lowerRightAngleCursor() const { return m_cursor_lower_right_angle; } | 92 | inline Cursor lowerRightAngleCursor() const { return m_cursor_lower_right_angle; } |
93 | inline Cursor upperLeftAngleCursor() const { return m_cursor_upper_left_angle; } | ||
94 | inline Cursor upperRightAngleCursor() const { return m_cursor_upper_right_angle; } | ||
93 | 95 | ||
94 | inline Shape::ShapePlace shapePlace() const { return *m_shape_place; } | 96 | inline Shape::ShapePlace shapePlace() const { return *m_shape_place; } |
95 | inline const BorderTheme &border() const { return m_border; } | 97 | inline const BorderTheme &border() const { return m_border; } |
@@ -122,7 +124,11 @@ private: | |||
122 | 124 | ||
123 | FbTk::Subject m_theme_change; | 125 | FbTk::Subject m_theme_change; |
124 | 126 | ||
125 | Cursor m_cursor_move, m_cursor_lower_left_angle, m_cursor_lower_right_angle; | 127 | Cursor m_cursor_move; |
128 | Cursor m_cursor_lower_left_angle; | ||
129 | Cursor m_cursor_lower_right_angle; | ||
130 | Cursor m_cursor_upper_left_angle; | ||
131 | Cursor m_cursor_upper_right_angle; | ||
126 | }; | 132 | }; |
127 | 133 | ||
128 | #endif // FBWINFRAMETHEME_HH | 134 | #endif // FBWINFRAMETHEME_HH |
diff --git a/src/Screen.cc b/src/Screen.cc index ade286d..f2466e3 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.234 2003/09/24 14:26:01 rathnor Exp $ | 25 | // $Id: Screen.cc,v 1.235 2003/09/29 12:53:58 rathnor Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -254,6 +254,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, | |||
254 | auto_raise(rm, false, scrname+".autoRaise", altscrname+".AutoRaise"), | 254 | auto_raise(rm, false, scrname+".autoRaise", altscrname+".AutoRaise"), |
255 | click_raises(rm, true, scrname+".clickRaises", altscrname+".ClickRaises"), | 255 | click_raises(rm, true, scrname+".clickRaises", altscrname+".ClickRaises"), |
256 | rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), | 256 | rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), |
257 | resizemode(rm, "", scrname+".resizeMode", altscrname+".ResizeMode"), | ||
257 | focus_model(rm, Fluxbox::CLICKTOFOCUS, scrname+".focusModel", altscrname+".FocusModel"), | 258 | focus_model(rm, Fluxbox::CLICKTOFOCUS, scrname+".focusModel", altscrname+".FocusModel"), |
258 | workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"), | 259 | workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"), |
259 | edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), | 260 | edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), |
diff --git a/src/Screen.hh b/src/Screen.hh index de25c7d..7e221e3 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.hh,v 1.124 2003/09/08 16:37:27 fluxgen Exp $ | 25 | // $Id: Screen.hh,v 1.125 2003/09/29 12:53:58 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef SCREEN_HH | 27 | #ifndef SCREEN_HH |
28 | #define SCREEN_HH | 28 | #define SCREEN_HH |
@@ -92,13 +92,14 @@ public: | |||
92 | inline bool doFocusNew() const { return *resource.focus_new; } | 92 | inline bool doFocusNew() const { return *resource.focus_new; } |
93 | inline bool doFocusLast() const { return *resource.focus_last; } | 93 | inline bool doFocusLast() const { return *resource.focus_last; } |
94 | inline bool doShowWindowPos() const { return *resource.show_window_pos; } | 94 | inline bool doShowWindowPos() const { return *resource.show_window_pos; } |
95 | bool antialias() const { return *resource.antialias; } | 95 | inline bool antialias() const { return *resource.antialias; } |
96 | 96 | ||
97 | inline FbTk::ImageControl &imageControl() { return *m_image_control.get(); } | 97 | inline FbTk::ImageControl &imageControl() { return *m_image_control.get(); } |
98 | const FbTk::Menu * const getRootmenu() const { return m_rootmenu.get(); } | 98 | const FbTk::Menu * const getRootmenu() const { return m_rootmenu.get(); } |
99 | FbTk::Menu * const getRootmenu() { return m_rootmenu.get(); } | 99 | FbTk::Menu * const getRootmenu() { return m_rootmenu.get(); } |
100 | 100 | ||
101 | inline const std::string &getRootCommand() const { return *resource.rootcommand; } | 101 | inline const std::string &getRootCommand() const { return *resource.rootcommand; } |
102 | inline const std::string &getResizeMode() const { return *resource.resizemode; } | ||
102 | inline Fluxbox::FocusModel getFocusModel() const { return *resource.focus_model; } | 103 | inline Fluxbox::FocusModel getFocusModel() const { return *resource.focus_model; } |
103 | 104 | ||
104 | inline Slit *slit() { return m_slit.get(); } | 105 | inline Slit *slit() { return m_slit.get(); } |
@@ -170,6 +171,7 @@ public: | |||
170 | 171 | ||
171 | inline void setRootColormapInstalled(bool r) { root_colormap_installed = r; } | 172 | inline void setRootColormapInstalled(bool r) { root_colormap_installed = r; } |
172 | inline void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; } | 173 | inline void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; } |
174 | inline void saveResizeMode(std::string resizem) { *resource.resizemode = resizem; } | ||
173 | inline void saveFocusModel(Fluxbox::FocusModel model) { resource.focus_model = model; } | 175 | inline void saveFocusModel(Fluxbox::FocusModel model) { resource.focus_model = model; } |
174 | inline void saveWorkspaces(int w) { *resource.workspaces = w; } | 176 | inline void saveWorkspaces(int w) { *resource.workspaces = w; } |
175 | 177 | ||
@@ -421,6 +423,7 @@ private: | |||
421 | focus_last, focus_new, | 423 | focus_last, focus_new, |
422 | antialias, auto_raise, click_raises; | 424 | antialias, auto_raise, click_raises; |
423 | FbTk::Resource<std::string> rootcommand; | 425 | FbTk::Resource<std::string> rootcommand; |
426 | FbTk::Resource<std::string> resizemode; | ||
424 | FbTk::Resource<Fluxbox::FocusModel> focus_model; | 427 | FbTk::Resource<Fluxbox::FocusModel> focus_model; |
425 | bool ordered_dither; | 428 | bool ordered_dither; |
426 | FbTk::Resource<int> workspaces, edge_snap_threshold, menu_alpha; | 429 | FbTk::Resource<int> workspaces, edge_snap_threshold, menu_alpha; |
diff --git a/src/Window.cc b/src/Window.cc index f35c21e..193f689 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.234 2003/09/24 14:02:25 rathnor Exp $ | 25 | // $Id: Window.cc,v 1.235 2003/09/29 12:53:58 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -266,7 +266,8 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t | |||
266 | m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)), | 266 | m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)), |
267 | m_layeritem(m_frame->window(), layer), | 267 | m_layeritem(m_frame->window(), layer), |
268 | m_layernum(layer.getLayerNum()), | 268 | m_layernum(layer.getLayerNum()), |
269 | m_parent(scr.rootWindow()) { | 269 | m_parent(scr.rootWindow()), |
270 | m_resize_corner(RIGHTBOTTOM) { | ||
270 | 271 | ||
271 | init(); | 272 | init(); |
272 | } | 273 | } |
@@ -934,10 +935,10 @@ void FluxboxWindow::grabButtons() { | |||
934 | 935 | ||
935 | XGrabButton(display, Button3, Mod1Mask, frame().window().window(), True, | 936 | XGrabButton(display, Button3, Mod1Mask, frame().window().window(), True, |
936 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 937 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
937 | GrabModeAsync, None, frame().theme().lowerRightAngleCursor()); | 938 | GrabModeAsync, None, None); |
938 | 939 | ||
939 | //---grab with "all" modifiers | 940 | //---grab with "all" modifiers |
940 | grabButton(display, Button3, frame().window().window(), frame().theme().lowerRightAngleCursor()); | 941 | grabButton(display, Button3, frame().window().window(), None); |
941 | } | 942 | } |
942 | 943 | ||
943 | 944 | ||
@@ -2389,10 +2390,23 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2389 | me.window == frame().gripLeft())) || | 2390 | me.window == frame().gripLeft())) || |
2390 | me.window == frame().window())) { | 2391 | me.window == frame().window())) { |
2391 | 2392 | ||
2392 | bool left = (me.window == frame().gripLeft()); | ||
2393 | |||
2394 | if (! resizing) { | 2393 | if (! resizing) { |
2395 | startResizing(me.window, me.x, me.y, left); | 2394 | |
2395 | int cx = frame().width() / 2; | ||
2396 | int cy = frame().height() / 2; | ||
2397 | |||
2398 | if (me.window == frame().gripRight()) | ||
2399 | m_resize_corner = RIGHTBOTTOM; | ||
2400 | else if (me.window == frame().gripLeft()) | ||
2401 | m_resize_corner = LEFTBOTTOM; | ||
2402 | else if (screen().getResizeMode() != "quadrant") | ||
2403 | m_resize_corner = RIGHTBOTTOM; | ||
2404 | else if (me.x < cx) | ||
2405 | m_resize_corner = (me.y < cy) ? LEFTTOP : LEFTBOTTOM; | ||
2406 | else | ||
2407 | m_resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM; | ||
2408 | |||
2409 | startResizing(me.window, me.x, me.y); | ||
2396 | } else if (resizing) { | 2410 | } else if (resizing) { |
2397 | // draw over old rect | 2411 | // draw over old rect |
2398 | parent().drawRectangle(screen().rootTheme().opGC(), | 2412 | parent().drawRectangle(screen().rootTheme().opGC(), |
@@ -2404,24 +2418,25 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2404 | // move rectangle | 2418 | // move rectangle |
2405 | int gx = 0, gy = 0; | 2419 | int gx = 0, gy = 0; |
2406 | 2420 | ||
2407 | m_last_resize_h = frame().height() + (me.y - m_button_grab_y); | 2421 | int dx = me.x - m_button_grab_x; |
2408 | if (m_last_resize_h < 1) | 2422 | int dy = me.y - m_button_grab_y; |
2409 | m_last_resize_h = 1; | ||
2410 | |||
2411 | if (left) { | ||
2412 | m_last_resize_x = me.x_root - m_button_grab_x; | ||
2413 | if (m_last_resize_x > (signed) (frame().x() + frame().width())) | ||
2414 | m_last_resize_x = m_last_resize_x + frame().width() - 1; | ||
2415 | 2423 | ||
2416 | left_fixsize(&gx, &gy); | 2424 | if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) { |
2425 | m_last_resize_h = frame().height() - dy; | ||
2426 | m_last_resize_y = frame().y() + dy; | ||
2417 | } else { | 2427 | } else { |
2418 | m_last_resize_w = frame().width() + (me.x - m_button_grab_x); | 2428 | m_last_resize_h = frame().height() + dy; |
2419 | if (m_last_resize_w < 1) // clamp to 1 | 2429 | } |
2420 | m_last_resize_w = 1; | ||
2421 | 2430 | ||
2422 | right_fixsize(&gx, &gy); | 2431 | if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) { |
2432 | m_last_resize_w = frame().width() - dx; | ||
2433 | m_last_resize_x = frame().x() + dx; | ||
2434 | } else { | ||
2435 | m_last_resize_w = frame().width() + dx; | ||
2423 | } | 2436 | } |
2424 | 2437 | ||
2438 | fixsize(&gx, &gy); | ||
2439 | |||
2425 | // draw resize rectangle | 2440 | // draw resize rectangle |
2426 | parent().drawRectangle(screen().rootTheme().opGC(), | 2441 | parent().drawRectangle(screen().rootTheme().opGC(), |
2427 | m_last_resize_x, m_last_resize_y, | 2442 | m_last_resize_x, m_last_resize_y, |
@@ -2877,13 +2892,16 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { | |||
2877 | } | 2892 | } |
2878 | 2893 | ||
2879 | 2894 | ||
2880 | void FluxboxWindow::startResizing(Window win, int x, int y, bool left) { | 2895 | void FluxboxWindow::startResizing(Window win, int x, int y) { |
2881 | resizing = true; | 2896 | resizing = true; |
2882 | 2897 | ||
2898 | const Cursor& cursor = (m_resize_corner == LEFTTOP) ? frame().theme().upperLeftAngleCursor() : | ||
2899 | (m_resize_corner == RIGHTTOP) ? frame().theme().upperRightAngleCursor() : | ||
2900 | (m_resize_corner == RIGHTBOTTOM) ? frame().theme().lowerRightAngleCursor() : | ||
2901 | frame().theme().lowerLeftAngleCursor(); | ||
2902 | |||
2883 | XGrabPointer(display, win, false, ButtonMotionMask | ButtonReleaseMask, | 2903 | XGrabPointer(display, win, false, ButtonMotionMask | ButtonReleaseMask, |
2884 | GrabModeAsync, GrabModeAsync, None, | 2904 | GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); |
2885 | (left ? frame().theme().lowerLeftAngleCursor() : frame().theme().lowerRightAngleCursor()), | ||
2886 | CurrentTime); | ||
2887 | 2905 | ||
2888 | int gx = 0, gy = 0; | 2906 | int gx = 0, gy = 0; |
2889 | m_button_grab_x = x; | 2907 | m_button_grab_x = x; |
@@ -2893,10 +2911,7 @@ void FluxboxWindow::startResizing(Window win, int x, int y, bool left) { | |||
2893 | m_last_resize_w = frame().width(); | 2911 | m_last_resize_w = frame().width(); |
2894 | m_last_resize_h = frame().height(); | 2912 | m_last_resize_h = frame().height(); |
2895 | 2913 | ||
2896 | if (left) | 2914 | fixsize(&gx, &gy); |
2897 | left_fixsize(&gx, &gy); | ||
2898 | else | ||
2899 | right_fixsize(&gx, &gy); | ||
2900 | 2915 | ||
2901 | if (screen().doShowWindowPos()) | 2916 | if (screen().doShowWindowPos()) |
2902 | screen().showGeometry(gx, gy); | 2917 | screen().showGeometry(gx, gy); |
@@ -2917,11 +2932,7 @@ void FluxboxWindow::stopResizing(Window win) { | |||
2917 | 2932 | ||
2918 | screen().hideGeometry(); | 2933 | screen().hideGeometry(); |
2919 | 2934 | ||
2920 | if (win && win == frame().gripLeft()) | 2935 | fixsize(); |
2921 | left_fixsize(); | ||
2922 | else | ||
2923 | right_fixsize(); | ||
2924 | |||
2925 | 2936 | ||
2926 | moveResize(m_last_resize_x, m_last_resize_y, | 2937 | moveResize(m_last_resize_x, m_last_resize_y, |
2927 | m_last_resize_w, m_last_resize_h); | 2938 | m_last_resize_w, m_last_resize_h); |
@@ -3155,49 +3166,7 @@ void FluxboxWindow::downsize() { | |||
3155 | } | 3166 | } |
3156 | 3167 | ||
3157 | 3168 | ||
3158 | void FluxboxWindow::right_fixsize(int *gx, int *gy) { | 3169 | void FluxboxWindow::fixsize(int *gx, int *gy) { |
3159 | // calculate the size of the client window and conform it to the | ||
3160 | // size specified by the size hints of the client window... | ||
3161 | int dx = m_last_resize_w - m_client->base_width; | ||
3162 | int titlebar_height = (decorations.titlebar ? | ||
3163 | frame().titlebar().height() + | ||
3164 | frame().titlebar().borderWidth() : 0); | ||
3165 | int handle_height = (decorations.handle ? | ||
3166 | frame().handle().height() + | ||
3167 | frame().handle().borderWidth() : 0); | ||
3168 | |||
3169 | int dy = m_last_resize_h - m_client->base_height - titlebar_height - handle_height; | ||
3170 | if (dx < (signed) m_client->min_width) | ||
3171 | dx = m_client->min_width; | ||
3172 | if (dy < (signed) m_client->min_height) | ||
3173 | dy = m_client->min_height; | ||
3174 | if (m_client->max_width > 0 && (unsigned) dx > m_client->max_width) | ||
3175 | dx = m_client->max_width; | ||
3176 | if (m_client->max_height > 0 && (unsigned) dy > m_client->max_height) | ||
3177 | dy = m_client->max_height; | ||
3178 | |||
3179 | // make it snap | ||
3180 | |||
3181 | if (m_client->width_inc == 0) | ||
3182 | m_client->width_inc = 1; | ||
3183 | if (m_client->height_inc == 0) | ||
3184 | m_client->height_inc = 1; | ||
3185 | |||
3186 | dx /= m_client->width_inc; | ||
3187 | dy /= m_client->height_inc; | ||
3188 | |||
3189 | if (gx) *gx = dx; | ||
3190 | if (gy) *gy = dy; | ||
3191 | |||
3192 | dx = (dx * m_client->width_inc) + m_client->base_width; | ||
3193 | dy = (dy * m_client->height_inc) + m_client->base_height + | ||
3194 | titlebar_height + handle_height; | ||
3195 | |||
3196 | m_last_resize_w = dx; | ||
3197 | m_last_resize_h = dy; | ||
3198 | } | ||
3199 | |||
3200 | void FluxboxWindow::left_fixsize(int *gx, int *gy) { | ||
3201 | int titlebar_height = (decorations.titlebar ? | 3170 | int titlebar_height = (decorations.titlebar ? |
3202 | frame().titlebar().height() + | 3171 | frame().titlebar().height() + |
3203 | frame().titlebar().borderWidth() : 0); | 3172 | frame().titlebar().borderWidth() : 0); |
@@ -3207,7 +3176,8 @@ void FluxboxWindow::left_fixsize(int *gx, int *gy) { | |||
3207 | int decoration_height = titlebar_height + handle_height; | 3176 | int decoration_height = titlebar_height + handle_height; |
3208 | 3177 | ||
3209 | // dx is new width = current width + difference between new and old x values | 3178 | // dx is new width = current width + difference between new and old x values |
3210 | int dx = frame().width() + frame().x() - m_last_resize_x; | 3179 | //int dx = frame().width() + frame().x() - m_last_resize_x; |
3180 | int dx = m_last_resize_w - m_client->base_width; | ||
3211 | 3181 | ||
3212 | // dy = new height (w/o decorations), similarly | 3182 | // dy = new height (w/o decorations), similarly |
3213 | int dy = m_last_resize_h - m_client->base_height - decoration_height; | 3183 | int dy = m_last_resize_h - m_client->base_height - decoration_height; |
@@ -3247,7 +3217,15 @@ void FluxboxWindow::left_fixsize(int *gx, int *gy) { | |||
3247 | // update last resize | 3217 | // update last resize |
3248 | m_last_resize_w = dx; | 3218 | m_last_resize_w = dx; |
3249 | m_last_resize_h = dy; | 3219 | m_last_resize_h = dy; |
3220 | |||
3221 | if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) { | ||
3250 | m_last_resize_x = frame().x() + frame().width() - m_last_resize_w; | 3222 | m_last_resize_x = frame().x() + frame().width() - m_last_resize_w; |
3223 | } | ||
3224 | |||
3225 | if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) { | ||
3226 | m_last_resize_y = frame().y() + frame().height() - m_last_resize_h; | ||
3227 | } | ||
3228 | |||
3251 | } | 3229 | } |
3252 | 3230 | ||
3253 | void FluxboxWindow::resizeClient(WinClient &client, | 3231 | void FluxboxWindow::resizeClient(WinClient &client, |
diff --git a/src/Window.hh b/src/Window.hh index 8c2fe46..e023253 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.hh,v 1.95 2003/09/24 14:02:25 rathnor Exp $ | 25 | // $Id: Window.hh,v 1.96 2003/09/29 12:53:58 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -131,6 +131,13 @@ public: | |||
131 | DECORM_LAST = (1<<11) // useful for getting "All" | 131 | DECORM_LAST = (1<<11) // useful for getting "All" |
132 | }; | 132 | }; |
133 | 133 | ||
134 | enum ResizeCorner { | ||
135 | LEFTTOP, | ||
136 | LEFTBOTTOM, | ||
137 | RIGHTBOTTOM, | ||
138 | RIGHTTOP | ||
139 | }; | ||
140 | |||
134 | typedef struct _blackbox_hints { | 141 | typedef struct _blackbox_hints { |
135 | unsigned long flags, attrib, workspace, stack; | 142 | unsigned long flags, attrib, workspace, stack; |
136 | int decoration; | 143 | int decoration; |
@@ -366,7 +373,7 @@ private: | |||
366 | 373 | ||
367 | void startMoving(Window win); | 374 | void startMoving(Window win); |
368 | void stopMoving(); | 375 | void stopMoving(); |
369 | void startResizing(Window win, int x, int y, bool left); | 376 | void startResizing(Window win, int x, int y); |
370 | void stopResizing(Window win=0); | 377 | void stopResizing(Window win=0); |
371 | void updateIcon(); | 378 | void updateIcon(); |
372 | /// try to attach current attaching client to a window at pos x, y | 379 | /// try to attach current attaching client to a window at pos x, y |
@@ -391,8 +398,7 @@ private: | |||
391 | 398 | ||
392 | // modifies left and top if snap is necessary | 399 | // modifies left and top if snap is necessary |
393 | void doSnapping(int &left, int &top); | 400 | void doSnapping(int &left, int &top); |
394 | void right_fixsize(int *x = 0, int *y = 0); | 401 | void fixsize(int *x = 0, int *y = 0); |
395 | void left_fixsize(int *x = 0, int *y = 0); | ||
396 | void resizeClient(WinClient &client, unsigned int width, unsigned int height); | 402 | void resizeClient(WinClient &client, unsigned int width, unsigned int height); |
397 | /// sends configurenotify to all clients | 403 | /// sends configurenotify to all clients |
398 | void sendConfigureNotify(bool send_to_netizens = true); | 404 | void sendConfigureNotify(bool send_to_netizens = true); |
@@ -456,6 +462,8 @@ private: | |||
456 | 462 | ||
457 | FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window") | 463 | FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window") |
458 | 464 | ||
465 | ResizeCorner m_resize_corner; | ||
466 | |||
459 | ExtraMenus m_extramenus; | 467 | ExtraMenus m_extramenus; |
460 | }; | 468 | }; |
461 | 469 | ||