summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2007-11-16 07:35:00 +0100
committerDanny Baumann <dannybaumann@web.de>2007-11-16 07:35:00 +0100
commit376d871892a06e7df1e90c04944cf7c5143a1ff4 (patch)
treeaa1d5428cd5ecedd43732777448fe9212c012ef2 /gtk
parent1ac1a31a8308126df568e2deb898a3c0a8af87f8 (diff)
Make the window frame also process the configured actions for middle and right mouse button click, so that the frame behaves the same way as the title.
Double click and scroll actions still are title-only as those actions are more "invasive" and might be confusing if triggerable from the frame.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/window-decorator/gtk-window-decorator.c96
1 files changed, 56 insertions, 40 deletions
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 9f236c2b..312d9a04 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -4413,38 +4413,6 @@ min_button_event (WnckWindow *win,
}
static void
-top_left_event (WnckWindow *win,
- XEvent *xevent)
-{
- if (xevent->xbutton.button == 1)
- move_resize_window (win, WM_MOVERESIZE_SIZE_TOPLEFT, xevent);
-}
-
-static void
-top_event (WnckWindow *win,
- XEvent *xevent)
-{
- if (xevent->xbutton.button == 1)
- move_resize_window (win, WM_MOVERESIZE_SIZE_TOP, xevent);
-}
-
-static void
-top_right_event (WnckWindow *win,
- XEvent *xevent)
-{
- if (xevent->xbutton.button == 1)
- move_resize_window (win, WM_MOVERESIZE_SIZE_TOPRIGHT, xevent);
-}
-
-static void
-left_event (WnckWindow *win,
- XEvent *xevent)
-{
- if (xevent->xbutton.button == 1)
- move_resize_window (win, WM_MOVERESIZE_SIZE_LEFT, xevent);
-}
-
-static void
action_menu_unmap (GObject *object)
{
action_menu_mapped = FALSE;
@@ -4822,35 +4790,83 @@ title_event (WnckWindow *win,
}
static void
+frame_common_event (WnckWindow *win,
+ int direction,
+ XEvent *xevent)
+{
+ if (xevent->type != ButtonPress)
+ return;
+
+ switch (xevent->xbutton.button) {
+ case 1:
+ move_resize_window (win, direction, xevent);
+ restack_window (win, Above);
+ break;
+ case 2:
+ handle_title_button_event (win, middle_click_action,
+ &xevent->xbutton);
+ break;
+ case 3:
+ handle_title_button_event (win, right_click_action,
+ &xevent->xbutton);
+ break;
+ }
+}
+
+static void
+top_left_event (WnckWindow *win,
+ XEvent *xevent)
+{
+ frame_common_event (win, WM_MOVERESIZE_SIZE_TOPLEFT, xevent);
+}
+
+static void
+top_event (WnckWindow *win,
+ XEvent *xevent)
+{
+ frame_common_event (win, WM_MOVERESIZE_SIZE_TOP, xevent);
+}
+
+static void
+top_right_event (WnckWindow *win,
+ XEvent *xevent)
+{
+ frame_common_event (win, WM_MOVERESIZE_SIZE_TOPRIGHT, xevent);
+}
+
+static void
+left_event (WnckWindow *win,
+ XEvent *xevent)
+{
+ frame_common_event (win, WM_MOVERESIZE_SIZE_LEFT, xevent);
+}
+
+static void
right_event (WnckWindow *win,
XEvent *xevent)
{
- if (xevent->xbutton.button == 1)
- move_resize_window (win, WM_MOVERESIZE_SIZE_RIGHT, xevent);
+ frame_common_event (win, WM_MOVERESIZE_SIZE_RIGHT, xevent);
}
static void
bottom_left_event (WnckWindow *win,
XEvent *xevent)
{
- if (xevent->xbutton.button == 1)
- move_resize_window (win, WM_MOVERESIZE_SIZE_BOTTOMLEFT, xevent);
+ frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOMLEFT, xevent);
}
static void
bottom_event (WnckWindow *win,
XEvent *xevent)
{
- if (xevent->xbutton.button == 1)
- move_resize_window (win, WM_MOVERESIZE_SIZE_BOTTOM, xevent);
+ frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOM, xevent);
}
static void
bottom_right_event (WnckWindow *win,
XEvent *xevent)
{
- if (xevent->xbutton.button == 1)
- move_resize_window (win, WM_MOVERESIZE_SIZE_BOTTOMRIGHT, xevent);
+ frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOMRIGHT, xevent);
}
static void