This commit is contained in:
rhp 2001-07-04 02:10:54 +00:00
parent 3650c23055
commit ec00c9852d
7 changed files with 109 additions and 23 deletions

View File

@ -709,28 +709,42 @@ meta_frames_manage_window (MetaFrames *frames,
gdk_window_set_user_data (frame->window, frames); gdk_window_set_user_data (frame->window, frames);
#if 0 /* Don't set event mask here, it's in frame.c */
/* 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 /* Grab Alt + button1 and Alt + button2 for moving window,
* press in frame.c? * and Alt + button3 for popping up window menu.
*/ */
XGrabButton (gdk_display, AnyButton, AnyModifier, {
xwindow, False, int i = 1;
ButtonPressMask | ButtonReleaseMask | while (i < 4)
PointerMotionMask | PointerMotionHintMask, {
GrabModeAsync, GrabModeAsync, if (XGrabButton (gdk_display, i, Mod1Mask,
False, None); 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);
XFlush (gdk_display);
#endif #endif
++i;
}
}
frame->xwindow = xwindow; frame->xwindow = xwindow;
frame->layout = NULL; frame->layout = NULL;
@ -1362,14 +1376,12 @@ meta_frames_button_press_event (GtkWidget *widget,
break; break;
} }
g_assert (status != META_FRAME_STATUS_NORMAL);
meta_frames_begin_grab (frames, frame, meta_frames_begin_grab (frames, frame,
status, status,
event->button, event->button,
0, 0, 0, 0, 0, 0, /* not needed */ 0, 0, 0, 0, 0, 0, /* not needed */
event->time); event->time);
redraw_control (frames, frame, control); redraw_control (frames, frame, control);
if (status == META_FRAME_STATUS_CLICKING_MENU) if (status == META_FRAME_STATUS_CLICKING_MENU)
@ -1487,6 +1499,15 @@ meta_frames_button_press_event (GtkWidget *widget,
event->time); 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; return TRUE;
} }
@ -2411,3 +2432,13 @@ get_control (MetaFrames *frames,
return META_FRAME_CONTROL_NONE; 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;
}

View File

@ -157,4 +157,6 @@ void meta_frames_get_pixmap_for_control (MetaFrames *frames,
void meta_frames_notify_menu_hide (MetaFrames *frames); void meta_frames_notify_menu_hide (MetaFrames *frames);
Window meta_frames_get_moving_frame (MetaFrames *frames);
#endif #endif

View File

@ -286,7 +286,47 @@ handle_activate_workspace (MetaDisplay *display,
if (workspace) 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); 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 else
{ {

View File

@ -255,7 +255,7 @@ meta_window_place (MetaWindow *window,
/* Center on screen */ /* Center on screen */
int w, h; 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); w = WidthOfScreen (window->screen->xscreen);
h = HeightOfScreen (window->screen->xscreen); h = HeightOfScreen (window->screen->xscreen);

View File

@ -151,6 +151,12 @@ meta_ui_remove_frame (MetaUI *ui,
meta_frames_unmanage_window (ui->frames, xwindow); meta_frames_unmanage_window (ui->frames, xwindow);
} }
Window
meta_ui_get_moving_frame (MetaUI *ui)
{
return meta_frames_get_moving_frame (ui->frames);
}
void void
meta_ui_map_frame (MetaUI *ui, meta_ui_map_frame (MetaUI *ui,
Window xwindow) Window xwindow)

View File

@ -55,6 +55,9 @@ void meta_ui_add_frame (MetaUI *ui,
void meta_ui_remove_frame (MetaUI *ui, void meta_ui_remove_frame (MetaUI *ui,
Window xwindow); Window xwindow);
Window meta_ui_get_moving_frame (MetaUI *ui);
/* GDK insists on tracking map/unmap */ /* GDK insists on tracking map/unmap */
void meta_ui_map_frame (MetaUI *ui, void meta_ui_map_frame (MetaUI *ui,
Window xwindow); Window xwindow);

View File

@ -604,6 +604,8 @@ void
meta_window_calc_showing (MetaWindow *window) meta_window_calc_showing (MetaWindow *window)
{ {
gboolean on_workspace; gboolean on_workspace;
meta_verbose ("Calc showing for window %s\n", window->desc);
on_workspace = g_list_find (window->workspaces, on_workspace = g_list_find (window->workspaces,
window->screen->active_workspace) != NULL; window->screen->active_workspace) != NULL;
@ -655,6 +657,8 @@ idle_calc_showing (gpointer data)
{ {
GSList *tmp; GSList *tmp;
meta_verbose ("Clearing the calc_showing queue\n");
/* sort them from bottom to top, so we map the /* sort them from bottom to top, so we map the
* bottom windows first, so that placement (e.g. cascading) * bottom windows first, so that placement (e.g. cascading)
* works properly * works properly
@ -1485,7 +1489,7 @@ meta_window_change_workspace (MetaWindow *window,
/* See if we're already on this space */ /* See if we're already on this space */
if (g_list_find (window->workspaces, workspace) != NULL) 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; return;
} }