diff options
author | rhp <rhp> | 2001-07-04 02:10:54 +0000 |
---|---|---|
committer | rhp <rhp> | 2001-07-04 02:10:54 +0000 |
commit | ec00c9852d57b812a78d242fffe1d1d52f272427 (patch) | |
tree | 1babb9b6ec440f600b5db113b067afce65ff8732 | |
parent | 3650c23055d613c7660b64f60f841f2649c5fa3a (diff) | |
download | metacity-ec00c9852d57b812a78d242fffe1d1d52f272427.tar.gz |
...
-rw-r--r-- | src/frames.c | 77 | ||||
-rw-r--r-- | src/frames.h | 2 | ||||
-rw-r--r-- | src/keybindings.c | 40 | ||||
-rw-r--r-- | src/place.c | 2 | ||||
-rw-r--r-- | src/ui.c | 6 | ||||
-rw-r--r-- | src/ui.h | 3 | ||||
-rw-r--r-- | src/window.c | 6 |
7 files changed, 111 insertions, 25 deletions
diff --git a/src/frames.c b/src/frames.c index f7d5825b..354484a4 100644 --- a/src/frames.c +++ b/src/frames.c @@ -709,28 +709,42 @@ meta_frames_manage_window (MetaFrames *frames, gdk_window_set_user_data (frame->window, frames); -#if 0 - /* Add events in frame.c */ - gdk_window_set_events (frame->window, - GDK_EXPOSURE_MASK | - GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_STRUCTURE_MASK); - - /* This shouldn't be required if we don't select for button - * press in frame.c? + /* Don't set event mask here, it's in frame.c */ + + /* Grab Alt + button1 and Alt + button2 for moving window, + * and Alt + button3 for popping up window menu. */ - XGrabButton (gdk_display, AnyButton, AnyModifier, - xwindow, False, - ButtonPressMask | ButtonReleaseMask | - PointerMotionMask | PointerMotionHintMask, - GrabModeAsync, GrabModeAsync, - False, None); - - XFlush (gdk_display); + { + int i = 1; + while (i < 4) + { + if (XGrabButton (gdk_display, i, Mod1Mask, + xwindow, False, + ButtonPressMask | ButtonReleaseMask | + PointerMotionMask | PointerMotionHintMask, + GrabModeAsync, GrabModeAsync, + False, None) != Success) + meta_warning ("Failed to grab button %d with Mod1Mask for frame 0x%lx\n", + i, xwindow); + +#if 0 + /* This is just for debugging, since I end up moving + * the Xnest otherwise ;-) + */ + if (XGrabButton (gdk_display, i, ControlMask, + xwindow, False, + ButtonPressMask | ButtonReleaseMask | + PointerMotionMask | PointerMotionHintMask, + GrabModeAsync, GrabModeAsync, + False, None) != Success) + meta_warning ("Failed to grab button %d with ControlMask for frame 0x%lx\n", + i, xwindow); + #endif + + ++i; + } + } frame->xwindow = xwindow; frame->layout = NULL; @@ -1362,14 +1376,12 @@ meta_frames_button_press_event (GtkWidget *widget, break; } - g_assert (status != META_FRAME_STATUS_NORMAL); - meta_frames_begin_grab (frames, frame, status, event->button, 0, 0, 0, 0, 0, 0, /* not needed */ event->time); - + redraw_control (frames, frame, control); if (status == META_FRAME_STATUS_CLICKING_MENU) @@ -1487,6 +1499,15 @@ meta_frames_button_press_event (GtkWidget *widget, event->time); } } + else if (event->button == 3) + { + meta_core_show_window_menu (gdk_display, + frame->xwindow, + event->x_root, + event->y_root, + event->button, + event->time); + } return TRUE; } @@ -2411,3 +2432,13 @@ get_control (MetaFrames *frames, return META_FRAME_CONTROL_NONE; } + +Window +meta_frames_get_moving_frame (MetaFrames *frames) +{ + if (frames->grab_frame && + frames->grab_status == META_FRAME_STATUS_MOVING) + return frames->grab_frame->xwindow; + else + return None; +} diff --git a/src/frames.h b/src/frames.h index baf0042f..b53325ee 100644 --- a/src/frames.h +++ b/src/frames.h @@ -157,4 +157,6 @@ void meta_frames_get_pixmap_for_control (MetaFrames *frames, void meta_frames_notify_menu_hide (MetaFrames *frames); +Window meta_frames_get_moving_frame (MetaFrames *frames); + #endif diff --git a/src/keybindings.c b/src/keybindings.c index bdaa563d..28001539 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -286,7 +286,47 @@ handle_activate_workspace (MetaDisplay *display, if (workspace) { + Window move_frame; + MetaWindow *move_window; + + move_window = NULL; + move_frame = meta_ui_get_moving_frame (workspace->screen->ui); + + if (move_frame != None) + { + move_window = meta_display_lookup_x_window (display, move_frame); + + if (move_window == NULL || + move_window->frame == NULL) + meta_bug ("No move_frame window 0x%lx!\n", move_frame); + + if (move_window->on_all_workspaces) + move_window = NULL; /* don't move it after all */ + + /* We put the window on the new workspace, flip spaces, + * then remove from old workspace, so the window + * never gets unmapped and we maintain the button grab + * on it. + */ + if (move_window) + { + if (!meta_workspace_contains_window (workspace, + move_window)) + meta_workspace_add_window (workspace, move_window); + } + } + meta_workspace_activate (workspace); + + if (move_window) + { + /* Lamely rely on prepend */ + g_assert (move_window->workspaces->data == workspace); + + while (move_window->workspaces->next) /* while list size > 1 */ + meta_workspace_remove_window (move_window->workspaces->next->data, + move_window); + } } else { diff --git a/src/place.c b/src/place.c index 9b238e6b..464ad779 100644 --- a/src/place.c +++ b/src/place.c @@ -255,7 +255,7 @@ meta_window_place (MetaWindow *window, /* Center on screen */ int w, h; - /* I think whole screen will look nicer than workarea */ + /* I think whole screen will look nicer than workarea */ w = WidthOfScreen (window->screen->xscreen); h = HeightOfScreen (window->screen->xscreen); @@ -151,6 +151,12 @@ meta_ui_remove_frame (MetaUI *ui, meta_frames_unmanage_window (ui->frames, xwindow); } +Window +meta_ui_get_moving_frame (MetaUI *ui) +{ + return meta_frames_get_moving_frame (ui->frames); +} + void meta_ui_map_frame (MetaUI *ui, Window xwindow) @@ -55,6 +55,9 @@ void meta_ui_add_frame (MetaUI *ui, void meta_ui_remove_frame (MetaUI *ui, Window xwindow); +Window meta_ui_get_moving_frame (MetaUI *ui); + + /* GDK insists on tracking map/unmap */ void meta_ui_map_frame (MetaUI *ui, Window xwindow); diff --git a/src/window.c b/src/window.c index 6bde549c..801226c8 100644 --- a/src/window.c +++ b/src/window.c @@ -604,6 +604,8 @@ void meta_window_calc_showing (MetaWindow *window) { gboolean on_workspace; + + meta_verbose ("Calc showing for window %s\n", window->desc); on_workspace = g_list_find (window->workspaces, window->screen->active_workspace) != NULL; @@ -655,6 +657,8 @@ idle_calc_showing (gpointer data) { GSList *tmp; + meta_verbose ("Clearing the calc_showing queue\n"); + /* sort them from bottom to top, so we map the * bottom windows first, so that placement (e.g. cascading) * works properly @@ -1485,7 +1489,7 @@ meta_window_change_workspace (MetaWindow *window, /* See if we're already on this space */ if (g_list_find (window->workspaces, workspace) != NULL) { - meta_verbose ("Already on this workspace\n"); + meta_verbose ("%s already on this workspace\n", window->desc); return; } |