diff options
author | Robert Ögren <gtk@roboros.com> | 2004-10-30 18:04:49 +0000 |
---|---|---|
committer | Hans Breuer <hans@src.gnome.org> | 2004-10-30 18:04:49 +0000 |
commit | 819e36e5cbc5904378d963eb78a112eaf708832e (patch) | |
tree | ce45e4e63857e2dbe81370ae472bf2d99611fd8f /gdk | |
parent | bc60bccc89da465f38389eeaac5b8450bfb3de72 (diff) | |
download | gtk+-819e36e5cbc5904378d963eb78a112eaf708832e.tar.gz |
Implement these on win32, currently only for button 1. Fixes the resize
2004-10-29 Robert Ögren <gtk@roboros.com>
* gdk/win32/gdkwindow-win32.c (gdk_window_begin_resize_drag),
(gdk_window_begin_move_drag): Implement these on win32, currently
only for button 1. Fixes the resize grip of GtkStatusbar on
win32. (#143285)
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/win32/gdkwindow-win32.c | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 8d5826d833..6c114dac82 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -2842,12 +2842,63 @@ gdk_window_begin_resize_drag (GdkWindow *window, gint root_y, guint32 timestamp) { + WPARAM winedge; + g_return_if_fail (GDK_IS_WINDOW (window)); if (GDK_WINDOW_DESTROYED (window)) return; - /* XXX: isn't all this default on win32 ... */ + /* Tell Windows to start interactively resizing the window by pretending that + * the left pointer button was clicked in the suitable edge or corner. This + * will only work if the button is down when this function is called, and + * will only work with button 1 (left), since Windows only allows window + * dragging using the left mouse button */ + if (button != 1) + return; + + /* Must break the automatic grab that occured when the button was pressed, + * otherwise it won't work */ + gdk_display_pointer_ungrab (gdk_display_get_default (), 0); + + switch (edge) + { + case GDK_WINDOW_EDGE_NORTH_WEST: + winedge = HTTOPLEFT; + break; + + case GDK_WINDOW_EDGE_NORTH: + winedge = HTTOP; + break; + + case GDK_WINDOW_EDGE_NORTH_EAST: + winedge = HTTOPRIGHT; + break; + + case GDK_WINDOW_EDGE_WEST: + winedge = HTLEFT; + break; + + case GDK_WINDOW_EDGE_EAST: + winedge = HTRIGHT; + break; + + case GDK_WINDOW_EDGE_SOUTH_WEST: + winedge = HTBOTTOMLEFT; + break; + + case GDK_WINDOW_EDGE_SOUTH: + winedge = HTBOTTOM; + break; + + case GDK_WINDOW_EDGE_SOUTH_EAST: + default: + winedge = HTBOTTOMRIGHT; + break; + } + + DefWindowProc (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, winedge, + MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y)); } void @@ -2862,7 +2913,20 @@ gdk_window_begin_move_drag (GdkWindow *window, if (GDK_WINDOW_DESTROYED (window)) return; - /* XXX: isn't all this default on win32 ... */ + /* Tell Windows to start interactively moving the window by pretending that + * the left pointer button was clicked in the titlebar. This will only work + * if the button is down when this function is called, and will only work + * with button 1 (left), since Windows only allows window dragging using the + * left mouse button */ + if (button != 1) + return; + + /* Must break the automatic grab that occured when the button was pressed, + * otherwise it won't work */ + gdk_display_pointer_ungrab (gdk_display_get_default (), 0); + + DefWindowProc (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, HTCAPTION, + MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y)); } |