mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 09:00:42 -05:00
Partial audit to fix timestamp usage. One step towards fixing #355180; see
2006-09-18 Elijah Newren <newren gmail com> Partial audit to fix timestamp usage. One step towards fixing #355180; see important comments in that bug. * src/core.[ch] (meta_core_unshade, meta_core_shade): * src/delete.c (meta_window_present_delete_dialog, delete_ping_timeout_func): * src/display.[ch] (meta_display_open, meta_display_close, event_callback, meta_display_begin_grab_op, process_selection_clear, meta_display_unmanage_screen, meta_display_unmanage_windows_for_screen): * src/frames.c (meta_frames_button_press_event): * src/keybindings.c (handle_toggle_shade): * src/main.c (main): * src/screen.[ch] (update_num_workspaces, meta_screen_new, meta_screen_free, prefs_changed_callback): * src/window.[ch] (meta_window_free, finish_minimize, implement_showing, meta_window_show, meta_window_maximize, meta_window_make_fullscreen_internal, meta_window_unmake_fullscreen, meta_window_shade, meta_window_unshade, window_activate, send_sync_request, meta_window_client_message, menu_callback, meta_window_update_keyboard_resize): Remove usage of CurrentTime, meta_display_get_current_time() and meta_display_get_current_time_roundtrip() where possible, or document why it isn't possible, or at very least add a FIXME with some explanation of my laziness and what needs to be done.
This commit is contained in:
parent
87100b64d9
commit
5c587726ae
29
ChangeLog
29
ChangeLog
@ -1,3 +1,32 @@
|
||||
2006-09-18 Elijah Newren <newren gmail com>
|
||||
|
||||
Partial audit to fix timestamp usage. One step towards fixing
|
||||
#355180; see important comments in that bug.
|
||||
|
||||
* src/core.[ch] (meta_core_unshade, meta_core_shade):
|
||||
* src/delete.c (meta_window_present_delete_dialog,
|
||||
delete_ping_timeout_func):
|
||||
* src/display.[ch] (meta_display_open, meta_display_close,
|
||||
event_callback, meta_display_begin_grab_op,
|
||||
process_selection_clear, meta_display_unmanage_screen,
|
||||
meta_display_unmanage_windows_for_screen):
|
||||
* src/frames.c (meta_frames_button_press_event):
|
||||
* src/keybindings.c (handle_toggle_shade):
|
||||
* src/main.c (main):
|
||||
* src/screen.[ch] (update_num_workspaces, meta_screen_new,
|
||||
meta_screen_free, prefs_changed_callback):
|
||||
* src/window.[ch] (meta_window_free, finish_minimize,
|
||||
implement_showing, meta_window_show, meta_window_maximize,
|
||||
meta_window_make_fullscreen_internal,
|
||||
meta_window_unmake_fullscreen, meta_window_shade,
|
||||
meta_window_unshade, window_activate, send_sync_request,
|
||||
meta_window_client_message, menu_callback,
|
||||
meta_window_update_keyboard_resize):
|
||||
Remove usage of CurrentTime, meta_display_get_current_time() and
|
||||
meta_display_get_current_time_roundtrip() where possible, or
|
||||
document why it isn't possible, or at very least add a FIXME with
|
||||
some explanation of my laziness and what needs to be done.
|
||||
|
||||
2006-09-18 Elijah Newren <newren gmail com>
|
||||
|
||||
* src/spring-model.c (on_end_move, model_is_calm): Patch from Maik
|
||||
|
10
src/core.c
10
src/core.c
@ -339,20 +339,22 @@ meta_core_delete (Display *xdisplay,
|
||||
|
||||
void
|
||||
meta_core_unshade (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
Window frame_xwindow,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||
|
||||
meta_window_unshade (window);
|
||||
meta_window_unshade (window, timestamp);
|
||||
}
|
||||
|
||||
void
|
||||
meta_core_shade (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
Window frame_xwindow,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||
|
||||
meta_window_shade (window);
|
||||
meta_window_shade (window, timestamp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -95,9 +95,11 @@ void meta_core_delete (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
guint32 timestamp);
|
||||
void meta_core_unshade (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
Window frame_xwindow,
|
||||
guint32 timestamp);
|
||||
void meta_core_shade (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
Window frame_xwindow,
|
||||
guint32 timestamp);
|
||||
void meta_core_unstick (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
void meta_core_stick (Display *xdisplay,
|
||||
|
10
src/delete.c
10
src/delete.c
@ -34,7 +34,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void meta_window_present_delete_dialog (MetaWindow *window);
|
||||
static void meta_window_present_delete_dialog (MetaWindow *window,
|
||||
guint32 timestamp);
|
||||
|
||||
static void
|
||||
delete_ping_reply_func (MetaDisplay *display,
|
||||
@ -311,7 +312,7 @@ delete_ping_timeout_func (MetaDisplay *display,
|
||||
|
||||
if (window->dialog_pid >= 0)
|
||||
{
|
||||
meta_window_present_delete_dialog (window);
|
||||
meta_window_present_delete_dialog (window, timestamp);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -476,7 +477,7 @@ meta_window_free_delete_dialog (MetaWindow *window)
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_present_delete_dialog (MetaWindow *window)
|
||||
meta_window_present_delete_dialog (MetaWindow *window, guint32 timestamp)
|
||||
{
|
||||
meta_topic (META_DEBUG_PING,
|
||||
"Presenting existing ping dialog for %s\n",
|
||||
@ -501,8 +502,7 @@ meta_window_present_delete_dialog (MetaWindow *window)
|
||||
w->res_class &&
|
||||
g_strcasecmp (w->res_class, "metacity-dialog") == 0)
|
||||
{
|
||||
meta_window_activate (w,
|
||||
meta_display_get_current_time (w->display));
|
||||
meta_window_activate (w, timestamp);
|
||||
break;
|
||||
}
|
||||
|
||||
|
101
src/display.c
101
src/display.c
@ -707,7 +707,7 @@ meta_display_open (void)
|
||||
/* This would typically happen because all the screens already
|
||||
* have window managers.
|
||||
*/
|
||||
meta_display_close (display);
|
||||
meta_display_close (display, timestamp);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -842,7 +842,8 @@ meta_display_list_windows (MetaDisplay *display)
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_close (MetaDisplay *display)
|
||||
meta_display_close (MetaDisplay *display,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
@ -868,7 +869,7 @@ meta_display_close (MetaDisplay *display)
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaScreen *screen = tmp->data;
|
||||
meta_screen_free (screen);
|
||||
meta_screen_free (screen, timestamp);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
@ -2000,9 +2001,16 @@ event_callback (XEvent *event,
|
||||
case DestroyNotify:
|
||||
if (window)
|
||||
{
|
||||
/* FIXME: It sucks that DestroyNotify events don't come with
|
||||
* a timestamp; could we do something better here? Maybe X
|
||||
* will change one day?
|
||||
*/
|
||||
guint32 timestamp;
|
||||
timestamp = meta_display_get_current_time_roundtrip (display);
|
||||
|
||||
if (display->grab_op != META_GRAB_OP_NONE &&
|
||||
display->grab_window == window)
|
||||
meta_display_end_grab_op (display, CurrentTime);
|
||||
meta_display_end_grab_op (display, timestamp);
|
||||
|
||||
if (frame_was_receiver)
|
||||
{
|
||||
@ -2014,7 +2022,8 @@ event_callback (XEvent *event,
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_window_free (window); /* Unmanage destroyed window */
|
||||
/* Unmanage destroyed window */
|
||||
meta_window_free (window, timestamp);
|
||||
window = NULL;
|
||||
}
|
||||
}
|
||||
@ -2022,10 +2031,17 @@ event_callback (XEvent *event,
|
||||
case UnmapNotify:
|
||||
if (window)
|
||||
{
|
||||
/* FIXME: It sucks that UnmapNotify events don't come with
|
||||
* a timestamp; could we do something better here? Maybe X
|
||||
* will change one day?
|
||||
*/
|
||||
guint32 timestamp;
|
||||
timestamp = meta_display_get_current_time_roundtrip (display);
|
||||
|
||||
if (display->grab_op != META_GRAB_OP_NONE &&
|
||||
display->grab_window == window &&
|
||||
((window->frame == NULL) || !window->frame->mapped))
|
||||
meta_display_end_grab_op (display, CurrentTime);
|
||||
meta_display_end_grab_op (display, timestamp);
|
||||
|
||||
if (!frame_was_receiver)
|
||||
{
|
||||
@ -2035,10 +2051,11 @@ event_callback (XEvent *event,
|
||||
"Window %s withdrawn\n",
|
||||
window->desc);
|
||||
|
||||
meta_effect_run_close (window, NULL, NULL);
|
||||
|
||||
meta_effect_run_close (window, NULL, NULL);
|
||||
|
||||
/* Unmanage withdrawn window */
|
||||
window->withdrawn = TRUE;
|
||||
meta_window_free (window); /* Unmanage withdrawn window */
|
||||
meta_window_free (window, timestamp);
|
||||
window = NULL;
|
||||
}
|
||||
else
|
||||
@ -2206,7 +2223,12 @@ event_callback (XEvent *event,
|
||||
/* do this here instead of at end of function
|
||||
* so we can return
|
||||
*/
|
||||
|
||||
/* FIXME: Clearing display->current_time here makes no sense to
|
||||
* me; who put this here and why?
|
||||
*/
|
||||
display->current_time = CurrentTime;
|
||||
|
||||
process_selection_clear (display, event);
|
||||
/* Note that processing that may have resulted in
|
||||
* closing the display... so return right away.
|
||||
@ -2256,7 +2278,12 @@ event_callback (XEvent *event,
|
||||
|
||||
/* Handle clients using the older version of the spec... */
|
||||
if (time == 0 && workspace)
|
||||
time = meta_display_get_current_time_roundtrip (display);
|
||||
{
|
||||
meta_warning ("Received a NET_CURRENT_DESKTOP message "
|
||||
"from a broken (outdated) client who sent "
|
||||
"a 0 timestamp\n");
|
||||
time = meta_display_get_current_time_roundtrip (display);
|
||||
}
|
||||
|
||||
if (workspace)
|
||||
meta_workspace_activate (workspace, time);
|
||||
@ -2275,22 +2302,26 @@ event_callback (XEvent *event,
|
||||
|
||||
meta_prefs_set_num_workspaces (num_spaces);
|
||||
}
|
||||
else if (event->xclient.message_type ==
|
||||
display->atom_net_showing_desktop)
|
||||
{
|
||||
gboolean showing_desktop;
|
||||
else if (event->xclient.message_type ==
|
||||
display->atom_net_showing_desktop)
|
||||
{
|
||||
gboolean showing_desktop;
|
||||
guint32 timestamp;
|
||||
|
||||
showing_desktop = event->xclient.data.l[0] != 0;
|
||||
meta_verbose ("Request to %s desktop\n", showing_desktop ? "show" : "hide");
|
||||
showing_desktop = event->xclient.data.l[0] != 0;
|
||||
/* FIXME: Braindead protocol doesn't have a timestamp */
|
||||
timestamp = meta_display_get_current_time_roundtrip (display);
|
||||
meta_verbose ("Request to %s desktop\n",
|
||||
showing_desktop ? "show" : "hide");
|
||||
|
||||
if (showing_desktop)
|
||||
meta_screen_show_desktop (screen, meta_display_get_current_time_roundtrip (display));
|
||||
else
|
||||
{
|
||||
meta_screen_unshow_desktop (screen);
|
||||
meta_workspace_focus_default_window (screen->active_workspace, NULL, meta_display_get_current_time_roundtrip (display));
|
||||
}
|
||||
}
|
||||
if (showing_desktop)
|
||||
meta_screen_show_desktop (screen, timestamp);
|
||||
else
|
||||
{
|
||||
meta_screen_unshow_desktop (screen);
|
||||
meta_workspace_focus_default_window (screen->active_workspace, NULL, timestamp);
|
||||
}
|
||||
}
|
||||
else if (event->xclient.message_type ==
|
||||
display->atom_metacity_restart_message)
|
||||
{
|
||||
@ -3331,8 +3362,8 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"grabbing all keys failed, ungrabbing pointer\n");
|
||||
XUngrabPointer (display->xdisplay, CurrentTime);
|
||||
display->grab_have_pointer = FALSE;
|
||||
XUngrabPointer (display->xdisplay, timestamp);
|
||||
display->grab_have_pointer = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -4675,7 +4706,9 @@ process_selection_clear (MetaDisplay *display,
|
||||
meta_verbose ("Got selection clear for screen %d on display %s\n",
|
||||
screen->number, display->name);
|
||||
|
||||
meta_display_unmanage_screen (display, screen);
|
||||
meta_display_unmanage_screen (display,
|
||||
screen,
|
||||
event->xselectionclear.time);
|
||||
|
||||
/* display and screen may both be invalid memory... */
|
||||
|
||||
@ -4699,23 +4732,25 @@ process_selection_clear (MetaDisplay *display,
|
||||
|
||||
void
|
||||
meta_display_unmanage_screen (MetaDisplay *display,
|
||||
MetaScreen *screen)
|
||||
MetaScreen *screen,
|
||||
guint32 timestamp)
|
||||
{
|
||||
meta_verbose ("Unmanaging screen %d on display %s\n",
|
||||
screen->number, display->name);
|
||||
|
||||
g_return_if_fail (g_slist_find (display->screens, screen) != NULL);
|
||||
|
||||
meta_screen_free (screen);
|
||||
meta_screen_free (screen, timestamp);
|
||||
display->screens = g_slist_remove (display->screens, screen);
|
||||
|
||||
if (display->screens == NULL)
|
||||
meta_display_close (display);
|
||||
meta_display_close (display, timestamp);
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_unmanage_windows_for_screen (MetaDisplay *display,
|
||||
MetaScreen *screen)
|
||||
MetaScreen *screen,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GSList *tmp;
|
||||
GSList *winlist;
|
||||
@ -4725,8 +4760,8 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display,
|
||||
/* Unmanage all windows */
|
||||
tmp = winlist;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
meta_window_free (tmp->data);
|
||||
{
|
||||
meta_window_free (tmp->data, timestamp);
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
@ -388,7 +388,8 @@ struct _MetaDisplay
|
||||
)
|
||||
|
||||
gboolean meta_display_open (void);
|
||||
void meta_display_close (MetaDisplay *display);
|
||||
void meta_display_close (MetaDisplay *display,
|
||||
guint32 timestamp);
|
||||
MetaScreen* meta_display_screen_for_root (MetaDisplay *display,
|
||||
Window xroot);
|
||||
MetaScreen* meta_display_screen_for_x_screen (MetaDisplay *display,
|
||||
@ -399,10 +400,12 @@ void meta_display_grab (MetaDisplay *display);
|
||||
void meta_display_ungrab (MetaDisplay *display);
|
||||
|
||||
void meta_display_unmanage_screen (MetaDisplay *display,
|
||||
MetaScreen *screen);
|
||||
MetaScreen *screen,
|
||||
guint32 timestamp);
|
||||
|
||||
void meta_display_unmanage_windows_for_screen (MetaDisplay *display,
|
||||
MetaScreen *screen);
|
||||
MetaScreen *screen,
|
||||
guint32 timestamp);
|
||||
|
||||
/* A given MetaWindow may have various X windows that "belong"
|
||||
* to it, such as the frame window.
|
||||
|
@ -1254,10 +1254,12 @@ meta_frames_button_press_event (GtkWidget *widget,
|
||||
{
|
||||
if (flags & META_FRAME_SHADED)
|
||||
meta_core_unshade (gdk_display,
|
||||
frame->xwindow);
|
||||
frame->xwindow,
|
||||
event->time);
|
||||
else
|
||||
meta_core_shade (gdk_display,
|
||||
frame->xwindow);
|
||||
frame->xwindow,
|
||||
event->time);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -3300,9 +3300,9 @@ handle_toggle_shade (MetaDisplay *display,
|
||||
if (window)
|
||||
{
|
||||
if (window->shaded)
|
||||
meta_window_unshade (window);
|
||||
meta_window_unshade (window, event->xkey.time);
|
||||
else if (window->has_shade_func)
|
||||
meta_window_shade (window);
|
||||
meta_window_shade (window, event->xkey.time);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,9 @@ main (int argc, char **argv)
|
||||
tmp = displays;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
meta_display_close (tmp->data);
|
||||
guint32 timestamp;
|
||||
timestamp = CurrentTime; /* I doubt correct timestamps matter here */
|
||||
meta_display_close (tmp->data, timestamp);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
g_slist_free (displays);
|
||||
|
22
src/screen.c
22
src/screen.c
@ -52,7 +52,8 @@
|
||||
static char* get_screen_name (MetaDisplay *display,
|
||||
int number);
|
||||
|
||||
static void update_num_workspaces (MetaScreen *screen);
|
||||
static void update_num_workspaces (MetaScreen *screen,
|
||||
guint32 timestamp);
|
||||
static void update_focus_mode (MetaScreen *screen);
|
||||
static void set_workspace_names (MetaScreen *screen);
|
||||
static void prefs_changed_callback (MetaPreference pref,
|
||||
@ -608,7 +609,7 @@ meta_screen_new (MetaDisplay *display,
|
||||
* so create that required workspace.
|
||||
*/
|
||||
meta_workspace_activate (meta_workspace_new (screen), timestamp);
|
||||
update_num_workspaces (screen);
|
||||
update_num_workspaces (screen, timestamp);
|
||||
|
||||
set_workspace_names (screen);
|
||||
|
||||
@ -654,7 +655,8 @@ meta_screen_new (MetaDisplay *display,
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_free (MetaScreen *screen)
|
||||
meta_screen_free (MetaScreen *screen,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaDisplay *display;
|
||||
XGCValues gc_values = { 0 };
|
||||
@ -671,7 +673,7 @@ meta_screen_free (MetaScreen *screen)
|
||||
screen);
|
||||
}
|
||||
|
||||
meta_display_unmanage_windows_for_screen (display, screen);
|
||||
meta_display_unmanage_windows_for_screen (display, screen, timestamp);
|
||||
|
||||
meta_prefs_remove_listener (prefs_changed_callback, screen);
|
||||
|
||||
@ -855,7 +857,12 @@ prefs_changed_callback (MetaPreference pref,
|
||||
|
||||
if (pref == META_PREF_NUM_WORKSPACES)
|
||||
{
|
||||
update_num_workspaces (screen);
|
||||
/* GConf doesn't provide timestamps, but luckily update_num_workspaces
|
||||
* often doesn't need it...
|
||||
*/
|
||||
guint32 timestamp =
|
||||
meta_display_get_current_time_roundtrip (screen->display);
|
||||
update_num_workspaces (screen, timestamp);
|
||||
}
|
||||
else if (pref == META_PREF_FOCUS_MODE)
|
||||
{
|
||||
@ -1083,7 +1090,8 @@ set_desktop_viewport_hint (MetaScreen *screen)
|
||||
}
|
||||
|
||||
static void
|
||||
update_num_workspaces (MetaScreen *screen)
|
||||
update_num_workspaces (MetaScreen *screen,
|
||||
guint32 timestamp)
|
||||
{
|
||||
int new_num;
|
||||
GList *tmp;
|
||||
@ -1136,7 +1144,7 @@ update_num_workspaces (MetaScreen *screen)
|
||||
}
|
||||
|
||||
if (need_change_space)
|
||||
meta_workspace_activate (last_remaining, meta_display_get_current_time_roundtrip (screen->display));
|
||||
meta_workspace_activate (last_remaining, timestamp);
|
||||
|
||||
/* Should now be safe to free the workspaces */
|
||||
tmp = extras;
|
||||
|
@ -123,7 +123,8 @@ struct _MetaScreen
|
||||
MetaScreen* meta_screen_new (MetaDisplay *display,
|
||||
int number,
|
||||
guint32 timestamp);
|
||||
void meta_screen_free (MetaScreen *screen);
|
||||
void meta_screen_free (MetaScreen *screen,
|
||||
guint32 timestamp);
|
||||
void meta_screen_manage_all_windows (MetaScreen *screen);
|
||||
MetaScreen* meta_screen_for_x_screen (Screen *xscreen);
|
||||
void meta_screen_foreach_window (MetaScreen *screen,
|
||||
|
176
src/window.c
176
src/window.c
@ -910,7 +910,8 @@ meta_window_apply_session_info (MetaWindow *window,
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_free (MetaWindow *window)
|
||||
meta_window_free (MetaWindow *window,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
@ -963,7 +964,9 @@ meta_window_free (MetaWindow *window)
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Focusing default window since we're unmanaging %s\n",
|
||||
window->desc);
|
||||
meta_workspace_focus_default_window (window->screen->active_workspace, window, meta_display_get_current_time_roundtrip (window->display));
|
||||
meta_workspace_focus_default_window (window->screen->active_workspace,
|
||||
window,
|
||||
timestamp);
|
||||
}
|
||||
else if (window->display->expected_focus_window == window)
|
||||
{
|
||||
@ -971,7 +974,9 @@ meta_window_free (MetaWindow *window)
|
||||
"Focusing default window since expected focus window freed %s\n",
|
||||
window->desc);
|
||||
window->display->expected_focus_window = NULL;
|
||||
meta_workspace_focus_default_window (window->screen->active_workspace, window, meta_display_get_current_time_roundtrip (window->display));
|
||||
meta_workspace_focus_default_window (window->screen->active_workspace,
|
||||
window,
|
||||
timestamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -992,8 +997,7 @@ meta_window_free (MetaWindow *window)
|
||||
}
|
||||
|
||||
if (window->display->grab_window == window)
|
||||
meta_display_end_grab_op (window->display,
|
||||
meta_display_get_current_time (window->display));
|
||||
meta_display_end_grab_op (window->display, timestamp);
|
||||
|
||||
g_assert (window->display->grab_window != window);
|
||||
|
||||
@ -1338,14 +1342,20 @@ finish_minimize (const MetaEffect *effect,
|
||||
gpointer data)
|
||||
{
|
||||
MetaWindow *window = data;
|
||||
/* FIXME: It really sucks to put timestamp pinging here; it'd
|
||||
* probably make more sense in implement_showing() so that it's at
|
||||
* least not duplicated in meta_window_show; but since
|
||||
* finish_minimize is a callback making things just slightly icky, I
|
||||
* haven't done that yet.
|
||||
*/
|
||||
guint32 timestamp = meta_display_get_current_time_roundtrip (window->display);
|
||||
|
||||
meta_window_hide (window);
|
||||
if (window->has_focus)
|
||||
{
|
||||
meta_workspace_focus_default_window
|
||||
(window->screen->active_workspace,
|
||||
window,
|
||||
meta_display_get_current_time_roundtrip (window->display));
|
||||
meta_workspace_focus_default_window (window->screen->active_workspace,
|
||||
window,
|
||||
timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1373,11 +1383,11 @@ implement_showing (MetaWindow *window,
|
||||
if (on_workspace && window->minimized && window->mapped &&
|
||||
!meta_prefs_get_reduced_resources ())
|
||||
{
|
||||
MetaRectangle icon_rect, window_rect;
|
||||
gboolean result;
|
||||
|
||||
/* Check if the window has an icon geometry */
|
||||
result = meta_window_get_icon_geometry (window, &icon_rect);
|
||||
MetaRectangle icon_rect, window_rect;
|
||||
gboolean result;
|
||||
|
||||
/* Check if the window has an icon geometry */
|
||||
result = meta_window_get_icon_geometry (window, &icon_rect);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@ -1392,16 +1402,16 @@ implement_showing (MetaWindow *window,
|
||||
|
||||
meta_window_get_outer_rect (window, &window_rect);
|
||||
|
||||
meta_effect_run_minimize (window,
|
||||
&window_rect,
|
||||
&icon_rect,
|
||||
finish_minimize,
|
||||
window);
|
||||
}
|
||||
meta_effect_run_minimize (window,
|
||||
&window_rect,
|
||||
&icon_rect,
|
||||
finish_minimize,
|
||||
window);
|
||||
}
|
||||
else
|
||||
{
|
||||
finish_minimize (NULL, window);
|
||||
}
|
||||
{
|
||||
finish_minimize (NULL, window);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1852,6 +1862,13 @@ meta_window_show (MetaWindow *window)
|
||||
gboolean place_on_top_on_map;
|
||||
gboolean needs_stacking_adjustment;
|
||||
MetaWindow *focus_window;
|
||||
guint32 timestamp;
|
||||
|
||||
/* FIXME: It really sucks to put timestamp pinging here; it'd
|
||||
* probably make more sense in implement_showing() so that it's at
|
||||
* least not duplicated in finish_minimize. *shrug*
|
||||
*/
|
||||
timestamp = meta_display_get_current_time_roundtrip (window->display);
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_STATE,
|
||||
"Showing window %s, shaded: %d iconic: %d placed: %d\n",
|
||||
@ -1885,7 +1902,9 @@ meta_window_show (MetaWindow *window)
|
||||
"ancestor.\n",
|
||||
focus_window->desc, window->desc);
|
||||
|
||||
meta_display_focus_the_no_focus_window (window->display, window->screen, meta_display_get_current_time_roundtrip (window->display));
|
||||
meta_display_focus_the_no_focus_window (window->display,
|
||||
window->screen,
|
||||
timestamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2054,8 +2073,7 @@ meta_window_show (MetaWindow *window)
|
||||
window->showing_for_first_time = FALSE;
|
||||
if (takes_focus_on_map)
|
||||
{
|
||||
meta_window_focus (window,
|
||||
meta_display_get_current_time_roundtrip (window->display));
|
||||
meta_window_focus (window, timestamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2261,7 +2279,14 @@ meta_window_maximize (MetaWindow *window,
|
||||
(maximize_vertically && !window->maximized_vertically))
|
||||
{
|
||||
if (window->shaded && maximize_vertically)
|
||||
meta_window_unshade (window);
|
||||
{
|
||||
/* Shading sucks anyway; I'm not adding a timestamp argument
|
||||
* to this function just for this niche usage & corner case.
|
||||
*/
|
||||
guint32 timestamp =
|
||||
meta_display_get_current_time_roundtrip (window->display);
|
||||
meta_window_unshade (window, timestamp);
|
||||
}
|
||||
|
||||
/* if the window hasn't been placed yet, we'll maximize it then
|
||||
*/
|
||||
@ -2384,7 +2409,14 @@ meta_window_make_fullscreen_internal (MetaWindow *window)
|
||||
"Fullscreening %s\n", window->desc);
|
||||
|
||||
if (window->shaded)
|
||||
meta_window_unshade (window);
|
||||
{
|
||||
/* Shading sucks anyway; I'm not adding a timestamp argument
|
||||
* to this function just for this niche usage & corner case.
|
||||
*/
|
||||
guint32 timestamp =
|
||||
meta_display_get_current_time_roundtrip (window->display);
|
||||
meta_window_unshade (window, timestamp);
|
||||
}
|
||||
|
||||
meta_window_save_rect (window);
|
||||
|
||||
@ -2438,7 +2470,8 @@ meta_window_unmake_fullscreen (MetaWindow *window)
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_shade (MetaWindow *window)
|
||||
meta_window_shade (MetaWindow *window,
|
||||
guint32 timestamp)
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Shading %s\n", window->desc);
|
||||
@ -2479,15 +2512,15 @@ meta_window_shade (MetaWindow *window)
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Re-focusing window %s after shading it\n",
|
||||
window->desc);
|
||||
meta_window_focus (window,
|
||||
meta_display_get_current_time_roundtrip (window->display));
|
||||
meta_window_focus (window, timestamp);
|
||||
|
||||
set_net_wm_state (window);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_unshade (MetaWindow *window)
|
||||
meta_window_unshade (MetaWindow *window,
|
||||
guint32 timestamp)
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Unshading %s\n", window->desc);
|
||||
@ -2501,8 +2534,7 @@ meta_window_unshade (MetaWindow *window)
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Focusing window %s after unshading it\n",
|
||||
window->desc);
|
||||
meta_window_focus (window,
|
||||
meta_display_get_current_time_roundtrip (window->display));
|
||||
meta_window_focus (window, timestamp);
|
||||
|
||||
set_net_wm_state (window);
|
||||
}
|
||||
@ -2556,11 +2588,12 @@ window_activate (MetaWindow *window,
|
||||
}
|
||||
|
||||
/* For those stupid pagers, get a valid timestamp and show a warning */
|
||||
if (timestamp == 0) {
|
||||
meta_warning ("meta_window_activate called by a pager with a 0 timestamp; "
|
||||
"the pager needs to be fixed.\n");
|
||||
timestamp = meta_display_get_current_time_roundtrip (window->display);
|
||||
}
|
||||
if (timestamp == 0)
|
||||
{
|
||||
meta_warning ("meta_window_activate called by a pager with a 0 timestamp; "
|
||||
"the pager needs to be fixed.\n");
|
||||
timestamp = meta_display_get_current_time_roundtrip (window->display);
|
||||
}
|
||||
|
||||
meta_window_set_user_time (window, timestamp);
|
||||
|
||||
@ -2574,7 +2607,7 @@ window_activate (MetaWindow *window,
|
||||
meta_window_change_workspace (window, workspace);
|
||||
|
||||
if (window->shaded)
|
||||
meta_window_unshade (window);
|
||||
meta_window_unshade (window, timestamp);
|
||||
|
||||
unminimize_window_and_all_transient_parents (window);
|
||||
|
||||
@ -2772,6 +2805,11 @@ send_sync_request (MetaWindow *window)
|
||||
ev.message_type = window->display->atom_wm_protocols;
|
||||
ev.format = 32;
|
||||
ev.data.l[0] = window->display->atom_net_wm_sync_request;
|
||||
/* FIXME: meta_display_get_current_time() is bad, but since calls
|
||||
* come from meta_window_move_resize_internal (which in turn come
|
||||
* from all over), I'm not sure what we can do to fix it. Do we
|
||||
* want to use _roundtrip, though?
|
||||
*/
|
||||
ev.data.l[1] = meta_display_get_current_time (window->display);
|
||||
ev.data.l[2] = XSyncValueLow32 (value);
|
||||
ev.data.l[3] = XSyncValueHigh32 (value);
|
||||
@ -4426,7 +4464,13 @@ meta_window_client_message (MetaWindow *window,
|
||||
if (event->xclient.data.l[0] != 0)
|
||||
timestamp = event->xclient.data.l[0];
|
||||
else
|
||||
timestamp = meta_display_get_current_time (window->display);
|
||||
{
|
||||
meta_warning ("Receiving a NET_CLOSE_WINDOW message for %s without "
|
||||
"a timestamp! This means some buggy (outdated) "
|
||||
"application is on the loose!\n",
|
||||
window->desc);
|
||||
timestamp = meta_display_get_current_time (window->display);
|
||||
}
|
||||
|
||||
meta_window_delete (window, timestamp);
|
||||
|
||||
@ -4506,13 +4550,20 @@ meta_window_client_message (MetaWindow *window,
|
||||
second == display->atom_net_wm_state_shaded)
|
||||
{
|
||||
gboolean shade;
|
||||
guint32 timestamp;
|
||||
|
||||
/* Stupid protocol has no timestamp; of course, shading
|
||||
* sucks anyway so who really cares that we're forced to do
|
||||
* a roundtrip here?
|
||||
*/
|
||||
timestamp = meta_display_get_current_time_roundtrip (window->display);
|
||||
|
||||
shade = (action == _NET_WM_STATE_ADD ||
|
||||
(action == _NET_WM_STATE_TOGGLE && !window->shaded));
|
||||
if (shade && window->has_shade_func)
|
||||
meta_window_shade (window);
|
||||
meta_window_shade (window, timestamp);
|
||||
else
|
||||
meta_window_unshade (window);
|
||||
meta_window_unshade (window, timestamp);
|
||||
}
|
||||
|
||||
if (first == display->atom_net_wm_state_fullscreen ||
|
||||
@ -4658,12 +4709,18 @@ meta_window_client_message (MetaWindow *window,
|
||||
int action;
|
||||
MetaGrabOp op;
|
||||
int button;
|
||||
guint32 timestamp;
|
||||
|
||||
x_root = event->xclient.data.l[0];
|
||||
y_root = event->xclient.data.l[1];
|
||||
action = event->xclient.data.l[2];
|
||||
button = event->xclient.data.l[3];
|
||||
|
||||
/* FIXME: What a braindead protocol; no timestamp?!? */
|
||||
timestamp = meta_display_get_current_time_roundtrip (display);
|
||||
meta_warning ("Received a _NET_WM_MOVERESIZE message for %s; these "
|
||||
"messages lack timestamps and therefore suck.\n",
|
||||
window->desc);
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Received _NET_WM_MOVERESIZE message on %s, %d,%d action = %d, button %d\n",
|
||||
window->desc,
|
||||
@ -4713,10 +4770,7 @@ meta_window_client_message (MetaWindow *window,
|
||||
((window->has_move_func && op == META_GRAB_OP_KEYBOARD_MOVING) ||
|
||||
(window->has_resize_func && op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN)))
|
||||
{
|
||||
|
||||
meta_window_begin_grab_op (window,
|
||||
op,
|
||||
meta_display_get_current_time (window->display));
|
||||
meta_window_begin_grab_op (window, op, timestamp);
|
||||
}
|
||||
else if (op != META_GRAB_OP_NONE &&
|
||||
((window->has_move_func && op == META_GRAB_OP_MOVING) ||
|
||||
@ -4766,7 +4820,7 @@ meta_window_client_message (MetaWindow *window,
|
||||
op,
|
||||
FALSE, 0 /* event_serial */,
|
||||
button, 0,
|
||||
meta_display_get_current_time (window->display),
|
||||
timestamp,
|
||||
x_root,
|
||||
y_root);
|
||||
}
|
||||
@ -4790,8 +4844,13 @@ meta_window_client_message (MetaWindow *window,
|
||||
source_indication = META_CLIENT_TYPE_UNKNOWN;
|
||||
|
||||
if (timestamp == 0)
|
||||
/* Client using older EWMH _NET_ACTIVE_WINDOW without a timestamp */
|
||||
timestamp = meta_display_get_current_time (window->display);
|
||||
{
|
||||
/* Client using older EWMH _NET_ACTIVE_WINDOW without a timestamp */
|
||||
meta_warning ("Buggy client sent a _NET_ACTIVE_WINDOW message with a "
|
||||
"timestamp of 0 for %s\n",
|
||||
window->desc);
|
||||
timestamp = meta_display_get_current_time (display);
|
||||
}
|
||||
|
||||
window_activate (window, timestamp, source_indication, NULL);
|
||||
return TRUE;
|
||||
@ -6095,11 +6154,11 @@ menu_callback (MetaWindowMenu *menu,
|
||||
break;
|
||||
|
||||
case META_MENU_OP_UNSHADE:
|
||||
meta_window_unshade (window);
|
||||
meta_window_unshade (window, timestamp);
|
||||
break;
|
||||
|
||||
case META_MENU_OP_SHADE:
|
||||
meta_window_shade (window);
|
||||
meta_window_shade (window, timestamp);
|
||||
break;
|
||||
|
||||
case META_MENU_OP_MOVE_LEFT:
|
||||
@ -6146,13 +6205,13 @@ menu_callback (MetaWindowMenu *menu,
|
||||
case META_MENU_OP_MOVE:
|
||||
meta_window_begin_grab_op (window,
|
||||
META_GRAB_OP_KEYBOARD_MOVING,
|
||||
meta_display_get_current_time (window->display));
|
||||
timestamp);
|
||||
break;
|
||||
|
||||
case META_MENU_OP_RESIZE:
|
||||
meta_window_begin_grab_op (window,
|
||||
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
|
||||
meta_display_get_current_time (window->display));
|
||||
timestamp);
|
||||
break;
|
||||
|
||||
case META_MENU_OP_RECOVER:
|
||||
@ -6704,7 +6763,7 @@ static void
|
||||
update_resize (MetaWindow *window,
|
||||
gboolean snap,
|
||||
int x, int y,
|
||||
gboolean force)
|
||||
gboolean force)
|
||||
{
|
||||
int dx, dy;
|
||||
int new_w, new_h;
|
||||
@ -7047,7 +7106,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
||||
window->display->grab_last_user_action_was_snap,
|
||||
window->display->grab_latest_motion_x,
|
||||
window->display->grab_latest_motion_y,
|
||||
TRUE);
|
||||
TRUE);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -7597,12 +7656,15 @@ meta_window_update_keyboard_resize (MetaWindow *window,
|
||||
|
||||
if (update_cursor)
|
||||
{
|
||||
guint32 timestamp;
|
||||
/* FIXME: Using CurrentTime is really bad mojo */
|
||||
timestamp = CurrentTime;
|
||||
meta_display_set_grab_op_cursor (window->display,
|
||||
NULL,
|
||||
window->display->grab_op,
|
||||
TRUE,
|
||||
window->display->grab_xwindow,
|
||||
meta_display_get_current_time (window->display));
|
||||
timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,8 @@ MetaWindow* meta_window_new_with_attrs (MetaDisplay *display,
|
||||
Window xwindow,
|
||||
gboolean must_be_viewable,
|
||||
XWindowAttributes *attrs);
|
||||
void meta_window_free (MetaWindow *window);
|
||||
void meta_window_free (MetaWindow *window,
|
||||
guint32 timestamp);
|
||||
void meta_window_calc_showing (MetaWindow *window);
|
||||
void meta_window_queue_calc_showing (MetaWindow *window);
|
||||
void meta_window_minimize (MetaWindow *window);
|
||||
@ -395,8 +396,10 @@ void meta_window_unmaximize (MetaWindow *window,
|
||||
MetaMaximizeFlags directions);
|
||||
void meta_window_make_above (MetaWindow *window);
|
||||
void meta_window_unmake_above (MetaWindow *window);
|
||||
void meta_window_shade (MetaWindow *window);
|
||||
void meta_window_unshade (MetaWindow *window);
|
||||
void meta_window_shade (MetaWindow *window,
|
||||
guint32 timestamp);
|
||||
void meta_window_unshade (MetaWindow *window,
|
||||
guint32 timestamp);
|
||||
void meta_window_change_workspace (MetaWindow *window,
|
||||
MetaWorkspace *workspace);
|
||||
void meta_window_stick (MetaWindow *window);
|
||||
|
Loading…
Reference in New Issue
Block a user