2001-05-30 11:36:31 -04:00
|
|
|
/* Metacity X display handler */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
* Copyright (C) 2002, 2003, 2004 Red Hat, Inc.
|
2004-02-22 20:48:29 -05:00
|
|
|
* Copyright (C) 2003, 2004 Rob Adams
|
2006-01-10 14:43:21 -05:00
|
|
|
* Copyright (C) 2004-2006 Elijah Newren
|
2001-05-30 11:36:31 -04:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
#include <config.h>
|
2001-05-30 11:36:31 -04:00
|
|
|
#include "display.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "screen.h"
|
|
|
|
#include "window.h"
|
2002-11-03 18:42:21 -05:00
|
|
|
#include "window-props.h"
|
2002-11-30 22:58:04 -05:00
|
|
|
#include "group-props.h"
|
2001-06-02 21:33:27 -04:00
|
|
|
#include "frame.h"
|
2001-06-04 00:58:22 -04:00
|
|
|
#include "errors.h"
|
2001-06-06 00:47:37 -04:00
|
|
|
#include "keybindings.h"
|
2001-12-09 19:38:21 -05:00
|
|
|
#include "prefs.h"
|
2002-03-17 12:22:23 -05:00
|
|
|
#include "resizepopup.h"
|
2004-01-10 12:16:07 -05:00
|
|
|
#include "xprops.h"
|
2001-06-06 00:47:37 -04:00
|
|
|
#include "workspace.h"
|
2003-01-28 10:07:43 -05:00
|
|
|
#include "bell.h"
|
2003-10-12 02:25:38 -04:00
|
|
|
#include "effects.h"
|
2003-11-20 21:32:05 -05:00
|
|
|
#include "compositor.h"
|
2001-06-09 23:17:15 -04:00
|
|
|
#include <X11/Xatom.h>
|
2001-07-25 23:14:45 -04:00
|
|
|
#include <X11/cursorfont.h>
|
2002-09-27 16:28:34 -04:00
|
|
|
#ifdef HAVE_SOLARIS_XINERAMA
|
|
|
|
#include <X11/extensions/xinerama.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_XFREE_XINERAMA
|
2002-06-07 12:18:51 -04:00
|
|
|
#include <X11/extensions/Xinerama.h>
|
|
|
|
#endif
|
2003-01-03 14:06:53 -05:00
|
|
|
#ifdef HAVE_RANDR
|
|
|
|
#include <X11/extensions/Xrandr.h>
|
|
|
|
#endif
|
2003-01-05 02:51:02 -05:00
|
|
|
#ifdef HAVE_SHAPE
|
|
|
|
#include <X11/extensions/shape.h>
|
|
|
|
#endif
|
2004-08-26 22:17:49 -04:00
|
|
|
#ifdef HAVE_RENDER
|
|
|
|
#include <X11/extensions/Xrender.h>
|
|
|
|
#endif
|
2003-01-28 10:07:43 -05:00
|
|
|
#ifdef HAVE_XKB
|
|
|
|
#include <X11/XKBlib.h>
|
|
|
|
#endif
|
2005-07-11 09:25:08 -04:00
|
|
|
#ifdef HAVE_XCURSOR
|
|
|
|
#include <X11/Xcursor/Xcursor.h>
|
|
|
|
#endif
|
2001-06-09 23:17:15 -04:00
|
|
|
#include <string.h>
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2005-01-24 00:58:30 -05:00
|
|
|
#define GRAB_OP_IS_WINDOW_SWITCH(g) \
|
|
|
|
(g == META_GRAB_OP_KEYBOARD_TABBING_NORMAL || \
|
|
|
|
g == META_GRAB_OP_KEYBOARD_TABBING_DOCK || \
|
2006-04-14 22:05:44 -04:00
|
|
|
g == META_GRAB_OP_KEYBOARD_TABBING_GROUP || \
|
2005-01-24 00:58:30 -05:00
|
|
|
g == META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL || \
|
2006-04-14 22:05:44 -04:00
|
|
|
g == META_GRAB_OP_KEYBOARD_ESCAPING_DOCK || \
|
|
|
|
g == META_GRAB_OP_KEYBOARD_ESCAPING_GROUP)
|
2005-01-24 00:58:30 -05:00
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
typedef struct
|
|
|
|
{
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
MetaDisplay *display;
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
Window xwindow;
|
|
|
|
guint32 timestamp;
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
MetaWindowPingFunc ping_reply_func;
|
|
|
|
MetaWindowPingFunc ping_timeout_func;
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
void *user_data;
|
|
|
|
guint ping_timeout_id;
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
} MetaPingData;
|
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
Window xwindow;
|
|
|
|
} MetaAutoRaiseData;
|
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
static GSList *all_displays = NULL;
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
static void meta_spew_event (MetaDisplay *display,
|
|
|
|
XEvent *event);
|
2003-06-25 23:09:38 -04:00
|
|
|
|
2001-06-19 23:01:26 -04:00
|
|
|
static gboolean event_callback (XEvent *event,
|
2001-06-02 21:33:27 -04:00
|
|
|
gpointer data);
|
|
|
|
static Window event_get_modified_window (MetaDisplay *display,
|
|
|
|
XEvent *event);
|
2002-01-03 18:28:19 -05:00
|
|
|
static guint32 event_get_time (MetaDisplay *display,
|
|
|
|
XEvent *event);
|
2004-01-10 12:16:07 -05:00
|
|
|
static void process_request_frame_extents (MetaDisplay *display,
|
|
|
|
XEvent *event);
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
static void process_pong_message (MetaDisplay *display,
|
|
|
|
XEvent *event);
|
2002-06-08 19:55:27 -04:00
|
|
|
static void process_selection_request (MetaDisplay *display,
|
|
|
|
XEvent *event);
|
|
|
|
static void process_selection_clear (MetaDisplay *display,
|
|
|
|
XEvent *event);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
static void update_window_grab_modifiers (MetaDisplay *display);
|
|
|
|
|
|
|
|
static void prefs_changed_callback (MetaPreference pref,
|
|
|
|
void *data);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
static void sanity_check_timestamps (MetaDisplay *display,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 known_good_timestamp);
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
|
2006-04-14 22:05:44 -04:00
|
|
|
MetaGroup* get_focussed_group (MetaDisplay *display);
|
|
|
|
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
static void
|
|
|
|
ping_data_free (MetaPingData *ping_data)
|
|
|
|
{
|
|
|
|
/* Remove the timeout */
|
|
|
|
if (ping_data->ping_timeout_id != 0)
|
|
|
|
g_source_remove (ping_data->ping_timeout_id);
|
|
|
|
|
|
|
|
g_free (ping_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
remove_pending_pings_for_window (MetaDisplay *display, Window xwindow)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
GSList *dead;
|
|
|
|
|
|
|
|
/* could obviously be more efficient, don't care */
|
|
|
|
|
|
|
|
/* build list to be removed */
|
|
|
|
dead = NULL;
|
|
|
|
for (tmp = display->pending_pings; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data = tmp->data;
|
|
|
|
|
|
|
|
if (ping_data->xwindow == xwindow)
|
|
|
|
dead = g_slist_prepend (dead, ping_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove what we found */
|
|
|
|
for (tmp = dead; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data = tmp->data;
|
|
|
|
|
|
|
|
display->pending_pings = g_slist_remove (display->pending_pings, ping_data);
|
|
|
|
ping_data_free (ping_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (dead);
|
|
|
|
}
|
|
|
|
|
2002-10-25 19:35:50 -04:00
|
|
|
|
2002-10-25 21:49:03 -04:00
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
2002-10-25 19:35:50 -04:00
|
|
|
static void
|
|
|
|
sn_error_trap_push (SnDisplay *sn_display,
|
|
|
|
Display *xdisplay)
|
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
display = meta_display_for_x_display (xdisplay);
|
|
|
|
if (display != NULL)
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
sn_error_trap_pop (SnDisplay *sn_display,
|
|
|
|
Display *xdisplay)
|
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
display = meta_display_for_x_display (xdisplay);
|
|
|
|
if (display != NULL)
|
|
|
|
meta_error_trap_pop (display, FALSE);
|
|
|
|
}
|
2002-10-25 21:49:03 -04:00
|
|
|
#endif
|
2002-10-25 19:35:50 -04:00
|
|
|
|
2006-02-16 15:26:05 -05:00
|
|
|
static void
|
|
|
|
enable_compositor (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
if (!display->compositor)
|
|
|
|
display->compositor = meta_compositor_new (display);
|
|
|
|
|
|
|
|
if (!display->compositor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (list = display->screens; list != NULL; list = list->next)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = list->data;
|
|
|
|
|
|
|
|
meta_compositor_manage_screen (screen->display->compositor,
|
|
|
|
screen);
|
|
|
|
|
|
|
|
meta_screen_composite_all_windows (screen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
disable_compositor (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
if (!display->compositor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (list = display->screens; list != NULL; list = list->next)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = list->data;
|
|
|
|
|
|
|
|
meta_compositor_unmanage_screen (screen->display->compositor,
|
|
|
|
screen);
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_compositor_destroy (display->compositor);
|
|
|
|
display->compositor = NULL;
|
|
|
|
}
|
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
gboolean
|
2006-05-04 13:32:26 -04:00
|
|
|
meta_display_open (void)
|
2001-05-30 11:36:31 -04:00
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
Display *xdisplay;
|
2001-05-30 23:30:58 -04:00
|
|
|
GSList *screens;
|
2001-05-31 02:42:58 -04:00
|
|
|
GSList *tmp;
|
2002-03-02 10:26:07 -05:00
|
|
|
int i;
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp;
|
2001-06-04 02:17:52 -04:00
|
|
|
/* Remember to edit code that assigns each atom to display struct
|
|
|
|
* when adding an atom name here.
|
|
|
|
*/
|
|
|
|
char *atom_names[] = {
|
|
|
|
"_NET_WM_NAME",
|
|
|
|
"WM_PROTOCOLS",
|
|
|
|
"WM_TAKE_FOCUS",
|
2001-06-06 00:47:37 -04:00
|
|
|
"WM_DELETE_WINDOW",
|
2001-06-07 01:18:10 -04:00
|
|
|
"WM_STATE",
|
2001-06-08 02:39:38 -04:00
|
|
|
"_NET_CLOSE_WINDOW",
|
|
|
|
"_NET_WM_STATE",
|
2001-06-21 02:08:35 -04:00
|
|
|
"_MOTIF_WM_HINTS",
|
2001-06-08 02:39:38 -04:00
|
|
|
"_NET_WM_STATE_SHADED",
|
|
|
|
"_NET_WM_STATE_MAXIMIZED_HORZ",
|
2001-06-09 01:14:43 -04:00
|
|
|
"_NET_WM_STATE_MAXIMIZED_VERT",
|
|
|
|
"_NET_WM_DESKTOP",
|
2001-06-09 17:58:30 -04:00
|
|
|
"_NET_NUMBER_OF_DESKTOPS",
|
|
|
|
"WM_CHANGE_STATE",
|
|
|
|
"SM_CLIENT_ID",
|
|
|
|
"WM_CLIENT_LEADER",
|
2001-06-09 23:17:15 -04:00
|
|
|
"WM_WINDOW_ROLE",
|
|
|
|
"_NET_CURRENT_DESKTOP",
|
|
|
|
"_NET_SUPPORTING_WM_CHECK",
|
2001-08-29 00:16:30 -04:00
|
|
|
"_NET_SUPPORTED",
|
2001-06-09 23:17:15 -04:00
|
|
|
"_NET_WM_WINDOW_TYPE",
|
|
|
|
"_NET_WM_WINDOW_TYPE_DESKTOP",
|
|
|
|
"_NET_WM_WINDOW_TYPE_DOCK",
|
|
|
|
"_NET_WM_WINDOW_TYPE_TOOLBAR",
|
|
|
|
"_NET_WM_WINDOW_TYPE_MENU",
|
|
|
|
"_NET_WM_WINDOW_TYPE_DIALOG",
|
|
|
|
"_NET_WM_WINDOW_TYPE_NORMAL",
|
2001-06-10 03:52:35 -04:00
|
|
|
"_NET_WM_STATE_MODAL",
|
|
|
|
"_NET_CLIENT_LIST",
|
2001-06-11 01:16:24 -04:00
|
|
|
"_NET_CLIENT_LIST_STACKING",
|
|
|
|
"_NET_WM_STATE_SKIP_TASKBAR",
|
2001-06-12 20:56:08 -04:00
|
|
|
"_NET_WM_STATE_SKIP_PAGER",
|
2001-06-23 23:18:10 -04:00
|
|
|
"_NET_WM_ICON_NAME",
|
2001-08-05 12:04:52 -04:00
|
|
|
"_NET_WM_ICON",
|
2001-08-07 01:52:51 -04:00
|
|
|
"_NET_WM_ICON_GEOMETRY",
|
2001-08-19 21:42:44 -04:00
|
|
|
"UTF8_STRING",
|
2001-08-22 02:01:01 -04:00
|
|
|
"WM_ICON_SIZE",
|
2001-08-29 00:16:30 -04:00
|
|
|
"_KWM_WIN_ICON",
|
2001-10-07 19:06:19 -04:00
|
|
|
"_NET_WM_MOVERESIZE",
|
2001-10-15 00:14:58 -04:00
|
|
|
"_NET_ACTIVE_WINDOW",
|
2002-02-06 22:07:56 -05:00
|
|
|
"_METACITY_RESTART_MESSAGE",
|
2002-01-10 01:31:31 -05:00
|
|
|
"_NET_WM_STRUT",
|
2002-02-08 01:01:58 -05:00
|
|
|
"_METACITY_RELOAD_THEME_MESSAGE",
|
2002-02-08 23:50:58 -05:00
|
|
|
"_METACITY_SET_KEYBINDINGS_MESSAGE",
|
2002-02-09 01:54:44 -05:00
|
|
|
"_NET_WM_STATE_HIDDEN",
|
|
|
|
"_NET_WM_WINDOW_TYPE_UTILITY",
|
2002-11-30 22:58:04 -05:00
|
|
|
"_NET_WM_WINDOW_TYPE_SPLASH",
|
2002-03-02 19:03:50 -05:00
|
|
|
"_NET_WM_STATE_FULLSCREEN",
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
"_NET_WM_PING",
|
|
|
|
"_NET_WM_PID",
|
2002-04-28 11:47:21 -04:00
|
|
|
"WM_CLIENT_MACHINE",
|
2002-06-24 21:12:37 -04:00
|
|
|
"_NET_WORKAREA",
|
2002-09-23 22:04:32 -04:00
|
|
|
"_NET_SHOWING_DESKTOP",
|
2002-06-08 19:55:27 -04:00
|
|
|
"_NET_DESKTOP_LAYOUT",
|
|
|
|
"MANAGER",
|
|
|
|
"TARGETS",
|
|
|
|
"MULTIPLE",
|
|
|
|
"TIMESTAMP",
|
|
|
|
"VERSION",
|
2002-07-06 12:50:48 -04:00
|
|
|
"ATOM_PAIR",
|
2002-08-01 19:52:47 -04:00
|
|
|
"_NET_DESKTOP_NAMES",
|
|
|
|
"_NET_WM_ALLOWED_ACTIONS",
|
|
|
|
"_NET_WM_ACTION_MOVE",
|
|
|
|
"_NET_WM_ACTION_RESIZE",
|
|
|
|
"_NET_WM_ACTION_SHADE",
|
|
|
|
"_NET_WM_ACTION_STICK",
|
|
|
|
"_NET_WM_ACTION_MAXIMIZE_HORZ",
|
|
|
|
"_NET_WM_ACTION_MAXIMIZE_VERT",
|
|
|
|
"_NET_WM_ACTION_CHANGE_DESKTOP",
|
|
|
|
"_NET_WM_ACTION_CLOSE",
|
2002-10-01 20:47:29 -04:00
|
|
|
"_NET_WM_STATE_ABOVE",
|
2002-11-30 22:58:04 -05:00
|
|
|
"_NET_WM_STATE_BELOW",
|
2002-12-08 14:17:17 -05:00
|
|
|
"_NET_STARTUP_ID",
|
2002-12-09 22:23:04 -05:00
|
|
|
"_METACITY_TOGGLE_VERBOSE",
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
"_NET_WM_SYNC_REQUEST",
|
|
|
|
"_NET_WM_SYNC_REQUEST_COUNTER",
|
2003-02-23 21:16:09 -05:00
|
|
|
"_GNOME_PANEL_ACTION",
|
|
|
|
"_GNOME_PANEL_ACTION_MAIN_MENU",
|
2003-05-30 16:24:00 -04:00
|
|
|
"_GNOME_PANEL_ACTION_RUN_DIALOG",
|
2003-06-25 23:09:38 -04:00
|
|
|
"_METACITY_SENTINEL",
|
2003-11-16 19:06:58 -05:00
|
|
|
"_NET_WM_STRUT_PARTIAL",
|
|
|
|
"_NET_WM_ACTION_FULLSCREEN",
|
2004-01-10 12:16:07 -05:00
|
|
|
"_NET_WM_ACTION_MINIMIZE",
|
|
|
|
"_NET_FRAME_EXTENTS",
|
|
|
|
"_NET_REQUEST_FRAME_EXTENTS",
|
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
|
|
|
"_NET_WM_USER_TIME",
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
"_NET_WM_STATE_DEMANDS_ATTENTION",
|
|
|
|
"_NET_RESTACK_WINDOW",
|
|
|
|
"_NET_MOVERESIZE_WINDOW",
|
|
|
|
"_NET_DESKTOP_GEOMETRY",
|
2005-02-06 23:37:35 -05:00
|
|
|
"_NET_DESKTOP_VIEWPORT",
|
2005-10-03 14:13:45 -04:00
|
|
|
"_METACITY_VERSION",
|
|
|
|
"_NET_WM_VISIBLE_NAME",
|
|
|
|
"_NET_WM_VISIBLE_ICON_NAME"
|
2001-06-04 02:17:52 -04:00
|
|
|
};
|
2001-06-02 00:14:18 -04:00
|
|
|
Atom atoms[G_N_ELEMENTS(atom_names)];
|
|
|
|
|
2006-05-04 13:32:26 -04:00
|
|
|
meta_verbose ("Opening display '%s'\n", XDisplayName (NULL));
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2006-05-04 13:32:26 -04:00
|
|
|
xdisplay = meta_ui_get_display ();
|
2001-06-19 23:01:26 -04:00
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
if (xdisplay == NULL)
|
|
|
|
{
|
|
|
|
meta_warning (_("Failed to open X Window System display '%s'\n"),
|
2006-05-04 13:32:26 -04:00
|
|
|
XDisplayName (NULL));
|
2001-05-30 11:36:31 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
if (meta_is_syncing ())
|
|
|
|
XSynchronize (xdisplay, True);
|
|
|
|
|
2001-05-30 23:30:58 -04:00
|
|
|
display = g_new (MetaDisplay, 1);
|
2001-06-02 21:33:27 -04:00
|
|
|
|
2002-06-22 01:11:04 -04:00
|
|
|
display->closing = 0;
|
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
/* here we use XDisplayName which is what the user
|
|
|
|
* probably put in, vs. DisplayString(display) which is
|
|
|
|
* canonicalized by XOpenDisplay()
|
|
|
|
*/
|
2006-05-04 13:32:26 -04:00
|
|
|
display->name = g_strdup (XDisplayName (NULL));
|
2001-05-30 11:36:31 -04:00
|
|
|
display->xdisplay = xdisplay;
|
2002-10-21 17:44:35 -04:00
|
|
|
display->error_trap_synced_at_last_pop = TRUE;
|
2002-02-24 14:58:27 -05:00
|
|
|
display->error_traps = 0;
|
|
|
|
display->error_trap_handler = NULL;
|
2001-06-09 01:14:43 -04:00
|
|
|
display->server_grab_count = 0;
|
2001-06-23 23:41:44 -04:00
|
|
|
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
display->pending_pings = NULL;
|
2002-05-23 22:23:46 -04:00
|
|
|
display->autoraise_timeout_id = 0;
|
2004-10-04 17:09:08 -04:00
|
|
|
display->autoraise_window = NULL;
|
2001-06-23 23:41:44 -04:00
|
|
|
display->focus_window = NULL;
|
2002-08-08 00:45:13 -04:00
|
|
|
display->expected_focus_window = NULL;
|
2005-02-20 12:23:20 -05:00
|
|
|
display->grab_old_window_stacking = NULL;
|
2001-10-14 23:39:41 -04:00
|
|
|
|
2005-02-21 21:11:25 -05:00
|
|
|
display->mouse_mode = TRUE; /* Only relevant for mouse or sloppy focus */
|
2006-01-15 12:03:57 -05:00
|
|
|
display->allow_terminal_deactivation = TRUE; /* Only relevant for when a
|
|
|
|
terminal has the focus */
|
2005-02-21 21:11:25 -05:00
|
|
|
|
2003-05-16 17:59:08 -04:00
|
|
|
#ifdef HAVE_XSYNC
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
display->grab_sync_request_alarm = None;
|
2003-05-16 17:59:08 -04:00
|
|
|
#endif
|
|
|
|
|
2002-01-19 18:59:11 -05:00
|
|
|
/* FIXME copy the checks from GDK probably */
|
|
|
|
display->static_gravity_works = g_getenv ("METACITY_USE_STATIC_GRAVITY") != NULL;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-05-30 23:30:58 -04:00
|
|
|
/* we have to go ahead and do this so error handlers work */
|
2001-05-30 11:36:31 -04:00
|
|
|
all_displays = g_slist_prepend (all_displays, display);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
meta_bell_init (display);
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_display_init_keys (display);
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
update_window_grab_modifiers (display);
|
|
|
|
|
|
|
|
meta_prefs_add_listener (prefs_changed_callback, display);
|
|
|
|
|
2001-06-09 01:14:43 -04:00
|
|
|
XInternAtoms (display->xdisplay, atom_names, G_N_ELEMENTS (atom_names),
|
|
|
|
False, atoms);
|
|
|
|
display->atom_net_wm_name = atoms[0];
|
|
|
|
display->atom_wm_protocols = atoms[1];
|
|
|
|
display->atom_wm_take_focus = atoms[2];
|
|
|
|
display->atom_wm_delete_window = atoms[3];
|
|
|
|
display->atom_wm_state = atoms[4];
|
|
|
|
display->atom_net_close_window = atoms[5];
|
|
|
|
display->atom_net_wm_state = atoms[6];
|
|
|
|
display->atom_motif_wm_hints = atoms[7];
|
|
|
|
display->atom_net_wm_state_shaded = atoms[8];
|
|
|
|
display->atom_net_wm_state_maximized_horz = atoms[9];
|
|
|
|
display->atom_net_wm_state_maximized_vert = atoms[10];
|
|
|
|
display->atom_net_wm_desktop = atoms[11];
|
|
|
|
display->atom_net_number_of_desktops = atoms[12];
|
2001-06-09 17:58:30 -04:00
|
|
|
display->atom_wm_change_state = atoms[13];
|
|
|
|
display->atom_sm_client_id = atoms[14];
|
|
|
|
display->atom_wm_client_leader = atoms[15];
|
|
|
|
display->atom_wm_window_role = atoms[16];
|
2001-06-09 23:17:15 -04:00
|
|
|
display->atom_net_current_desktop = atoms[17];
|
|
|
|
display->atom_net_supporting_wm_check = atoms[18];
|
2001-08-29 00:16:30 -04:00
|
|
|
display->atom_net_supported = atoms[19];
|
2001-06-09 23:17:15 -04:00
|
|
|
display->atom_net_wm_window_type = atoms[20];
|
|
|
|
display->atom_net_wm_window_type_desktop = atoms[21];
|
|
|
|
display->atom_net_wm_window_type_dock = atoms[22];
|
|
|
|
display->atom_net_wm_window_type_toolbar = atoms[23];
|
|
|
|
display->atom_net_wm_window_type_menu = atoms[24];
|
|
|
|
display->atom_net_wm_window_type_dialog = atoms[25];
|
|
|
|
display->atom_net_wm_window_type_normal = atoms[26];
|
|
|
|
display->atom_net_wm_state_modal = atoms[27];
|
2001-06-10 03:52:35 -04:00
|
|
|
display->atom_net_client_list = atoms[28];
|
|
|
|
display->atom_net_client_list_stacking = atoms[29];
|
2001-06-11 01:16:24 -04:00
|
|
|
display->atom_net_wm_state_skip_taskbar = atoms[30];
|
|
|
|
display->atom_net_wm_state_skip_pager = atoms[31];
|
2003-06-12 03:03:04 -04:00
|
|
|
display->atom_net_wm_icon_name = atoms[32];
|
|
|
|
display->atom_net_wm_icon = atoms[33];
|
|
|
|
display->atom_net_wm_icon_geometry = atoms[34];
|
|
|
|
display->atom_utf8_string = atoms[35];
|
|
|
|
display->atom_wm_icon_size = atoms[36];
|
|
|
|
display->atom_kwm_win_icon = atoms[37];
|
|
|
|
display->atom_net_wm_moveresize = atoms[38];
|
|
|
|
display->atom_net_active_window = atoms[39];
|
|
|
|
display->atom_metacity_restart_message = atoms[40];
|
|
|
|
display->atom_net_wm_strut = atoms[41];
|
|
|
|
display->atom_metacity_reload_theme_message = atoms[42];
|
|
|
|
display->atom_metacity_set_keybindings_message = atoms[43];
|
|
|
|
display->atom_net_wm_state_hidden = atoms[44];
|
|
|
|
display->atom_net_wm_window_type_utility = atoms[45];
|
|
|
|
display->atom_net_wm_window_type_splash = atoms[46];
|
|
|
|
display->atom_net_wm_state_fullscreen = atoms[47];
|
|
|
|
display->atom_net_wm_ping = atoms[48];
|
|
|
|
display->atom_net_wm_pid = atoms[49];
|
|
|
|
display->atom_wm_client_machine = atoms[50];
|
|
|
|
display->atom_net_workarea = atoms[51];
|
|
|
|
display->atom_net_showing_desktop = atoms[52];
|
|
|
|
display->atom_net_desktop_layout = atoms[53];
|
|
|
|
display->atom_manager = atoms[54];
|
|
|
|
display->atom_targets = atoms[55];
|
|
|
|
display->atom_multiple = atoms[56];
|
|
|
|
display->atom_timestamp = atoms[57];
|
|
|
|
display->atom_version = atoms[58];
|
|
|
|
display->atom_atom_pair = atoms[59];
|
|
|
|
display->atom_net_desktop_names = atoms[60];
|
|
|
|
display->atom_net_wm_allowed_actions = atoms[61];
|
|
|
|
display->atom_net_wm_action_move = atoms[62];
|
|
|
|
display->atom_net_wm_action_resize = atoms[63];
|
|
|
|
display->atom_net_wm_action_shade = atoms[64];
|
|
|
|
display->atom_net_wm_action_stick = atoms[65];
|
|
|
|
display->atom_net_wm_action_maximize_horz = atoms[66];
|
|
|
|
display->atom_net_wm_action_maximize_vert = atoms[67];
|
|
|
|
display->atom_net_wm_action_change_desktop = atoms[68];
|
|
|
|
display->atom_net_wm_action_close = atoms[69];
|
|
|
|
display->atom_net_wm_state_above = atoms[70];
|
|
|
|
display->atom_net_wm_state_below = atoms[71];
|
|
|
|
display->atom_net_startup_id = atoms[72];
|
|
|
|
display->atom_metacity_toggle_verbose = atoms[73];
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
display->atom_net_wm_sync_request = atoms[74];
|
|
|
|
display->atom_net_wm_sync_request_counter = atoms[75];
|
2003-06-12 03:03:04 -04:00
|
|
|
display->atom_gnome_panel_action = atoms[76];
|
|
|
|
display->atom_gnome_panel_action_main_menu = atoms[77];
|
|
|
|
display->atom_gnome_panel_action_run_dialog = atoms[78];
|
|
|
|
display->atom_metacity_sentinel = atoms[79];
|
2003-06-25 23:09:38 -04:00
|
|
|
display->atom_net_wm_strut_partial = atoms[80];
|
2003-11-16 19:06:58 -05:00
|
|
|
display->atom_net_wm_action_fullscreen = atoms[81];
|
|
|
|
display->atom_net_wm_action_minimize = atoms[82];
|
2004-01-10 12:16:07 -05:00
|
|
|
display->atom_net_frame_extents = atoms[83];
|
|
|
|
display->atom_net_request_frame_extents = atoms[84];
|
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
|
|
|
display->atom_net_wm_user_time = atoms[85];
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
display->atom_net_wm_state_demands_attention = atoms[86];
|
|
|
|
display->atom_net_restack_window = atoms[87];
|
|
|
|
display->atom_net_moveresize_window = atoms[88];
|
|
|
|
display->atom_net_desktop_geometry = atoms[89];
|
|
|
|
display->atom_net_desktop_viewport = atoms[90];
|
2005-02-06 23:37:35 -05:00
|
|
|
display->atom_metacity_version = atoms[91];
|
2005-10-03 14:13:45 -04:00
|
|
|
display->atom_net_wm_visible_name = atoms[92];
|
|
|
|
display->atom_net_wm_visible_icon_name = atoms[93];
|
2004-01-10 12:16:07 -05:00
|
|
|
|
2002-11-03 18:42:21 -05:00
|
|
|
display->prop_hooks = NULL;
|
|
|
|
meta_display_init_window_prop_hooks (display);
|
2002-11-30 22:58:04 -05:00
|
|
|
display->group_prop_hooks = NULL;
|
|
|
|
meta_display_init_group_prop_hooks (display);
|
2002-04-28 11:47:21 -04:00
|
|
|
|
2001-06-10 15:23:28 -04:00
|
|
|
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
|
|
|
|
* created in screen_new
|
|
|
|
*/
|
|
|
|
display->leader_window = None;
|
2002-06-06 23:18:46 -04:00
|
|
|
|
|
|
|
display->xinerama_cache_invalidated = TRUE;
|
2002-08-12 17:32:13 -04:00
|
|
|
|
|
|
|
display->groups_by_leader = NULL;
|
2002-05-08 12:24:28 -04:00
|
|
|
|
2002-10-28 00:35:30 -05:00
|
|
|
display->window_with_menu = NULL;
|
|
|
|
display->window_menu = NULL;
|
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
display->screens = NULL;
|
2006-01-30 12:22:14 -05:00
|
|
|
display->active_screen = NULL;
|
2002-10-28 00:35:30 -05:00
|
|
|
|
2002-10-25 19:35:50 -04:00
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
display->sn_display = sn_display_new (display->xdisplay,
|
|
|
|
sn_error_trap_push,
|
|
|
|
sn_error_trap_pop);
|
|
|
|
#endif
|
2001-05-30 23:30:58 -04:00
|
|
|
|
2001-06-19 23:01:26 -04:00
|
|
|
display->events = NULL;
|
|
|
|
|
|
|
|
/* Get events */
|
|
|
|
meta_ui_add_event_func (display->xdisplay,
|
|
|
|
event_callback,
|
|
|
|
display);
|
|
|
|
|
2002-08-12 17:32:13 -04:00
|
|
|
display->window_ids = g_hash_table_new (meta_unsigned_long_hash,
|
|
|
|
meta_unsigned_long_equal);
|
2001-06-08 02:39:38 -04:00
|
|
|
|
2002-03-02 10:26:07 -05:00
|
|
|
i = 0;
|
|
|
|
while (i < N_IGNORED_SERIALS)
|
|
|
|
{
|
|
|
|
display->ignored_serials[i] = 0;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
display->ungrab_should_not_cause_focus_window = None;
|
|
|
|
|
2002-01-03 18:28:19 -05:00
|
|
|
display->current_time = CurrentTime;
|
2003-05-30 16:24:00 -04:00
|
|
|
display->sentinel_counter = 0;
|
2004-09-22 14:57:36 -04:00
|
|
|
|
|
|
|
display->grab_resize_timeout_id = 0;
|
|
|
|
display->grab_have_keyboard = FALSE;
|
2001-08-30 00:01:38 -04:00
|
|
|
|
2006-09-10 00:29:14 -04:00
|
|
|
#ifdef HAVE_XKB
|
2006-01-20 17:08:52 -05:00
|
|
|
display->last_bell_time = 0;
|
2006-09-10 00:29:14 -04:00
|
|
|
#endif
|
2006-01-20 17:08:52 -05:00
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
display->grab_op = META_GRAB_OP_NONE;
|
2003-12-17 11:01:00 -05:00
|
|
|
display->grab_wireframe_active = FALSE;
|
2001-07-11 02:22:00 -04:00
|
|
|
display->grab_window = NULL;
|
2002-06-27 01:08:32 -04:00
|
|
|
display->grab_screen = NULL;
|
2002-03-17 12:22:23 -05:00
|
|
|
display->grab_resize_popup = NULL;
|
2002-10-07 19:14:40 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
display->grab_edge_resistance_data = NULL;
|
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
#ifdef HAVE_XSYNC
|
|
|
|
{
|
|
|
|
int major, minor;
|
2004-08-26 22:17:49 -04:00
|
|
|
|
|
|
|
display->have_xsync = FALSE;
|
2002-12-09 22:23:04 -05:00
|
|
|
|
|
|
|
display->xsync_error_base = 0;
|
|
|
|
display->xsync_event_base = 0;
|
|
|
|
|
|
|
|
/* I don't think we really have to fill these in */
|
|
|
|
major = SYNC_MAJOR_VERSION;
|
|
|
|
minor = SYNC_MINOR_VERSION;
|
|
|
|
|
|
|
|
if (!XSyncQueryExtension (display->xdisplay,
|
|
|
|
&display->xsync_event_base,
|
|
|
|
&display->xsync_error_base) ||
|
|
|
|
!XSyncInitialize (display->xdisplay,
|
|
|
|
&major, &minor))
|
|
|
|
{
|
|
|
|
display->xsync_error_base = 0;
|
|
|
|
display->xsync_event_base = 0;
|
|
|
|
}
|
2004-08-26 22:17:49 -04:00
|
|
|
else
|
|
|
|
display->have_xsync = TRUE;
|
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
meta_verbose ("Attempted to init Xsync, found version %d.%d error base %d event base %d\n",
|
|
|
|
major, minor,
|
|
|
|
display->xsync_error_base,
|
|
|
|
display->xsync_event_base);
|
|
|
|
}
|
|
|
|
#else /* HAVE_XSYNC */
|
|
|
|
meta_verbose ("Not compiled with Xsync support\n");
|
|
|
|
#endif /* !HAVE_XSYNC */
|
2003-01-05 02:51:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SHAPE
|
|
|
|
{
|
2004-08-26 22:17:49 -04:00
|
|
|
display->have_shape = FALSE;
|
|
|
|
|
2003-01-05 02:51:02 -05:00
|
|
|
display->shape_error_base = 0;
|
|
|
|
display->shape_event_base = 0;
|
|
|
|
|
|
|
|
if (!XShapeQueryExtension (display->xdisplay,
|
|
|
|
&display->shape_event_base,
|
|
|
|
&display->shape_error_base))
|
|
|
|
{
|
|
|
|
display->shape_error_base = 0;
|
|
|
|
display->shape_event_base = 0;
|
|
|
|
}
|
2004-08-26 22:17:49 -04:00
|
|
|
else
|
|
|
|
display->have_shape = TRUE;
|
|
|
|
|
2003-01-05 02:51:02 -05:00
|
|
|
meta_verbose ("Attempted to init Shape, found error base %d event base %d\n",
|
|
|
|
display->shape_error_base,
|
|
|
|
display->shape_event_base);
|
|
|
|
}
|
|
|
|
#else /* HAVE_SHAPE */
|
|
|
|
meta_verbose ("Not compiled with Shape support\n");
|
|
|
|
#endif /* !HAVE_SHAPE */
|
2003-11-20 21:32:05 -05:00
|
|
|
|
2004-08-26 22:17:49 -04:00
|
|
|
#ifdef HAVE_RENDER
|
|
|
|
{
|
|
|
|
display->have_render = FALSE;
|
|
|
|
|
|
|
|
display->render_error_base = 0;
|
|
|
|
display->render_event_base = 0;
|
|
|
|
|
|
|
|
if (!XRenderQueryExtension (display->xdisplay,
|
|
|
|
&display->render_event_base,
|
|
|
|
&display->render_error_base))
|
|
|
|
{
|
|
|
|
display->render_error_base = 0;
|
|
|
|
display->render_event_base = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
display->have_render = TRUE;
|
|
|
|
|
|
|
|
meta_verbose ("Attempted to init Render, found error base %d event base %d\n",
|
|
|
|
display->render_error_base,
|
|
|
|
display->render_event_base);
|
|
|
|
}
|
|
|
|
#else /* HAVE_RENDER */
|
|
|
|
meta_verbose ("Not compiled with Render support\n");
|
|
|
|
#endif /* !HAVE_RENDER */
|
2005-07-11 09:25:08 -04:00
|
|
|
|
|
|
|
#ifdef HAVE_XCURSOR
|
|
|
|
{
|
|
|
|
XcursorSetTheme (display->xdisplay, meta_prefs_get_cursor_theme ());
|
|
|
|
XcursorSetDefaultSize (display->xdisplay, meta_prefs_get_cursor_size ());
|
|
|
|
}
|
|
|
|
#else /* HAVE_XCURSOR */
|
|
|
|
meta_verbose ("Not compiled with Xcursor support\n");
|
|
|
|
#endif /* !HAVE_XCURSOR */
|
|
|
|
|
2003-11-24 12:47:48 -05:00
|
|
|
/* Create the leader window here. Set its properties and
|
|
|
|
* use the timestamp from one of the PropertyNotify events
|
|
|
|
* that will follow.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
gulong data[1];
|
|
|
|
XEvent event;
|
|
|
|
|
|
|
|
display->leader_window = meta_create_offscreen_window (display->xdisplay,
|
|
|
|
DefaultRootWindow (display->xdisplay));
|
|
|
|
|
2005-10-03 14:13:45 -04:00
|
|
|
meta_prop_set_utf8_string_hint (display,
|
|
|
|
display->leader_window,
|
|
|
|
display->atom_net_wm_name,
|
|
|
|
"Metacity");
|
2003-11-24 12:47:48 -05:00
|
|
|
|
2005-10-03 14:13:45 -04:00
|
|
|
meta_prop_set_utf8_string_hint (display,
|
|
|
|
display->leader_window,
|
|
|
|
display->atom_metacity_version,
|
|
|
|
VERSION);
|
2005-02-06 23:37:35 -05:00
|
|
|
|
2003-11-24 12:47:48 -05:00
|
|
|
data[0] = display->leader_window;
|
|
|
|
XChangeProperty (display->xdisplay,
|
|
|
|
display->leader_window,
|
|
|
|
display->atom_net_supporting_wm_check,
|
|
|
|
XA_WINDOW,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
|
|
|
|
|
|
|
XWindowEvent (display->xdisplay,
|
|
|
|
display->leader_window,
|
|
|
|
PropertyChangeMask,
|
|
|
|
&event);
|
|
|
|
|
|
|
|
timestamp = event.xproperty.time;
|
|
|
|
}
|
|
|
|
|
2004-12-23 01:44:56 -05:00
|
|
|
display->last_focus_time = timestamp;
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
display->last_user_time = timestamp;
|
2006-02-16 15:26:05 -05:00
|
|
|
display->compositor = NULL;
|
2002-12-09 22:23:04 -05:00
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
screens = NULL;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < ScreenCount (xdisplay))
|
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
2003-11-24 12:47:48 -05:00
|
|
|
screen = meta_screen_new (display, i, timestamp);
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
|
|
if (screen)
|
|
|
|
screens = g_slist_prepend (screens, screen);
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
display->screens = screens;
|
|
|
|
|
|
|
|
if (screens == NULL)
|
|
|
|
{
|
|
|
|
/* This would typically happen because all the screens already
|
|
|
|
* have window managers.
|
|
|
|
*/
|
|
|
|
meta_display_close (display);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-06-12 03:03:04 -04:00
|
|
|
|
2002-07-24 11:41:44 -04:00
|
|
|
meta_display_grab (display);
|
2002-10-07 19:14:40 -04:00
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
/* Now manage all existing windows */
|
|
|
|
tmp = display->screens;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
2006-01-13 14:41:01 -05:00
|
|
|
MetaScreen *screen = tmp->data;
|
|
|
|
|
|
|
|
meta_screen_manage_all_windows (screen);
|
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2002-07-24 11:41:44 -04:00
|
|
|
|
|
|
|
{
|
|
|
|
Window focus;
|
|
|
|
int ret_to;
|
|
|
|
|
|
|
|
/* kinda bogus because GetInputFocus has no possible errors */
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
|
2004-12-23 01:44:56 -05:00
|
|
|
/* FIXME: This is totally broken; see comment 9 of bug 88194 about this */
|
2002-07-24 11:41:44 -04:00
|
|
|
focus = None;
|
2002-11-22 01:00:18 -05:00
|
|
|
ret_to = RevertToPointerRoot;
|
2002-07-24 11:41:44 -04:00
|
|
|
XGetInputFocus (display->xdisplay, &focus, &ret_to);
|
|
|
|
|
|
|
|
/* Force a new FocusIn (does this work?) */
|
2003-09-26 22:40:09 -04:00
|
|
|
|
2003-11-24 12:47:48 -05:00
|
|
|
/* Use the same timestamp that was passed to meta_screen_new(),
|
|
|
|
* as it is the most recent timestamp.
|
|
|
|
*/
|
2004-12-23 01:44:56 -05:00
|
|
|
if (focus == None || focus == PointerRoot)
|
2005-12-28 01:24:30 -05:00
|
|
|
/* Just focus the no_focus_window on the first screen */
|
|
|
|
meta_display_focus_the_no_focus_window (display,
|
|
|
|
display->screens->data,
|
|
|
|
timestamp);
|
2004-12-23 01:44:56 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
MetaWindow * window;
|
|
|
|
window = meta_display_lookup_x_window (display, focus);
|
|
|
|
if (window)
|
|
|
|
meta_display_set_input_focus_window (display, window, FALSE, timestamp);
|
|
|
|
else
|
2005-12-28 01:24:30 -05:00
|
|
|
/* Just focus the no_focus_window on the first screen */
|
|
|
|
meta_display_focus_the_no_focus_window (display,
|
|
|
|
display->screens->data,
|
|
|
|
timestamp);
|
2004-12-23 01:44:56 -05:00
|
|
|
}
|
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, FALSE);
|
2002-07-24 11:41:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
meta_display_ungrab (display);
|
2006-02-16 15:26:05 -05:00
|
|
|
|
|
|
|
if (meta_prefs_get_compositing_manager ())
|
|
|
|
enable_compositor (display);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-06-03 14:33:59 -04:00
|
|
|
listify_func (gpointer key, gpointer value, gpointer data)
|
2001-05-30 11:36:31 -04:00
|
|
|
{
|
2001-06-03 14:33:59 -04:00
|
|
|
GSList **listp;
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2001-06-03 14:33:59 -04:00
|
|
|
listp = data;
|
|
|
|
*listp = g_slist_prepend (*listp, value);
|
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2001-06-03 14:33:59 -04:00
|
|
|
static gint
|
|
|
|
ptrcmp (gconstpointer a, gconstpointer b)
|
|
|
|
{
|
|
|
|
if (a < b)
|
|
|
|
return -1;
|
|
|
|
else if (a > b)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
2001-05-30 11:36:31 -04:00
|
|
|
}
|
|
|
|
|
2001-06-24 04:09:10 -04:00
|
|
|
GSList*
|
|
|
|
meta_display_list_windows (MetaDisplay *display)
|
2001-05-30 11:36:31 -04:00
|
|
|
{
|
2001-06-03 14:33:59 -04:00
|
|
|
GSList *winlist;
|
|
|
|
GSList *tmp;
|
2001-06-24 04:09:10 -04:00
|
|
|
GSList *prev;
|
2001-06-03 14:33:59 -04:00
|
|
|
|
|
|
|
winlist = NULL;
|
2001-05-30 11:36:31 -04:00
|
|
|
g_hash_table_foreach (display->window_ids,
|
2001-06-03 14:33:59 -04:00
|
|
|
listify_func,
|
|
|
|
&winlist);
|
|
|
|
|
2001-06-24 04:09:10 -04:00
|
|
|
/* Uniquify the list, since both frame windows and plain
|
|
|
|
* windows are in the hash
|
|
|
|
*/
|
2001-06-03 14:33:59 -04:00
|
|
|
winlist = g_slist_sort (winlist, ptrcmp);
|
|
|
|
|
2001-06-24 04:09:10 -04:00
|
|
|
prev = NULL;
|
|
|
|
tmp = winlist;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
GSList *next;
|
|
|
|
|
|
|
|
next = tmp->next;
|
|
|
|
|
|
|
|
if (next &&
|
|
|
|
next->data == tmp->data)
|
|
|
|
{
|
|
|
|
/* Delete tmp from list */
|
|
|
|
|
|
|
|
if (prev)
|
|
|
|
prev->next = next;
|
|
|
|
|
|
|
|
if (tmp == winlist)
|
|
|
|
winlist = next;
|
|
|
|
|
|
|
|
g_slist_free_1 (tmp);
|
|
|
|
|
|
|
|
/* leave prev unchanged */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prev = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return winlist;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_close (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
2006-01-13 14:41:01 -05:00
|
|
|
|
2002-02-24 14:58:27 -05:00
|
|
|
if (display->error_traps > 0)
|
2001-06-24 04:09:10 -04:00
|
|
|
meta_bug ("Display closed with error traps pending\n");
|
|
|
|
|
2002-06-22 01:11:04 -04:00
|
|
|
display->closing += 1;
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
|
|
meta_prefs_remove_listener (prefs_changed_callback, display);
|
2002-06-22 01:11:04 -04:00
|
|
|
|
2004-10-04 17:09:08 -04:00
|
|
|
meta_display_remove_autoraise_callback (display);
|
2005-01-24 00:58:30 -05:00
|
|
|
|
|
|
|
if (display->grab_old_window_stacking)
|
|
|
|
g_list_free (display->grab_old_window_stacking);
|
2002-10-25 19:35:50 -04:00
|
|
|
|
2001-06-19 23:01:26 -04:00
|
|
|
/* Stop caring about events */
|
|
|
|
meta_ui_remove_event_func (display->xdisplay,
|
|
|
|
event_callback,
|
|
|
|
display);
|
2002-10-25 19:35:50 -04:00
|
|
|
|
2002-01-04 17:18:10 -05:00
|
|
|
/* Free all screens */
|
|
|
|
tmp = display->screens;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = tmp->data;
|
|
|
|
meta_screen_free (screen);
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (display->screens);
|
|
|
|
display->screens = NULL;
|
2002-10-25 19:35:50 -04:00
|
|
|
|
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
if (display->sn_display)
|
|
|
|
{
|
|
|
|
sn_display_unref (display->sn_display);
|
|
|
|
display->sn_display = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2001-06-19 23:01:26 -04:00
|
|
|
|
2001-06-04 00:58:22 -04:00
|
|
|
/* Must be after all calls to meta_window_free() since they
|
|
|
|
* unregister windows
|
|
|
|
*/
|
|
|
|
g_hash_table_destroy (display->window_ids);
|
2001-06-09 17:58:30 -04:00
|
|
|
|
2001-06-10 15:23:28 -04:00
|
|
|
if (display->leader_window != None)
|
|
|
|
XDestroyWindow (display->xdisplay, display->leader_window);
|
2001-06-19 23:01:26 -04:00
|
|
|
|
2002-08-06 00:11:23 -04:00
|
|
|
XFlush (display->xdisplay);
|
2002-11-03 18:42:21 -05:00
|
|
|
|
|
|
|
meta_display_free_window_prop_hooks (display);
|
2002-11-30 22:58:04 -05:00
|
|
|
meta_display_free_group_prop_hooks (display);
|
2002-08-06 00:11:23 -04:00
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
g_free (display->name);
|
|
|
|
|
|
|
|
all_displays = g_slist_remove (all_displays, display);
|
2001-10-15 00:14:58 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
meta_display_shutdown_keys (display);
|
2003-11-20 21:32:05 -05:00
|
|
|
|
2006-05-26 12:51:03 -04:00
|
|
|
if (display->compositor)
|
|
|
|
meta_compositor_unref (display->compositor);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
g_free (display);
|
|
|
|
|
|
|
|
if (all_displays == NULL)
|
|
|
|
{
|
2001-05-30 23:30:58 -04:00
|
|
|
meta_verbose ("Last display closed, exiting\n");
|
2001-05-30 11:36:31 -04:00
|
|
|
meta_quit (META_EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaScreen*
|
|
|
|
meta_display_screen_for_root (MetaDisplay *display,
|
|
|
|
Window xroot)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
tmp = display->screens;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = tmp->data;
|
|
|
|
|
|
|
|
if (xroot == screen->xroot)
|
|
|
|
return screen;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-06-27 01:08:32 -04:00
|
|
|
MetaScreen*
|
|
|
|
meta_display_screen_for_xwindow (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
|
|
|
{
|
|
|
|
XWindowAttributes attr;
|
2002-10-21 17:44:35 -04:00
|
|
|
int result;
|
|
|
|
|
2002-07-23 15:12:02 -04:00
|
|
|
meta_error_trap_push (display);
|
2002-10-21 17:44:35 -04:00
|
|
|
attr.screen = NULL;
|
|
|
|
result = XGetWindowAttributes (display->xdisplay, xwindow, &attr);
|
|
|
|
meta_error_trap_pop (display, TRUE);
|
|
|
|
|
|
|
|
/* Note, XGetWindowAttributes is on all kinds of crack
|
|
|
|
* and returns 1 on success 0 on failure, rather than Success
|
|
|
|
* on success.
|
|
|
|
*/
|
|
|
|
if (result == 0 || attr.screen == NULL)
|
2002-07-23 15:12:02 -04:00
|
|
|
return NULL;
|
|
|
|
|
2002-06-27 01:08:32 -04:00
|
|
|
return meta_display_screen_for_x_screen (display, attr.screen);
|
|
|
|
}
|
|
|
|
|
2001-05-31 23:00:01 -04:00
|
|
|
MetaScreen*
|
|
|
|
meta_display_screen_for_x_screen (MetaDisplay *display,
|
|
|
|
Screen *xscreen)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
tmp = display->screens;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = tmp->data;
|
|
|
|
|
|
|
|
if (xscreen == screen->xscreen)
|
|
|
|
return screen;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
/* Grab/ungrab routines taken from fvwm */
|
|
|
|
void
|
|
|
|
meta_display_grab (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
if (display->server_grab_count == 0)
|
|
|
|
{
|
|
|
|
XGrabServer (display->xdisplay);
|
|
|
|
}
|
|
|
|
display->server_grab_count += 1;
|
2001-06-10 23:24:20 -04:00
|
|
|
meta_verbose ("Grabbing display, grab count now %d\n",
|
|
|
|
display->server_grab_count);
|
2001-05-31 02:42:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_ungrab (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
if (display->server_grab_count == 0)
|
|
|
|
meta_bug ("Ungrabbed non-grabbed server\n");
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
display->server_grab_count -= 1;
|
|
|
|
if (display->server_grab_count == 0)
|
|
|
|
{
|
2001-06-06 00:47:37 -04:00
|
|
|
/* FIXME we want to purge all pending "queued" stuff
|
|
|
|
* at this point, such as window hide/show
|
|
|
|
*/
|
2001-05-31 02:42:58 -04:00
|
|
|
XUngrabServer (display->xdisplay);
|
2002-11-03 19:56:12 -05:00
|
|
|
XFlush (display->xdisplay);
|
2001-05-31 02:42:58 -04:00
|
|
|
}
|
2001-06-10 23:24:20 -04:00
|
|
|
|
|
|
|
meta_verbose ("Ungrabbing display, grab count now %d\n",
|
|
|
|
display->server_grab_count);
|
2001-05-31 02:42:58 -04:00
|
|
|
}
|
|
|
|
|
2001-05-30 23:30:58 -04:00
|
|
|
MetaDisplay*
|
|
|
|
meta_display_for_x_display (Display *xdisplay)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
tmp = all_displays;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaDisplay *display = tmp->data;
|
|
|
|
|
|
|
|
if (display->xdisplay == xdisplay)
|
|
|
|
return display;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
2002-03-06 17:27:24 -05:00
|
|
|
meta_warning ("Could not find display for X display %p, probably going to crash\n",
|
|
|
|
xdisplay);
|
|
|
|
|
2001-05-30 23:30:58 -04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
GSList*
|
|
|
|
meta_displays_list (void)
|
|
|
|
{
|
|
|
|
return all_displays;
|
|
|
|
}
|
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
static gboolean dump_events = TRUE;
|
|
|
|
|
2006-08-21 14:38:21 -04:00
|
|
|
static gboolean
|
|
|
|
grab_op_is_mouse_only (MetaGrabOp op)
|
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_MOVING:
|
|
|
|
case META_GRAB_OP_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_RESIZING_S:
|
|
|
|
case META_GRAB_OP_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_RESIZING_N:
|
|
|
|
case META_GRAB_OP_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_RESIZING_NW:
|
|
|
|
case META_GRAB_OP_RESIZING_W:
|
|
|
|
case META_GRAB_OP_RESIZING_E:
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-25 23:14:45 -04:00
|
|
|
static gboolean
|
|
|
|
grab_op_is_mouse (MetaGrabOp op)
|
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_MOVING:
|
|
|
|
case META_GRAB_OP_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_RESIZING_S:
|
|
|
|
case META_GRAB_OP_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_RESIZING_N:
|
|
|
|
case META_GRAB_OP_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_RESIZING_NW:
|
|
|
|
case META_GRAB_OP_RESIZING_W:
|
|
|
|
case META_GRAB_OP_RESIZING_E:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
|
|
|
case META_GRAB_OP_KEYBOARD_MOVING:
|
2001-07-25 23:14:45 -04:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
grab_op_is_keyboard (MetaGrabOp op)
|
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_KEYBOARD_MOVING:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
2001-08-19 14:09:10 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
2002-04-05 10:52:49 -05:00
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_GROUP:
|
2002-07-06 12:50:48 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL:
|
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
|
2002-06-09 00:04:19 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
|
2001-07-25 23:14:45 -04:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
gboolean
|
|
|
|
meta_grab_op_is_resizing (MetaGrabOp op)
|
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_RESIZING_S:
|
|
|
|
case META_GRAB_OP_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_RESIZING_N:
|
|
|
|
case META_GRAB_OP_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_RESIZING_NW:
|
|
|
|
case META_GRAB_OP_RESIZING_W:
|
|
|
|
case META_GRAB_OP_RESIZING_E:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_grab_op_is_moving (MetaGrabOp op)
|
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_MOVING:
|
|
|
|
case META_GRAB_OP_KEYBOARD_MOVING:
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-03 18:28:19 -05:00
|
|
|
/* Get time of current event, or CurrentTime if none. */
|
|
|
|
guint32
|
|
|
|
meta_display_get_current_time (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return display->current_time;
|
|
|
|
}
|
|
|
|
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
/* Get a timestamp, even if it means a roundtrip */
|
|
|
|
guint32
|
|
|
|
meta_display_get_current_time_roundtrip (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
guint32 timestamp;
|
|
|
|
|
|
|
|
timestamp = meta_display_get_current_time (display);
|
|
|
|
if (timestamp == CurrentTime)
|
|
|
|
{
|
|
|
|
XEvent property_event;
|
|
|
|
|
|
|
|
/* Using the property XA_PRIMARY because it's safe; nothing
|
|
|
|
* would use it as a property. The type doesn't matter.
|
|
|
|
*/
|
|
|
|
XChangeProperty (display->xdisplay,
|
|
|
|
display->leader_window,
|
|
|
|
XA_PRIMARY, XA_STRING, 8,
|
|
|
|
PropModeAppend, NULL, 0);
|
|
|
|
XWindowEvent (display->xdisplay,
|
|
|
|
display->leader_window,
|
|
|
|
PropertyChangeMask,
|
|
|
|
&property_event);
|
|
|
|
|
|
|
|
timestamp = property_event.xproperty.time;
|
|
|
|
}
|
|
|
|
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
sanity_check_timestamps (display, timestamp);
|
|
|
|
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
return timestamp;
|
|
|
|
}
|
|
|
|
|
2002-03-02 10:26:07 -05:00
|
|
|
static void
|
|
|
|
add_ignored_serial (MetaDisplay *display,
|
|
|
|
unsigned long serial)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* don't add the same serial more than once */
|
|
|
|
if (display->ignored_serials[N_IGNORED_SERIALS-1] == serial)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* shift serials to the left */
|
|
|
|
i = 0;
|
|
|
|
while (i < (N_IGNORED_SERIALS - 1))
|
|
|
|
{
|
|
|
|
display->ignored_serials[i] = display->ignored_serials[i+1];
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
/* put new one on the end */
|
|
|
|
display->ignored_serials[i] = serial;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
serial_is_ignored (MetaDisplay *display,
|
|
|
|
unsigned long serial)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < N_IGNORED_SERIALS)
|
|
|
|
{
|
|
|
|
if (display->ignored_serials[i] == serial)
|
|
|
|
return TRUE;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reset_ignores (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < N_IGNORED_SERIALS)
|
|
|
|
{
|
|
|
|
display->ignored_serials[i] = 0;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
display->ungrab_should_not_cause_focus_window = None;
|
|
|
|
}
|
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
static gboolean
|
|
|
|
window_raise_with_delay_callback (void *data)
|
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
MetaAutoRaiseData *auto_raise;
|
|
|
|
|
|
|
|
auto_raise = data;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"In autoraise callback for window 0x%lx\n",
|
|
|
|
auto_raise->xwindow);
|
|
|
|
|
|
|
|
auto_raise->display->autoraise_timeout_id = 0;
|
2004-10-04 17:09:08 -04:00
|
|
|
auto_raise->display->autoraise_window = NULL;
|
2002-05-23 22:23:46 -04:00
|
|
|
|
|
|
|
window = meta_display_lookup_x_window (auto_raise->display,
|
|
|
|
auto_raise->xwindow);
|
|
|
|
|
|
|
|
if (window == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* If we aren't already on top, check whether the pointer is inside
|
|
|
|
* the window and raise the window if so.
|
|
|
|
*/
|
|
|
|
if (meta_stack_get_top (window->screen->stack) != window)
|
|
|
|
{
|
|
|
|
int x, y, root_x, root_y;
|
|
|
|
Window root, child;
|
|
|
|
unsigned int mask;
|
|
|
|
gboolean same_screen;
|
2006-01-20 17:03:56 -05:00
|
|
|
gboolean point_in_window;
|
2002-05-23 22:23:46 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (window->display);
|
|
|
|
same_screen = XQueryPointer (window->display->xdisplay,
|
|
|
|
window->xwindow,
|
|
|
|
&root, &child,
|
|
|
|
&root_x, &root_y, &x, &y, &mask);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (window->display, TRUE);
|
2002-05-23 22:23:46 -04:00
|
|
|
|
2006-01-20 17:03:56 -05:00
|
|
|
point_in_window =
|
|
|
|
(window->frame && POINT_IN_RECT (root_x, root_y, window->frame->rect)) ||
|
|
|
|
(window->frame == NULL && POINT_IN_RECT (root_x, root_y, window->rect));
|
|
|
|
if (same_screen && point_in_window)
|
2002-05-23 22:23:46 -04:00
|
|
|
meta_window_raise (window);
|
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Pointer not inside window, not raising %s\n",
|
|
|
|
window->desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-10-04 17:09:08 -04:00
|
|
|
void
|
|
|
|
meta_display_queue_autoraise_callback (MetaDisplay *display,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
MetaAutoRaiseData *auto_raise_data;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Queuing an autoraise timeout for %s with delay %d\n",
|
|
|
|
window->desc,
|
|
|
|
meta_prefs_get_auto_raise_delay ());
|
|
|
|
|
|
|
|
auto_raise_data = g_new (MetaAutoRaiseData, 1);
|
|
|
|
auto_raise_data->display = window->display;
|
|
|
|
auto_raise_data->xwindow = window->xwindow;
|
|
|
|
|
|
|
|
if (display->autoraise_timeout_id != 0)
|
|
|
|
g_source_remove (display->autoraise_timeout_id);
|
|
|
|
|
|
|
|
display->autoraise_timeout_id =
|
|
|
|
g_timeout_add_full (G_PRIORITY_DEFAULT,
|
|
|
|
meta_prefs_get_auto_raise_delay (),
|
|
|
|
window_raise_with_delay_callback,
|
|
|
|
auto_raise_data,
|
|
|
|
g_free);
|
|
|
|
display->autoraise_window = window;
|
|
|
|
}
|
|
|
|
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
#if 0
|
|
|
|
static void
|
|
|
|
handle_net_moveresize_window (MetaDisplay* display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
int x, y, width, height;
|
|
|
|
gboolean only_resize;
|
|
|
|
unsigned int gravity;
|
|
|
|
unsigned int mode;
|
|
|
|
|
|
|
|
window = meta_display_lookup_x_window (display,
|
|
|
|
event->xclient.window);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME: The specification seems to have serious endian issues
|
|
|
|
* here. Does bits 8-11 mean the high-order byte, or the low-order
|
|
|
|
* byte?
|
|
|
|
*/
|
|
|
|
gravity = (event->xclient.data.l[0] & ~0xff);
|
|
|
|
mode = (event->xclient.data.l[0] & ~0xff00) >> 8;
|
|
|
|
|
|
|
|
if (window)
|
|
|
|
{
|
2005-11-22 10:48:30 -05:00
|
|
|
/* FIXME!!!! This function is _wrong_ except for the resize-only
|
|
|
|
* case. Even then, it sucks to special case the code instead of
|
|
|
|
* factoring out common functionality with the configure reqest
|
|
|
|
* handling, especially since the EWMH says this message should be
|
|
|
|
* treated identically to a configure request with the exception of
|
|
|
|
* having a special gravity specified.
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
*/
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
meta_window_get_gravity_position (window, &x, &y);
|
|
|
|
width = window->rect.width;
|
|
|
|
height = window->rect.height;
|
|
|
|
|
|
|
|
if (mode & (CWX | CWY))
|
|
|
|
only_resize = FALSE;
|
|
|
|
else
|
|
|
|
only_resize = TRUE;
|
|
|
|
|
|
|
|
if (mode & CWX)
|
|
|
|
x = event->xclient.data.l[1];
|
|
|
|
if (mode & CWY)
|
|
|
|
y = event->xclient.data.l[2];
|
|
|
|
if (mode & CWWidth)
|
|
|
|
width = event->xclient.data.l[3];
|
|
|
|
if (mode & CWHeight)
|
|
|
|
height = event->xclient.data.l[4];
|
|
|
|
|
|
|
|
if (only_resize)
|
|
|
|
{
|
|
|
|
if (gravity)
|
|
|
|
meta_window_resize_with_gravity (window,
|
2005-11-22 10:48:30 -05:00
|
|
|
FALSE,
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
width,
|
|
|
|
height,
|
|
|
|
gravity);
|
|
|
|
else
|
|
|
|
meta_window_resize (window,
|
2005-11-22 10:48:30 -05:00
|
|
|
FALSE,
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
width,
|
|
|
|
height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_window_move_resize (window,
|
2005-11-22 10:48:30 -05:00
|
|
|
FALSE,
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
x,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_net_restack_window (MetaDisplay* display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
|
|
|
|
window = meta_display_lookup_x_window (display,
|
|
|
|
event->xclient.window);
|
|
|
|
|
|
|
|
if (window)
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
/* FIXME: The EWMH includes a sibling for the restack request, but we
|
|
|
|
* (stupidly) don't currently support these types of raises.
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
*
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
* Also, unconditionally following these is REALLY stupid--we should
|
|
|
|
* combine this code with the stuff in
|
|
|
|
* meta_window_configure_request() which is smart about whether to
|
|
|
|
* follow the request or do something else (though not smart enough
|
|
|
|
* and is also too stupid to handle the sibling stuff).
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
*/
|
|
|
|
switch (event->xclient.data.l[2])
|
|
|
|
{
|
|
|
|
case Above:
|
|
|
|
meta_window_raise (window);
|
|
|
|
break;
|
|
|
|
case Below:
|
|
|
|
meta_window_lower (window);
|
|
|
|
break;
|
|
|
|
case TopIf:
|
|
|
|
case BottomIf:
|
|
|
|
case Opposite:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-06-19 23:01:26 -04:00
|
|
|
static gboolean
|
|
|
|
event_callback (XEvent *event,
|
|
|
|
gpointer data)
|
2001-05-30 11:36:31 -04:00
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
MetaDisplay *display;
|
2001-06-02 21:33:27 -04:00
|
|
|
Window modified;
|
2001-07-11 02:22:00 -04:00
|
|
|
gboolean frame_was_receiver;
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
gboolean filter_out_event;
|
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
display = data;
|
|
|
|
|
|
|
|
if (dump_events)
|
|
|
|
meta_spew_event (display, event);
|
2002-10-25 19:35:50 -04:00
|
|
|
|
|
|
|
#ifdef HAVE_STARTUP_NOTIFICATION
|
|
|
|
sn_display_process_event (display->sn_display, event);
|
|
|
|
#endif
|
2002-06-06 23:18:46 -04:00
|
|
|
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
filter_out_event = FALSE;
|
2002-01-03 18:28:19 -05:00
|
|
|
display->current_time = event_get_time (display, event);
|
2002-06-06 23:18:46 -04:00
|
|
|
display->xinerama_cache_invalidated = TRUE;
|
|
|
|
|
2002-03-02 10:26:07 -05:00
|
|
|
modified = event_get_modified_window (display, event);
|
2001-06-19 23:01:26 -04:00
|
|
|
|
2001-06-07 22:17:48 -04:00
|
|
|
if (event->type == ButtonPress)
|
|
|
|
{
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
/* filter out scrollwheel */
|
|
|
|
if (event->xbutton.button == 4 ||
|
|
|
|
event->xbutton.button == 5)
|
|
|
|
return FALSE;
|
2001-06-07 22:17:48 -04:00
|
|
|
}
|
2001-08-30 00:01:38 -04:00
|
|
|
else if (event->type == UnmapNotify)
|
|
|
|
{
|
|
|
|
if (meta_ui_window_should_not_cause_focus (display->xdisplay,
|
2002-03-02 10:26:07 -05:00
|
|
|
modified))
|
2001-08-30 00:01:38 -04:00
|
|
|
{
|
2002-03-02 10:26:07 -05:00
|
|
|
add_ignored_serial (display, event->xany.serial);
|
2002-02-07 22:34:26 -05:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
2002-03-02 10:26:07 -05:00
|
|
|
"Adding EnterNotify serial %lu to ignored focus serials\n",
|
|
|
|
event->xany.serial);
|
2001-08-30 00:01:38 -04:00
|
|
|
}
|
|
|
|
}
|
2002-03-02 10:26:07 -05:00
|
|
|
else if (event->type == LeaveNotify &&
|
|
|
|
event->xcrossing.mode == NotifyUngrab &&
|
|
|
|
modified == display->ungrab_should_not_cause_focus_window)
|
|
|
|
{
|
|
|
|
add_ignored_serial (display, event->xany.serial);
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Adding LeaveNotify serial %lu to ignored focus serials\n",
|
|
|
|
event->xany.serial);
|
|
|
|
}
|
2001-06-02 21:33:27 -04:00
|
|
|
|
|
|
|
if (modified != None)
|
|
|
|
window = meta_display_lookup_x_window (display, modified);
|
|
|
|
else
|
|
|
|
window = NULL;
|
2001-07-11 02:22:00 -04:00
|
|
|
|
|
|
|
frame_was_receiver = FALSE;
|
2001-06-02 21:33:27 -04:00
|
|
|
if (window &&
|
|
|
|
window->frame &&
|
|
|
|
modified == window->frame->xwindow)
|
2002-08-04 16:02:45 -04:00
|
|
|
{
|
2002-08-04 16:20:53 -04:00
|
|
|
/* Note that if the frame and the client both have an
|
|
|
|
* XGrabButton (as is normal with our setup), the event
|
|
|
|
* goes to the frame.
|
|
|
|
*/
|
2002-08-04 16:02:45 -04:00
|
|
|
frame_was_receiver = TRUE;
|
2003-10-12 02:25:38 -04:00
|
|
|
meta_topic (META_DEBUG_EVENTS, "Frame was receiver of event for %s\n",
|
|
|
|
window->desc);
|
2002-08-04 16:02:45 -04:00
|
|
|
}
|
2002-12-09 22:23:04 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_XSYNC
|
|
|
|
if (META_DISPLAY_HAS_XSYNC (display) &&
|
|
|
|
event->type == (display->xsync_event_base + XSyncAlarmNotify) &&
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
((XSyncAlarmNotifyEvent*)event)->alarm == display->grab_sync_request_alarm)
|
2002-12-09 22:23:04 -05:00
|
|
|
{
|
|
|
|
filter_out_event = TRUE; /* GTK doesn't want to see this really */
|
|
|
|
|
|
|
|
if (display->grab_op != META_GRAB_OP_NONE &&
|
|
|
|
display->grab_window != NULL &&
|
2004-04-15 23:38:19 -04:00
|
|
|
event->xany.serial >= display->grab_start_serial &&
|
2002-12-09 22:23:04 -05:00
|
|
|
grab_op_is_mouse (display->grab_op))
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
meta_window_handle_mouse_grab_op_event (display->grab_window, event);
|
2002-12-09 22:23:04 -05:00
|
|
|
}
|
|
|
|
#endif /* HAVE_XSYNC */
|
2003-01-05 02:51:02 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_SHAPE
|
|
|
|
if (META_DISPLAY_HAS_SHAPE (display) &&
|
|
|
|
event->type == (display->shape_event_base + ShapeNotify))
|
|
|
|
{
|
|
|
|
filter_out_event = TRUE; /* GTK doesn't want to see this really */
|
|
|
|
|
|
|
|
if (window && !frame_was_receiver)
|
|
|
|
{
|
|
|
|
XShapeEvent *sev = (XShapeEvent*) event;
|
|
|
|
|
|
|
|
if (sev->kind == ShapeBounding)
|
|
|
|
{
|
|
|
|
if (sev->shaped && !window->has_shape)
|
|
|
|
{
|
|
|
|
window->has_shape = TRUE;
|
|
|
|
meta_topic (META_DEBUG_SHAPES,
|
|
|
|
"Window %s now has a shape\n",
|
|
|
|
window->desc);
|
|
|
|
}
|
|
|
|
else if (!sev->shaped && window->has_shape)
|
|
|
|
{
|
|
|
|
window->has_shape = FALSE;
|
|
|
|
meta_topic (META_DEBUG_SHAPES,
|
|
|
|
"Window %s no longer has a shape\n",
|
|
|
|
window->desc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_SHAPES,
|
|
|
|
"Window %s shape changed\n",
|
|
|
|
window->desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->frame)
|
|
|
|
{
|
|
|
|
window->frame->need_reapply_frame_shape = TRUE;
|
2003-06-25 23:09:38 -04:00
|
|
|
meta_warning("from event callback\n");
|
2003-01-05 02:51:02 -05:00
|
|
|
meta_window_queue_move_resize (window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_SHAPES,
|
|
|
|
"ShapeNotify not on a client window (window %s frame_was_receiver = %d)\n",
|
|
|
|
window ? window->desc : "(none)",
|
|
|
|
frame_was_receiver);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_SHAPE */
|
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
|
|
|
|
|
|
|
if (window && ((event->type == KeyPress) || (event->type == ButtonPress)))
|
|
|
|
{
|
2006-02-03 13:09:16 -05:00
|
|
|
if (CurrentTime == display->current_time)
|
|
|
|
{
|
|
|
|
/* We can't use missing (i.e. invalid) timestamps to set user time,
|
|
|
|
* nor do we want to use them to sanity check other timestamps.
|
|
|
|
* See bug 313490 for more details.
|
|
|
|
*/
|
|
|
|
meta_warning ("Event has no timestamp! You may be using a broken "
|
|
|
|
"program such as xse. Please ask the authors of that "
|
|
|
|
"program to fix it.\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_window_set_user_time (window, display->current_time);
|
|
|
|
sanity_check_timestamps (display, display->current_time);
|
|
|
|
}
|
Add support for _NET_WM_USER_TIME
2004-06-17 Elijah Newren <newren@math.utah.edu>
Add support for _NET_WM_USER_TIME
* src/display.c:
(meta_display_open): Add _NET_WM_USER_TIME to atom_names[],
(event_callback): Manually set _NET_WM_USER_TIME upon KeyPress
(doesn't work since keyboard isn't grabbed) and ButtonPress (does
work), this is just a fallback for applications that don't update
this themselves.
* src/display.h: (struct _MetaDisplay): Add atom_net_wm_user_time field
* src/screen.c: (meta_screen_apply_startup_properties): Check for
TIMESTAMP provided from startup sequence as well.
* src/stack.c:
s/meta_window_set_stack_position/meta_window_set_stack_position_no_sync/,
(meta_window_set_stack_position): New function which calls the
meta_window_set_stack_position_no_sync function followed immediately
by calling meta_stack_sync_to_server.
* src/window-props.c:
(init_net_wm_user_time), (reload_net_wm_user_time): new functions,
(reload_wm_hints): also load atom_net_wm_user_time
* src/window.c:
new XSERVER_TIME_IS_LATER macro (accounts for timestamp wraparound),
(meta_window_new_with_attrs): add timestamp attributes,
(window_takes_focus_on_map): use TIMESTAMP from startup
notification and _NET_WM_USER_TIME to decide whether to focus new
windows,
(meta_window_show): if app doesn't take focus on map, place it
just below the focused window in the stack
(process_property_notify): check for changes to _NET_WM_USRE_TIME,
(meta_window_stack_just_below): new function
* src/window.h:
(_MetaWindow struct): new fields for initial_timestamp,
initial_timestamp_set, net_wm_user_time_set, and net_wm_user_time,
(meta_window_stack_just_below): new function
2004-06-24 11:47:05 -04:00
|
|
|
}
|
2003-12-13 18:00:06 -05:00
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case KeyPress:
|
|
|
|
case KeyRelease:
|
2001-07-25 23:58:24 -04:00
|
|
|
meta_display_process_key_event (display, window, event);
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case ButtonPress:
|
2002-08-03 19:07:04 -04:00
|
|
|
if ((window &&
|
|
|
|
grab_op_is_mouse (display->grab_op) &&
|
2003-10-12 02:25:38 -04:00
|
|
|
display->grab_button != (int) event->xbutton.button &&
|
2004-04-15 23:38:19 -04:00
|
|
|
event->xany.serial >= display->grab_start_serial &&
|
2001-07-25 23:14:45 -04:00
|
|
|
display->grab_window == window) ||
|
|
|
|
grab_op_is_keyboard (display->grab_op))
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
2003-01-21 17:40:25 -05:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
2006-01-20 17:03:56 -05:00
|
|
|
"Ending grab op %u on window %s due to button press\n",
|
2003-01-21 17:40:25 -05:00
|
|
|
display->grab_op,
|
|
|
|
(display->grab_window ?
|
|
|
|
display->grab_window->desc :
|
|
|
|
"none"));
|
2005-01-24 00:58:30 -05:00
|
|
|
if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op))
|
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
|
|
|
"Syncing to old stack positions.\n");
|
|
|
|
screen =
|
|
|
|
meta_display_screen_for_root (display, event->xany.window);
|
|
|
|
meta_stack_set_positions (screen->stack,
|
|
|
|
display->grab_old_window_stacking);
|
|
|
|
}
|
2001-07-11 02:22:00 -04:00
|
|
|
meta_display_end_grab_op (display,
|
|
|
|
event->xbutton.time);
|
2001-08-19 14:09:10 -04:00
|
|
|
}
|
2001-07-25 23:58:24 -04:00
|
|
|
else if (window && display->grab_op == META_GRAB_OP_NONE)
|
2001-07-25 23:14:45 -04:00
|
|
|
{
|
2001-07-25 23:58:24 -04:00
|
|
|
gboolean begin_move = FALSE;
|
2002-10-07 19:14:40 -04:00
|
|
|
unsigned int grab_mask;
|
2002-02-08 01:50:09 -05:00
|
|
|
gboolean unmodified;
|
2001-10-14 00:11:42 -04:00
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
grab_mask = display->window_grab_modifiers;
|
2001-10-14 00:11:42 -04:00
|
|
|
if (g_getenv ("METACITY_DEBUG_BUTTON_GRABS"))
|
|
|
|
grab_mask |= ControlMask;
|
2002-02-08 01:50:09 -05:00
|
|
|
|
|
|
|
/* Two possible sources of an unmodified event; one is a
|
|
|
|
* client that's letting button presses pass through to the
|
|
|
|
* frame, the other is our focus_window_grab on unmodified
|
|
|
|
* button 1. So for all such events we focus the window.
|
|
|
|
*/
|
|
|
|
unmodified = (event->xbutton.state & grab_mask) == 0;
|
2001-07-25 23:58:24 -04:00
|
|
|
|
2002-12-13 17:20:31 -05:00
|
|
|
if (unmodified ||
|
2002-02-08 01:50:09 -05:00
|
|
|
event->xbutton.button == 1)
|
2001-07-25 23:14:45 -04:00
|
|
|
{
|
2005-01-09 14:27:22 -05:00
|
|
|
/* don't focus if frame received, will be lowered in
|
|
|
|
* frames.c or special-cased if the click was on a
|
|
|
|
* minimize/close button.
|
|
|
|
*/
|
2002-06-09 00:14:40 -04:00
|
|
|
if (!frame_was_receiver)
|
|
|
|
{
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
if (meta_prefs_get_raise_on_click ())
|
2005-01-09 14:27:22 -05:00
|
|
|
meta_window_raise (window);
|
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
"Not raising window on click due to don't-raise-on-click option\n");
|
2005-01-09 14:27:22 -05:00
|
|
|
|
|
|
|
/* Don't focus panels--they must explicitly request focus.
|
|
|
|
* See bug 160470
|
|
|
|
*/
|
|
|
|
if (window->type != META_WINDOW_DOCK)
|
2003-06-12 01:55:06 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
2006-01-20 17:03:56 -05:00
|
|
|
"Focusing %s due to unmodified button %u press (display.c)\n",
|
2003-06-12 01:55:06 -04:00
|
|
|
window->desc, event->xbutton.button);
|
|
|
|
meta_window_focus (window, event->xbutton.time);
|
|
|
|
}
|
2006-01-15 12:03:57 -05:00
|
|
|
else
|
|
|
|
/* However, do allow terminals to lose focus due to new
|
|
|
|
* window mappings after the user clicks on a panel.
|
|
|
|
*/
|
|
|
|
display->allow_terminal_deactivation = TRUE;
|
2002-06-09 00:14:40 -04:00
|
|
|
}
|
2001-12-10 23:03:58 -05:00
|
|
|
|
2001-12-10 02:48:21 -05:00
|
|
|
/* you can move on alt-click but not on
|
2001-12-10 23:03:58 -05:00
|
|
|
* the click-to-focus
|
2001-12-10 02:48:21 -05:00
|
|
|
*/
|
2002-02-08 01:50:09 -05:00
|
|
|
if (!unmodified)
|
2001-12-10 02:48:21 -05:00
|
|
|
begin_move = TRUE;
|
2001-07-25 23:14:45 -04:00
|
|
|
}
|
2002-10-11 14:42:40 -04:00
|
|
|
else if (!unmodified && event->xbutton.button == 2)
|
2001-07-25 23:14:45 -04:00
|
|
|
{
|
2002-05-09 17:22:01 -04:00
|
|
|
if (window->has_resize_func)
|
|
|
|
{
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
gboolean north, south;
|
|
|
|
gboolean west, east;
|
2002-05-09 17:22:01 -04:00
|
|
|
int root_x, root_y;
|
|
|
|
MetaGrabOp op;
|
|
|
|
|
|
|
|
meta_window_get_position (window, &root_x, &root_y);
|
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
west = event->xbutton.x_root < (root_x + 1 * window->rect.width / 3);
|
|
|
|
east = event->xbutton.x_root > (root_x + 2 * window->rect.width / 3);
|
|
|
|
north = event->xbutton.y_root < (root_y + 1 * window->rect.height / 3);
|
|
|
|
south = event->xbutton.y_root > (root_y + 2 * window->rect.height / 3);
|
2002-05-09 17:22:01 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
if (north && west)
|
2002-05-09 17:22:01 -04:00
|
|
|
op = META_GRAB_OP_RESIZING_NW;
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
else if (north && east)
|
2002-05-09 17:22:01 -04:00
|
|
|
op = META_GRAB_OP_RESIZING_NE;
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
else if (south && west)
|
|
|
|
op = META_GRAB_OP_RESIZING_SW;
|
|
|
|
else if (south && east)
|
2002-05-09 17:22:01 -04:00
|
|
|
op = META_GRAB_OP_RESIZING_SE;
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
else if (north)
|
|
|
|
op = META_GRAB_OP_RESIZING_N;
|
|
|
|
else if (west)
|
|
|
|
op = META_GRAB_OP_RESIZING_W;
|
|
|
|
else if (east)
|
|
|
|
op = META_GRAB_OP_RESIZING_E;
|
|
|
|
else if (south)
|
|
|
|
op = META_GRAB_OP_RESIZING_S;
|
|
|
|
else /* Middle region is no-op to avoid user triggering wrong action */
|
|
|
|
op = META_GRAB_OP_NONE;
|
2002-05-09 17:22:01 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
if (op != META_GRAB_OP_NONE)
|
|
|
|
meta_display_begin_grab_op (display,
|
|
|
|
window->screen,
|
|
|
|
window,
|
|
|
|
op,
|
|
|
|
TRUE,
|
|
|
|
event->xbutton.serial,
|
|
|
|
event->xbutton.button,
|
|
|
|
0,
|
|
|
|
event->xbutton.time,
|
|
|
|
event->xbutton.x_root,
|
|
|
|
event->xbutton.y_root);
|
2002-05-09 17:22:01 -04:00
|
|
|
}
|
2001-07-25 23:14:45 -04:00
|
|
|
}
|
|
|
|
else if (event->xbutton.button == 3)
|
|
|
|
{
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
if (meta_prefs_get_raise_on_click ())
|
|
|
|
meta_window_raise (window);
|
2001-07-25 23:14:45 -04:00
|
|
|
meta_window_show_menu (window,
|
|
|
|
event->xbutton.x_root,
|
|
|
|
event->xbutton.y_root,
|
|
|
|
event->xbutton.button,
|
|
|
|
event->xbutton.time);
|
|
|
|
}
|
2001-07-25 23:58:24 -04:00
|
|
|
|
2002-10-11 14:42:40 -04:00
|
|
|
if (!frame_was_receiver && unmodified)
|
|
|
|
{
|
|
|
|
/* This is from our synchronous grab since
|
|
|
|
* it has no modifiers and was on the client window
|
|
|
|
*/
|
|
|
|
int mode;
|
|
|
|
|
|
|
|
/* When clicking a different app in click-to-focus
|
|
|
|
* in application-based mode, and the different
|
|
|
|
* app is not a dock or desktop, eat the focus click.
|
|
|
|
*/
|
|
|
|
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK &&
|
|
|
|
meta_prefs_get_application_based () &&
|
|
|
|
!window->has_focus &&
|
|
|
|
window->type != META_WINDOW_DOCK &&
|
|
|
|
window->type != META_WINDOW_DESKTOP &&
|
|
|
|
(display->focus_window == NULL ||
|
|
|
|
!meta_window_same_application (window,
|
|
|
|
display->focus_window)))
|
|
|
|
mode = AsyncPointer; /* eat focus click */
|
|
|
|
else
|
|
|
|
mode = ReplayPointer; /* give event back */
|
2003-10-13 16:15:40 -04:00
|
|
|
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
meta_verbose ("Allowing events mode %s time %u\n",
|
2003-10-13 16:15:40 -04:00
|
|
|
mode == AsyncPointer ? "AsyncPointer" : "ReplayPointer",
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
(unsigned int)event->xbutton.time);
|
2002-10-11 14:42:40 -04:00
|
|
|
|
|
|
|
XAllowEvents (display->xdisplay,
|
|
|
|
mode, event->xbutton.time);
|
|
|
|
}
|
2006-02-25 11:54:39 -05:00
|
|
|
|
2001-07-25 23:58:24 -04:00
|
|
|
if (begin_move && window->has_move_func)
|
|
|
|
{
|
|
|
|
meta_display_begin_grab_op (display,
|
2002-06-27 01:08:32 -04:00
|
|
|
window->screen,
|
2001-07-25 23:58:24 -04:00
|
|
|
window,
|
|
|
|
META_GRAB_OP_MOVING,
|
|
|
|
TRUE,
|
2003-11-24 13:09:47 -05:00
|
|
|
event->xbutton.serial,
|
2001-07-25 23:58:24 -04:00
|
|
|
event->xbutton.button,
|
|
|
|
0,
|
|
|
|
event->xbutton.time,
|
|
|
|
event->xbutton.x_root,
|
|
|
|
event->xbutton.y_root);
|
|
|
|
}
|
2001-07-11 02:22:00 -04:00
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case ButtonRelease:
|
2002-12-09 22:23:04 -05:00
|
|
|
if (display->grab_window == window &&
|
2004-04-15 23:38:19 -04:00
|
|
|
event->xany.serial >= display->grab_start_serial &&
|
2002-12-09 22:23:04 -05:00
|
|
|
grab_op_is_mouse (display->grab_op))
|
2001-07-25 23:14:45 -04:00
|
|
|
meta_window_handle_mouse_grab_op_event (window, event);
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case MotionNotify:
|
2002-12-09 22:23:04 -05:00
|
|
|
if (display->grab_window == window &&
|
2004-04-15 23:38:19 -04:00
|
|
|
event->xany.serial >= display->grab_start_serial &&
|
2002-12-09 22:23:04 -05:00
|
|
|
grab_op_is_mouse (display->grab_op))
|
2001-07-25 23:14:45 -04:00
|
|
|
meta_window_handle_mouse_grab_op_event (window, event);
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case EnterNotify:
|
2002-12-09 22:23:04 -05:00
|
|
|
if (display->grab_window == window &&
|
2004-04-15 23:38:19 -04:00
|
|
|
event->xany.serial >= display->grab_start_serial &&
|
2002-12-09 22:23:04 -05:00
|
|
|
grab_op_is_mouse (display->grab_op))
|
2006-01-30 12:22:14 -05:00
|
|
|
{
|
|
|
|
meta_window_handle_mouse_grab_op_event (window, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the mouse switches screens, active the default window on the new
|
|
|
|
* screen; this will make keybindings and workspace-launched items
|
|
|
|
* actually appear on the right screen.
|
|
|
|
*/
|
|
|
|
if (display->active_screen !=
|
|
|
|
meta_display_screen_for_root (display, event->xcrossing.root))
|
|
|
|
{
|
|
|
|
MetaScreen *new_screen;
|
|
|
|
new_screen = meta_display_screen_for_root (display,
|
|
|
|
event->xcrossing.root);
|
|
|
|
meta_workspace_focus_default_window (new_screen->active_workspace,
|
|
|
|
NULL,
|
|
|
|
event->xcrossing.time);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if we've entered a window; do this even if window->has_focus to
|
|
|
|
* avoid races.
|
|
|
|
*/
|
|
|
|
if (window && !serial_is_ignored (display, event->xany.serial) &&
|
2004-09-15 11:46:25 -04:00
|
|
|
event->xcrossing.mode != NotifyGrab &&
|
|
|
|
event->xcrossing.mode != NotifyUngrab &&
|
2003-05-30 16:24:00 -04:00
|
|
|
event->xcrossing.detail != NotifyInferior &&
|
|
|
|
meta_display_focus_sentinel_clear (display))
|
2001-09-16 17:50:27 -04:00
|
|
|
{
|
2001-12-09 19:38:21 -05:00
|
|
|
switch (meta_prefs_get_focus_mode ())
|
|
|
|
{
|
|
|
|
case META_FOCUS_MODE_SLOPPY:
|
|
|
|
case META_FOCUS_MODE_MOUSE:
|
2001-12-10 23:03:58 -05:00
|
|
|
if (window->type != META_WINDOW_DOCK &&
|
|
|
|
window->type != META_WINDOW_DESKTOP)
|
2002-01-03 18:28:19 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
2005-02-21 21:11:25 -05:00
|
|
|
"Focusing %s due to enter notify with serial %lu "
|
|
|
|
"at time %lu, and setting display->mouse_mode to "
|
|
|
|
"TRUE.\n",
|
|
|
|
window->desc,
|
|
|
|
event->xany.serial,
|
|
|
|
event->xcrossing.time);
|
2002-03-02 10:26:07 -05:00
|
|
|
|
2005-02-21 21:11:25 -05:00
|
|
|
display->mouse_mode = TRUE;
|
|
|
|
meta_window_focus (window, event->xcrossing.time);
|
2002-05-23 22:23:46 -04:00
|
|
|
|
|
|
|
/* stop ignoring stuff */
|
|
|
|
reset_ignores (display);
|
|
|
|
|
|
|
|
if (meta_prefs_get_auto_raise ())
|
|
|
|
{
|
2004-10-04 17:09:08 -04:00
|
|
|
meta_display_queue_autoraise_callback (display, window);
|
2002-05-23 22:23:46 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Auto raise is disabled\n");
|
|
|
|
}
|
2002-01-03 18:28:19 -05:00
|
|
|
}
|
2001-12-09 19:38:21 -05:00
|
|
|
break;
|
|
|
|
case META_FOCUS_MODE_CLICK:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-09-16 17:50:27 -04:00
|
|
|
if (window->type == META_WINDOW_DOCK)
|
|
|
|
meta_window_raise (window);
|
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case LeaveNotify:
|
2002-12-09 22:23:04 -05:00
|
|
|
if (display->grab_window == window &&
|
2004-04-15 23:38:19 -04:00
|
|
|
event->xany.serial >= display->grab_start_serial &&
|
2002-12-09 22:23:04 -05:00
|
|
|
grab_op_is_mouse (display->grab_op))
|
|
|
|
meta_window_handle_mouse_grab_op_event (window, event);
|
|
|
|
else if (window != NULL)
|
2001-09-16 17:50:27 -04:00
|
|
|
{
|
2001-12-09 19:38:21 -05:00
|
|
|
switch (meta_prefs_get_focus_mode ())
|
|
|
|
{
|
|
|
|
case META_FOCUS_MODE_MOUSE:
|
2005-02-21 21:11:25 -05:00
|
|
|
if ((window->frame == NULL || frame_was_receiver) &&
|
2005-02-25 15:14:08 -05:00
|
|
|
event->xcrossing.mode != NotifyGrab &&
|
|
|
|
event->xcrossing.mode != NotifyUngrab &&
|
|
|
|
event->xcrossing.detail != NotifyInferior &&
|
|
|
|
meta_display_focus_sentinel_clear (display))
|
2002-01-03 18:28:19 -05:00
|
|
|
{
|
2005-02-21 21:11:25 -05:00
|
|
|
if (window == display->expected_focus_window)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Unsetting focus from %s due to LeaveNotify\n",
|
|
|
|
window->desc);
|
|
|
|
meta_display_focus_the_no_focus_window (display,
|
2005-12-28 01:24:30 -05:00
|
|
|
window->screen,
|
2005-02-21 21:11:25 -05:00
|
|
|
event->xcrossing.time);
|
|
|
|
}
|
|
|
|
if (window->type != META_WINDOW_DOCK &&
|
|
|
|
window->type != META_WINDOW_DESKTOP)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Setting display->mouse_mode to TRUE due to "
|
|
|
|
"LeaveNotify at time %lu.\n",
|
|
|
|
event->xcrossing.time);
|
|
|
|
display->mouse_mode = TRUE;
|
|
|
|
}
|
2002-01-03 18:28:19 -05:00
|
|
|
}
|
2001-12-09 19:38:21 -05:00
|
|
|
break;
|
|
|
|
case META_FOCUS_MODE_SLOPPY:
|
|
|
|
case META_FOCUS_MODE_CLICK:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-01-04 17:46:37 -05:00
|
|
|
if (window->type == META_WINDOW_DOCK &&
|
|
|
|
event->xcrossing.mode != NotifyGrab &&
|
2002-05-11 00:44:34 -04:00
|
|
|
event->xcrossing.mode != NotifyUngrab &&
|
|
|
|
!window->has_focus)
|
2001-09-16 17:50:27 -04:00
|
|
|
meta_window_lower (window);
|
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case FocusIn:
|
|
|
|
case FocusOut:
|
2001-06-04 00:58:22 -04:00
|
|
|
if (window)
|
2002-01-05 22:15:49 -05:00
|
|
|
{
|
|
|
|
meta_window_notify_focus (window, event);
|
|
|
|
}
|
2005-12-28 01:24:30 -05:00
|
|
|
else if (meta_display_xwindow_is_a_no_focus_window (display,
|
|
|
|
event->xany.window))
|
2002-01-05 22:15:49 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focus %s event received on no_focus_window 0x%lx "
|
|
|
|
"mode %s detail %s\n",
|
|
|
|
event->type == FocusIn ? "in" :
|
|
|
|
event->type == FocusOut ? "out" :
|
|
|
|
"???",
|
|
|
|
event->xany.window,
|
2002-03-02 10:26:07 -05:00
|
|
|
meta_event_mode_to_string (event->xfocus.mode),
|
2003-09-26 22:40:09 -04:00
|
|
|
meta_event_detail_to_string (event->xfocus.detail));
|
2002-01-05 22:15:49 -05:00
|
|
|
}
|
|
|
|
else if (meta_display_screen_for_root (display,
|
|
|
|
event->xany.window) != NULL)
|
|
|
|
{
|
2004-10-04 17:21:38 -04:00
|
|
|
MetaScreen * screen;
|
|
|
|
screen = meta_display_screen_for_root (display, event->xany.window);
|
|
|
|
|
2002-01-05 22:15:49 -05:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focus %s event received on root window 0x%lx "
|
|
|
|
"mode %s detail %s\n",
|
|
|
|
event->type == FocusIn ? "in" :
|
|
|
|
event->type == FocusOut ? "out" :
|
|
|
|
"???",
|
|
|
|
event->xany.window,
|
2002-03-02 10:26:07 -05:00
|
|
|
meta_event_mode_to_string (event->xfocus.mode),
|
2003-09-26 22:40:09 -04:00
|
|
|
meta_event_detail_to_string (event->xfocus.detail));
|
|
|
|
|
|
|
|
if (event->type == FocusIn &&
|
|
|
|
event->xfocus.detail == NotifyDetailNone)
|
|
|
|
{
|
2004-10-04 16:39:21 -04:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focus got set to None, probably due to brain-damage in the X protocol (see bug 125492). Setting the default focus window.\n");
|
2003-11-24 12:47:48 -05:00
|
|
|
|
2004-10-04 16:43:55 -04:00
|
|
|
meta_workspace_focus_default_window (screen->active_workspace, NULL, meta_display_get_current_time_roundtrip (display));
|
2003-09-26 22:40:09 -04:00
|
|
|
}
|
2004-10-04 17:21:38 -04:00
|
|
|
else if (event->type == FocusIn &&
|
|
|
|
event->xfocus.mode == NotifyNormal &&
|
|
|
|
event->xfocus.detail == NotifyInferior)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focus got set to root window, probably due to gnome-session logout dialog usage (see bug 153220). Setting the default focus window.\n");
|
|
|
|
meta_workspace_focus_default_window (screen->active_workspace, NULL, meta_display_get_current_time_roundtrip (display));
|
|
|
|
}
|
|
|
|
|
2002-01-05 22:15:49 -05:00
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case KeymapNotify:
|
|
|
|
break;
|
|
|
|
case Expose:
|
|
|
|
break;
|
|
|
|
case GraphicsExpose:
|
|
|
|
break;
|
|
|
|
case NoExpose:
|
|
|
|
break;
|
|
|
|
case VisibilityNotify:
|
|
|
|
break;
|
|
|
|
case CreateNotify:
|
|
|
|
break;
|
2003-12-25 19:05:26 -05:00
|
|
|
|
2001-05-30 11:36:31 -04:00
|
|
|
case DestroyNotify:
|
2001-06-02 21:33:27 -04:00
|
|
|
if (window)
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
2001-07-25 23:14:45 -04:00
|
|
|
if (display->grab_op != META_GRAB_OP_NONE &&
|
|
|
|
display->grab_window == window)
|
|
|
|
meta_display_end_grab_op (display, CurrentTime);
|
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
if (frame_was_receiver)
|
|
|
|
{
|
|
|
|
meta_warning ("Unexpected destruction of frame 0x%lx, not sure if this should silently fail or be considered a bug\n",
|
|
|
|
window->frame->xwindow);
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
meta_window_destroy_frame (window->frame->window);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, FALSE);
|
2001-07-11 02:22:00 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_window_free (window); /* Unmanage destroyed window */
|
2003-12-25 19:05:26 -05:00
|
|
|
window = NULL;
|
2001-07-11 02:22:00 -04:00
|
|
|
}
|
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
2003-12-25 21:42:38 -05:00
|
|
|
case UnmapNotify:
|
2002-08-03 19:07:04 -04:00
|
|
|
if (window)
|
2001-06-04 02:17:52 -04:00
|
|
|
{
|
2002-08-03 19:07:04 -04:00
|
|
|
if (display->grab_op != META_GRAB_OP_NONE &&
|
2004-12-28 17:31:10 -05:00
|
|
|
display->grab_window == window &&
|
|
|
|
((window->frame == NULL) || !window->frame->mapped))
|
2002-08-03 19:07:04 -04:00
|
|
|
meta_display_end_grab_op (display, CurrentTime);
|
|
|
|
|
|
|
|
if (!frame_was_receiver)
|
2001-06-10 23:24:20 -04:00
|
|
|
{
|
2002-08-03 19:07:04 -04:00
|
|
|
if (window->unmaps_pending == 0)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_STATE,
|
|
|
|
"Window %s withdrawn\n",
|
|
|
|
window->desc);
|
2006-05-23 16:38:18 -04:00
|
|
|
|
|
|
|
meta_effect_run_close (window, NULL, NULL);
|
|
|
|
|
2002-08-03 19:07:04 -04:00
|
|
|
window->withdrawn = TRUE;
|
|
|
|
meta_window_free (window); /* Unmanage withdrawn window */
|
|
|
|
window = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window->unmaps_pending -= 1;
|
|
|
|
meta_topic (META_DEBUG_WINDOW_STATE,
|
|
|
|
"Received pending unmap, %d now pending\n",
|
|
|
|
window->unmaps_pending);
|
|
|
|
}
|
2001-06-10 23:24:20 -04:00
|
|
|
}
|
2002-01-10 22:31:14 -05:00
|
|
|
|
2002-08-03 19:07:04 -04:00
|
|
|
/* Unfocus on UnmapNotify, do this after the possible
|
|
|
|
* window_free above so that window_free can see if window->has_focus
|
|
|
|
* and move focus to another window
|
|
|
|
*/
|
|
|
|
if (window)
|
|
|
|
meta_window_notify_focus (window, event);
|
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case MapNotify:
|
|
|
|
break;
|
|
|
|
case MapRequest:
|
2001-06-02 21:33:27 -04:00
|
|
|
if (window == NULL)
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
|
|
|
window = meta_window_new (display, event->xmaprequest.window,
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
/* if frame was receiver it's some malicious send event or something */
|
|
|
|
else if (!frame_was_receiver && window)
|
2001-06-11 02:39:12 -04:00
|
|
|
{
|
2003-01-21 17:40:25 -05:00
|
|
|
meta_verbose ("MapRequest on %s mapped = %d minimized = %d\n",
|
|
|
|
window->desc, window->mapped, window->minimized);
|
2001-06-11 02:39:12 -04:00
|
|
|
if (window->minimized)
|
2003-01-21 17:40:25 -05:00
|
|
|
{
|
|
|
|
meta_window_unminimize (window);
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
if (window->workspace != window->screen->active_workspace)
|
2003-01-21 17:40:25 -05:00
|
|
|
{
|
|
|
|
meta_verbose ("Changing workspace due to MapRequest mapped = %d minimized = %d\n",
|
|
|
|
window->mapped, window->minimized);
|
|
|
|
meta_window_change_workspace (window,
|
|
|
|
window->screen->active_workspace);
|
|
|
|
}
|
|
|
|
}
|
2001-06-11 02:39:12 -04:00
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case ReparentNotify:
|
|
|
|
break;
|
|
|
|
case ConfigureNotify:
|
2002-09-28 22:50:24 -04:00
|
|
|
/* Handle screen resize */
|
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
2006-03-03 10:53:10 -05:00
|
|
|
|
2002-09-28 22:50:24 -04:00
|
|
|
screen = meta_display_screen_for_root (display,
|
|
|
|
event->xconfigure.window);
|
2002-10-04 14:31:54 -04:00
|
|
|
|
2002-09-28 22:50:24 -04:00
|
|
|
if (screen != NULL)
|
2002-10-04 14:31:54 -04:00
|
|
|
{
|
|
|
|
#ifdef HAVE_RANDR
|
|
|
|
/* do the resize the official way */
|
|
|
|
XRRUpdateConfiguration (event);
|
|
|
|
#else
|
|
|
|
/* poke around in Xlib */
|
|
|
|
screen->xscreen->width = event->xconfigure.width;
|
|
|
|
screen->xscreen->height = event->xconfigure.height;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
meta_screen_resize (screen,
|
|
|
|
event->xconfigure.width,
|
|
|
|
event->xconfigure.height);
|
|
|
|
}
|
2002-09-28 22:50:24 -04:00
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case ConfigureRequest:
|
2001-06-02 21:33:27 -04:00
|
|
|
/* This comment and code is found in both twm and fvwm */
|
|
|
|
/*
|
|
|
|
* According to the July 27, 1988 ICCCM draft, we should ignore size and
|
|
|
|
* position fields in the WM_NORMAL_HINTS property when we map a window.
|
|
|
|
* Instead, we'll read the current geometry. Therefore, we should respond
|
|
|
|
* to configuration requests for windows which have never been mapped.
|
|
|
|
*/
|
|
|
|
if (window == NULL)
|
|
|
|
{
|
|
|
|
unsigned int xwcm;
|
|
|
|
XWindowChanges xwc;
|
|
|
|
|
|
|
|
xwcm = event->xconfigurerequest.value_mask &
|
|
|
|
(CWX | CWY | CWWidth | CWHeight | CWBorderWidth);
|
|
|
|
|
|
|
|
xwc.x = event->xconfigurerequest.x;
|
|
|
|
xwc.y = event->xconfigurerequest.y;
|
|
|
|
xwc.width = event->xconfigurerequest.width;
|
|
|
|
xwc.height = event->xconfigurerequest.height;
|
|
|
|
xwc.border_width = event->xconfigurerequest.border_width;
|
|
|
|
|
2001-06-11 01:47:51 -04:00
|
|
|
meta_verbose ("Configuring withdrawn window to %d,%d %dx%d border %d (some values may not be in mask)\n",
|
2001-06-08 02:39:38 -04:00
|
|
|
xwc.x, xwc.y, xwc.width, xwc.height, xwc.border_width);
|
2001-08-03 00:20:27 -04:00
|
|
|
meta_error_trap_push (display);
|
2001-06-02 21:33:27 -04:00
|
|
|
XConfigureWindow (display->xdisplay, event->xconfigurerequest.window,
|
|
|
|
xwcm, &xwc);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, FALSE);
|
2001-06-02 21:33:27 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-11 02:22:00 -04:00
|
|
|
if (!frame_was_receiver)
|
|
|
|
meta_window_configure_request (window, event);
|
2001-06-02 21:33:27 -04:00
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case GravityNotify:
|
|
|
|
break;
|
|
|
|
case ResizeRequest:
|
|
|
|
break;
|
|
|
|
case CirculateNotify:
|
|
|
|
break;
|
|
|
|
case CirculateRequest:
|
|
|
|
break;
|
|
|
|
case PropertyNotify:
|
2002-11-30 22:58:04 -05:00
|
|
|
{
|
|
|
|
MetaGroup *group;
|
|
|
|
MetaScreen *screen;
|
2003-12-13 18:00:06 -05:00
|
|
|
|
|
|
|
if (window && !frame_was_receiver)
|
2002-11-30 22:58:04 -05:00
|
|
|
meta_window_property_notify (window, event);
|
2002-05-16 00:03:36 -04:00
|
|
|
|
2002-11-30 22:58:04 -05:00
|
|
|
group = meta_display_lookup_group (display,
|
|
|
|
event->xproperty.window);
|
|
|
|
if (group != NULL)
|
|
|
|
meta_group_property_notify (group, event);
|
|
|
|
|
|
|
|
screen = NULL;
|
|
|
|
if (window == NULL &&
|
|
|
|
group == NULL) /* window/group != NULL means it wasn't a root window */
|
2002-05-16 00:03:36 -04:00
|
|
|
screen = meta_display_screen_for_root (display,
|
|
|
|
event->xproperty.window);
|
2002-11-30 22:58:04 -05:00
|
|
|
|
|
|
|
if (screen != NULL)
|
|
|
|
{
|
|
|
|
if (event->xproperty.atom ==
|
|
|
|
display->atom_net_desktop_layout)
|
|
|
|
meta_screen_update_workspace_layout (screen);
|
|
|
|
else if (event->xproperty.atom ==
|
|
|
|
display->atom_net_desktop_names)
|
|
|
|
meta_screen_update_workspace_names (screen);
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
#if 0
|
|
|
|
else if (event->xproperty.atom ==
|
|
|
|
display->atom_net_restack_window)
|
|
|
|
handle_net_restack_window (display, event);
|
|
|
|
else if (event->xproperty.atom ==
|
|
|
|
display->atom_net_moveresize_window)
|
|
|
|
handle_net_moveresize_window (display, event);
|
|
|
|
#endif
|
2003-05-30 16:24:00 -04:00
|
|
|
|
Fix some support for EWMH hints, and fix USER_TIME support to include the
2004-07-31 Rob Adams <readams@readams.net>
Fix some support for EWMH hints, and fix USER_TIME support to
include the DEMANDS_ATTENTION hint. Also includes some code for
implementing _NET_RESTACK_WINDOW and _NET_MOVERESIZE_WINDOW, but
this is disabled pending feature thaw.
* COMPLIANCE: update with new information
* src/display.c (meta_display_open): add new hints to list
* src/display.h (_MetaDisplay): Add new atoms to struct
* src/screen.c (set_supported_hint): update the list of support
hints.
(set_desktop_viewport_hint): new function sets the viewport hint
to (0,0) as required by the spec for WMs with no viewport support.
(set_desktop_geometry_hint): new function to set the desktop size
hint to the size of the display, since we don't implement large
desktop support, as required by the spec.
(meta_screen_resize): update the geometry hint on screen resize
* src/window.c (meta_window_new_with_attrs): Initialize
demands_attention state
(set_net_wm_state): Set demands_attention hint in the window state
(meta_window_show): If we don't pop up a window because of
USER_TIME, set DEMANDS_ATTENTION on the window.
(meta_window_focus): When a window receives focus, remove
DEMANDS_ATTENTION hint
(meta_window_client_message): Allow other apps to set
DEMANDS_ATTENTION on a window. Also, if the _NET_ACTIVE_WINDOW
hint includes a timestamp, use it.
(update_net_wm_state): Read DEMANDS_ATTENTION state also
* src/window.h (_MetaWindow): add wm_state_demands_attention bit.
2004-07-31 15:56:10 -04:00
|
|
|
/* we just use this property as a sentinel to avoid
|
|
|
|
* certain race conditions. See the comment for the
|
|
|
|
* sentinel_counter variable declaration in display.h
|
2003-05-30 16:24:00 -04:00
|
|
|
*/
|
|
|
|
if (event->xproperty.atom ==
|
|
|
|
display->atom_metacity_sentinel)
|
|
|
|
{
|
|
|
|
meta_display_decrement_focus_sentinel (display);
|
|
|
|
}
|
2002-11-30 22:58:04 -05:00
|
|
|
}
|
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case SelectionClear:
|
2002-06-08 19:55:27 -04:00
|
|
|
/* do this here instead of at end of function
|
|
|
|
* so we can return
|
|
|
|
*/
|
|
|
|
display->current_time = CurrentTime;
|
|
|
|
process_selection_clear (display, event);
|
|
|
|
/* Note that processing that may have resulted in
|
|
|
|
* closing the display... so return right away.
|
|
|
|
*/
|
|
|
|
return FALSE;
|
2001-05-30 11:36:31 -04:00
|
|
|
case SelectionRequest:
|
2002-06-08 19:55:27 -04:00
|
|
|
process_selection_request (display, event);
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case SelectionNotify:
|
|
|
|
break;
|
|
|
|
case ColormapNotify:
|
2002-05-09 18:34:00 -04:00
|
|
|
if (window && !frame_was_receiver)
|
|
|
|
window->colormap = event->xcolormap.colormap;
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case ClientMessage:
|
2001-06-07 01:18:10 -04:00
|
|
|
if (window)
|
2001-06-09 23:17:15 -04:00
|
|
|
{
|
2001-07-11 02:22:00 -04:00
|
|
|
if (!frame_was_receiver)
|
|
|
|
meta_window_client_message (window, event);
|
2001-06-09 23:17:15 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
screen = meta_display_screen_for_root (display,
|
|
|
|
event->xclient.window);
|
|
|
|
|
2001-10-07 19:06:19 -04:00
|
|
|
if (screen)
|
2001-06-09 23:17:15 -04:00
|
|
|
{
|
2001-10-07 19:06:19 -04:00
|
|
|
if (event->xclient.message_type ==
|
|
|
|
display->atom_net_current_desktop)
|
|
|
|
{
|
|
|
|
int space;
|
|
|
|
MetaWorkspace *workspace;
|
2005-02-20 18:38:31 -05:00
|
|
|
guint32 time;
|
2001-06-09 23:17:15 -04:00
|
|
|
|
2001-10-07 19:06:19 -04:00
|
|
|
space = event->xclient.data.l[0];
|
2005-02-20 18:38:31 -05:00
|
|
|
time = event->xclient.data.l[1];
|
2001-06-09 23:17:15 -04:00
|
|
|
|
2005-02-20 18:38:31 -05:00
|
|
|
meta_verbose ("Request to change current workspace to %d with "
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"specified timestamp of %u\n",
|
|
|
|
space, time);
|
2005-02-20 18:38:31 -05:00
|
|
|
|
2001-10-07 19:06:19 -04:00
|
|
|
workspace =
|
2002-10-16 16:12:24 -04:00
|
|
|
meta_screen_get_workspace_by_index (screen,
|
|
|
|
space);
|
2001-10-07 19:06:19 -04:00
|
|
|
|
2005-02-20 18:38:31 -05:00
|
|
|
/* Handle clients using the older version of the spec... */
|
|
|
|
if (time == 0 && workspace)
|
|
|
|
time = meta_display_get_current_time_roundtrip (display);
|
|
|
|
|
2001-10-07 19:06:19 -04:00
|
|
|
if (workspace)
|
2005-02-20 18:38:31 -05:00
|
|
|
meta_workspace_activate (workspace, time);
|
2001-10-07 19:06:19 -04:00
|
|
|
else
|
|
|
|
meta_verbose ("Don't know about workspace %d\n", space);
|
|
|
|
}
|
2002-03-10 13:36:08 -05:00
|
|
|
else if (event->xclient.message_type ==
|
|
|
|
display->atom_net_number_of_desktops)
|
|
|
|
{
|
|
|
|
int num_spaces;
|
|
|
|
|
|
|
|
num_spaces = event->xclient.data.l[0];
|
|
|
|
|
|
|
|
meta_verbose ("Request to set number of workspaces to %d\n",
|
|
|
|
num_spaces);
|
|
|
|
|
|
|
|
meta_prefs_set_num_workspaces (num_spaces);
|
|
|
|
}
|
2002-05-06 02:11:46 -04:00
|
|
|
else if (event->xclient.message_type ==
|
2002-09-23 22:04:32 -04:00
|
|
|
display->atom_net_showing_desktop)
|
2002-05-06 02:11:46 -04:00
|
|
|
{
|
2002-09-23 22:04:32 -04:00
|
|
|
gboolean showing_desktop;
|
|
|
|
|
|
|
|
showing_desktop = event->xclient.data.l[0] != 0;
|
|
|
|
meta_verbose ("Request to %s desktop\n", showing_desktop ? "show" : "hide");
|
|
|
|
|
|
|
|
if (showing_desktop)
|
2004-12-19 21:46:42 -05:00
|
|
|
meta_screen_show_desktop (screen, meta_display_get_current_time_roundtrip (display));
|
2002-05-06 02:11:46 -04:00
|
|
|
else
|
2004-08-06 23:13:56 -04:00
|
|
|
{
|
|
|
|
meta_screen_unshow_desktop (screen);
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
meta_workspace_focus_default_window (screen->active_workspace, NULL, meta_display_get_current_time_roundtrip (display));
|
2004-08-06 23:13:56 -04:00
|
|
|
}
|
2002-05-06 02:11:46 -04:00
|
|
|
}
|
2001-10-15 00:14:58 -04:00
|
|
|
else if (event->xclient.message_type ==
|
|
|
|
display->atom_metacity_restart_message)
|
|
|
|
{
|
|
|
|
meta_verbose ("Received restart request\n");
|
|
|
|
meta_restart ();
|
|
|
|
}
|
2002-02-06 22:07:56 -05:00
|
|
|
else if (event->xclient.message_type ==
|
|
|
|
display->atom_metacity_reload_theme_message)
|
|
|
|
{
|
|
|
|
meta_verbose ("Received reload theme request\n");
|
|
|
|
meta_ui_set_current_theme (meta_prefs_get_theme (),
|
|
|
|
TRUE);
|
2002-02-06 22:25:34 -05:00
|
|
|
meta_display_retheme_all ();
|
2002-02-06 22:07:56 -05:00
|
|
|
}
|
2002-02-08 01:01:58 -05:00
|
|
|
else if (event->xclient.message_type ==
|
|
|
|
display->atom_metacity_set_keybindings_message)
|
|
|
|
{
|
|
|
|
meta_verbose ("Received set keybindings request = %d\n",
|
|
|
|
(int) event->xclient.data.l[0]);
|
|
|
|
meta_set_keybindings_disabled (!event->xclient.data.l[0]);
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
else if (event->xclient.message_type ==
|
|
|
|
display->atom_metacity_toggle_verbose)
|
|
|
|
{
|
|
|
|
meta_verbose ("Received toggle verbose message\n");
|
|
|
|
meta_set_verbose (!meta_is_verbose ());
|
|
|
|
}
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
else if (event->xclient.message_type ==
|
|
|
|
display->atom_wm_protocols)
|
|
|
|
{
|
|
|
|
meta_verbose ("Received WM_PROTOCOLS message\n");
|
|
|
|
|
|
|
|
if ((Atom)event->xclient.data.l[0] == display->atom_net_wm_ping)
|
|
|
|
{
|
|
|
|
process_pong_message (display, event);
|
|
|
|
|
|
|
|
/* We don't want ping reply events going into
|
|
|
|
* the GTK+ event loop because gtk+ will treat
|
|
|
|
* them as ping requests and send more replies.
|
|
|
|
*/
|
|
|
|
filter_out_event = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2001-06-09 23:17:15 -04:00
|
|
|
}
|
2004-01-10 12:16:07 -05:00
|
|
|
|
|
|
|
if (event->xclient.message_type ==
|
|
|
|
display->atom_net_request_frame_extents)
|
|
|
|
{
|
|
|
|
meta_verbose ("Received _NET_REQUEST_FRAME_EXTENTS message\n");
|
|
|
|
process_request_frame_extents (display, event);
|
|
|
|
}
|
2001-06-09 23:17:15 -04:00
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
case MappingNotify:
|
2002-11-06 11:00:56 -05:00
|
|
|
{
|
|
|
|
gboolean ignore_current;
|
|
|
|
|
|
|
|
ignore_current = FALSE;
|
|
|
|
|
|
|
|
/* Check whether the next event is an identical MappingNotify
|
|
|
|
* event. If it is, ignore the current event, we'll update
|
|
|
|
* when we get the next one.
|
|
|
|
*/
|
|
|
|
if (XPending (display->xdisplay))
|
|
|
|
{
|
|
|
|
XEvent next_event;
|
|
|
|
|
|
|
|
XPeekEvent (display->xdisplay, &next_event);
|
|
|
|
|
|
|
|
if (next_event.type == MappingNotify &&
|
|
|
|
next_event.xmapping.request == event->xmapping.request)
|
|
|
|
ignore_current = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ignore_current)
|
|
|
|
{
|
|
|
|
/* Let XLib know that there is a new keyboard mapping.
|
|
|
|
*/
|
|
|
|
XRefreshKeyboardMapping (&event->xmapping);
|
|
|
|
meta_display_process_mapping_event (display, event);
|
|
|
|
}
|
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
|
|
|
default:
|
2003-01-28 10:07:43 -05:00
|
|
|
#ifdef HAVE_XKB
|
|
|
|
if (event->type == display->xkb_base_event_type)
|
|
|
|
{
|
|
|
|
XkbAnyEvent *xkb_ev = (XkbAnyEvent *) event;
|
|
|
|
|
|
|
|
switch (xkb_ev->xkb_type)
|
|
|
|
{
|
|
|
|
case XkbBellNotify:
|
2006-01-20 17:08:52 -05:00
|
|
|
if (XSERVER_TIME_IS_BEFORE(display->last_bell_time,
|
|
|
|
xkb_ev->time - 1000))
|
|
|
|
{
|
|
|
|
display->last_bell_time = xkb_ev->time;
|
|
|
|
meta_bell_notify (display, xkb_ev);
|
|
|
|
}
|
2003-01-28 10:07:43 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2001-05-30 11:36:31 -04:00
|
|
|
break;
|
2001-06-02 21:33:27 -04:00
|
|
|
}
|
2001-06-19 23:01:26 -04:00
|
|
|
|
2006-02-16 15:26:05 -05:00
|
|
|
if (display->compositor)
|
|
|
|
{
|
|
|
|
meta_compositor_process_event (display->compositor,
|
|
|
|
event,
|
|
|
|
window);
|
|
|
|
}
|
2003-12-25 19:05:26 -05:00
|
|
|
|
2002-01-03 18:28:19 -05:00
|
|
|
display->current_time = CurrentTime;
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
return filter_out_event;
|
2001-05-30 11:36:31 -04:00
|
|
|
}
|
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
/* Return the window this has to do with, if any, rather
|
|
|
|
* than the frame or root window that was selecting
|
|
|
|
* for substructure
|
|
|
|
*/
|
|
|
|
static Window
|
|
|
|
event_get_modified_window (MetaDisplay *display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case KeyPress:
|
|
|
|
case KeyRelease:
|
|
|
|
case ButtonPress:
|
|
|
|
case ButtonRelease:
|
|
|
|
case MotionNotify:
|
|
|
|
case FocusIn:
|
|
|
|
case FocusOut:
|
|
|
|
case KeymapNotify:
|
|
|
|
case Expose:
|
|
|
|
case GraphicsExpose:
|
|
|
|
case NoExpose:
|
|
|
|
case VisibilityNotify:
|
|
|
|
case ResizeRequest:
|
|
|
|
case PropertyNotify:
|
|
|
|
case SelectionClear:
|
|
|
|
case SelectionRequest:
|
|
|
|
case SelectionNotify:
|
|
|
|
case ColormapNotify:
|
|
|
|
case ClientMessage:
|
2001-06-04 00:58:22 -04:00
|
|
|
case EnterNotify:
|
|
|
|
case LeaveNotify:
|
2001-06-02 21:33:27 -04:00
|
|
|
return event->xany.window;
|
2001-06-04 00:58:22 -04:00
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
case CreateNotify:
|
|
|
|
return event->xcreatewindow.window;
|
|
|
|
|
|
|
|
case DestroyNotify:
|
|
|
|
return event->xdestroywindow.window;
|
|
|
|
|
|
|
|
case UnmapNotify:
|
|
|
|
return event->xunmap.window;
|
|
|
|
|
|
|
|
case MapNotify:
|
|
|
|
return event->xmap.window;
|
|
|
|
|
|
|
|
case MapRequest:
|
|
|
|
return event->xmaprequest.window;
|
|
|
|
|
|
|
|
case ReparentNotify:
|
|
|
|
return event->xreparent.window;
|
|
|
|
|
|
|
|
case ConfigureNotify:
|
|
|
|
return event->xconfigure.window;
|
|
|
|
|
|
|
|
case ConfigureRequest:
|
|
|
|
return event->xconfigurerequest.window;
|
|
|
|
|
|
|
|
case GravityNotify:
|
|
|
|
return event->xgravity.window;
|
|
|
|
|
|
|
|
case CirculateNotify:
|
|
|
|
return event->xcirculate.window;
|
|
|
|
|
|
|
|
case CirculateRequest:
|
|
|
|
return event->xcirculaterequest.window;
|
|
|
|
|
|
|
|
case MappingNotify:
|
|
|
|
return None;
|
|
|
|
|
|
|
|
default:
|
2003-01-05 02:51:02 -05:00
|
|
|
#ifdef HAVE_SHAPE
|
|
|
|
if (META_DISPLAY_HAS_SHAPE (display) &&
|
|
|
|
event->type == (display->shape_event_base + ShapeNotify))
|
|
|
|
{
|
|
|
|
XShapeEvent *sev = (XShapeEvent*) event;
|
|
|
|
return sev->window;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
return None;
|
|
|
|
}
|
|
|
|
}
|
2001-06-10 15:23:28 -04:00
|
|
|
|
2002-01-03 18:28:19 -05:00
|
|
|
static guint32
|
|
|
|
event_get_time (MetaDisplay *display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case KeyPress:
|
|
|
|
case KeyRelease:
|
|
|
|
return event->xkey.time;
|
|
|
|
|
|
|
|
case ButtonPress:
|
|
|
|
case ButtonRelease:
|
|
|
|
return event->xbutton.time;
|
|
|
|
|
|
|
|
case MotionNotify:
|
|
|
|
return event->xmotion.time;
|
|
|
|
|
|
|
|
case PropertyNotify:
|
|
|
|
return event->xproperty.time;
|
|
|
|
|
|
|
|
case SelectionClear:
|
|
|
|
case SelectionRequest:
|
|
|
|
case SelectionNotify:
|
|
|
|
return event->xselection.time;
|
|
|
|
|
|
|
|
case EnterNotify:
|
|
|
|
case LeaveNotify:
|
|
|
|
return event->xcrossing.time;
|
|
|
|
|
|
|
|
case FocusIn:
|
|
|
|
case FocusOut:
|
|
|
|
case KeymapNotify:
|
|
|
|
case Expose:
|
|
|
|
case GraphicsExpose:
|
|
|
|
case NoExpose:
|
|
|
|
case MapNotify:
|
|
|
|
case UnmapNotify:
|
|
|
|
case VisibilityNotify:
|
|
|
|
case ResizeRequest:
|
|
|
|
case ColormapNotify:
|
|
|
|
case ClientMessage:
|
|
|
|
case CreateNotify:
|
|
|
|
case DestroyNotify:
|
|
|
|
case MapRequest:
|
|
|
|
case ReparentNotify:
|
|
|
|
case ConfigureNotify:
|
|
|
|
case ConfigureRequest:
|
|
|
|
case GravityNotify:
|
|
|
|
case CirculateNotify:
|
|
|
|
case CirculateRequest:
|
|
|
|
case MappingNotify:
|
|
|
|
default:
|
|
|
|
return CurrentTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2002-01-05 22:15:49 -05:00
|
|
|
const char*
|
2002-03-02 10:26:07 -05:00
|
|
|
meta_event_detail_to_string (int d)
|
2001-06-10 15:23:28 -04:00
|
|
|
{
|
2001-06-18 02:11:53 -04:00
|
|
|
const char *detail = "???";
|
2001-06-10 15:23:28 -04:00
|
|
|
switch (d)
|
|
|
|
{
|
2002-01-05 22:15:49 -05:00
|
|
|
/* We are an ancestor in the A<->B focus change relationship */
|
2001-06-10 15:23:28 -04:00
|
|
|
case NotifyAncestor:
|
|
|
|
detail = "NotifyAncestor";
|
|
|
|
break;
|
|
|
|
case NotifyDetailNone:
|
|
|
|
detail = "NotifyDetailNone";
|
|
|
|
break;
|
2002-01-05 22:15:49 -05:00
|
|
|
/* We are a descendant in the A<->B focus change relationship */
|
2001-06-10 15:23:28 -04:00
|
|
|
case NotifyInferior:
|
|
|
|
detail = "NotifyInferior";
|
2002-01-05 22:15:49 -05:00
|
|
|
break;
|
2001-06-10 15:23:28 -04:00
|
|
|
case NotifyNonlinear:
|
|
|
|
detail = "NotifyNonlinear";
|
|
|
|
break;
|
|
|
|
case NotifyNonlinearVirtual:
|
|
|
|
detail = "NotifyNonlinearVirtual";
|
|
|
|
break;
|
|
|
|
case NotifyPointer:
|
|
|
|
detail = "NotifyPointer";
|
|
|
|
break;
|
|
|
|
case NotifyPointerRoot:
|
|
|
|
detail = "NotifyPointerRoot";
|
|
|
|
break;
|
|
|
|
case NotifyVirtual:
|
|
|
|
detail = "NotifyVirtual";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return detail;
|
|
|
|
}
|
2002-12-09 22:23:04 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2001-06-10 15:23:28 -04:00
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2002-01-05 22:15:49 -05:00
|
|
|
const char*
|
2002-03-02 10:26:07 -05:00
|
|
|
meta_event_mode_to_string (int m)
|
2001-06-10 15:23:28 -04:00
|
|
|
{
|
2001-06-18 02:11:53 -04:00
|
|
|
const char *mode = "???";
|
2001-06-10 15:23:28 -04:00
|
|
|
switch (m)
|
|
|
|
{
|
|
|
|
case NotifyNormal:
|
|
|
|
mode = "NotifyNormal";
|
|
|
|
break;
|
|
|
|
case NotifyGrab:
|
|
|
|
mode = "NotifyGrab";
|
|
|
|
break;
|
|
|
|
case NotifyUngrab:
|
|
|
|
mode = "NotifyUngrab";
|
|
|
|
break;
|
2002-01-05 22:15:49 -05:00
|
|
|
/* not sure any X implementations are missing this, but
|
|
|
|
* it seems to be absent from some docs.
|
|
|
|
*/
|
|
|
|
#ifdef NotifyWhileGrabbed
|
|
|
|
case NotifyWhileGrabbed:
|
|
|
|
mode = "NotifyWhileGrabbed";
|
|
|
|
break;
|
|
|
|
#endif
|
2001-06-10 15:23:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return mode;
|
|
|
|
}
|
2002-12-09 22:23:04 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2001-06-10 15:23:28 -04:00
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2002-03-11 23:34:17 -05:00
|
|
|
static const char*
|
2002-03-10 13:36:08 -05:00
|
|
|
stack_mode_to_string (int mode)
|
|
|
|
{
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case Above:
|
|
|
|
return "Above";
|
|
|
|
case Below:
|
|
|
|
return "Below";
|
|
|
|
case TopIf:
|
|
|
|
return "TopIf";
|
|
|
|
case BottomIf:
|
|
|
|
return "BottomIf";
|
|
|
|
case Opposite:
|
|
|
|
return "Opposite";
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
}
|
2002-12-09 22:23:04 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-03-10 13:36:08 -05:00
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2001-07-25 23:58:24 -04:00
|
|
|
static char*
|
|
|
|
key_event_description (Display *xdisplay,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
KeySym keysym;
|
2002-06-15 23:03:08 -04:00
|
|
|
const char *str;
|
2001-07-25 23:58:24 -04:00
|
|
|
|
|
|
|
keysym = XKeycodeToKeysym (xdisplay, event->xkey.keycode, 0);
|
|
|
|
|
2002-06-15 23:03:08 -04:00
|
|
|
str = XKeysymToString (keysym);
|
|
|
|
|
2001-07-25 23:58:24 -04:00
|
|
|
return g_strdup_printf ("Key '%s' state 0x%x",
|
2002-12-19 15:18:54 -05:00
|
|
|
str ? str : "none", event->xkey.state);
|
2001-07-25 23:58:24 -04:00
|
|
|
}
|
2002-12-09 22:23:04 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
|
|
|
|
|
|
|
#ifdef HAVE_XSYNC
|
|
|
|
#ifdef WITH_VERBOSE_MODE
|
|
|
|
static gint64
|
|
|
|
sync_value_to_64 (const XSyncValue *value)
|
|
|
|
{
|
|
|
|
gint64 v;
|
|
|
|
|
|
|
|
v = XSyncValueLow32 (*value);
|
|
|
|
v |= (((gint64)XSyncValueHigh32 (*value)) << 32);
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
|
|
|
|
|
|
|
#ifdef WITH_VERBOSE_MODE
|
|
|
|
static const char*
|
|
|
|
alarm_state_to_string (XSyncAlarmState state)
|
|
|
|
{
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case XSyncAlarmActive:
|
|
|
|
return "Active";
|
|
|
|
case XSyncAlarmInactive:
|
|
|
|
return "Inactive";
|
|
|
|
case XSyncAlarmDestroyed:
|
|
|
|
return "Destroyed";
|
|
|
|
default:
|
|
|
|
return "(unknown)";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2001-07-25 23:58:24 -04:00
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
#endif /* HAVE_XSYNC */
|
|
|
|
|
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2001-05-30 11:36:31 -04:00
|
|
|
static void
|
|
|
|
meta_spew_event (MetaDisplay *display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
2002-02-07 22:34:26 -05:00
|
|
|
const char *name = NULL;
|
|
|
|
char *extra = NULL;
|
|
|
|
char *winname;
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
2003-03-23 16:54:48 -05:00
|
|
|
if (!meta_is_verbose())
|
|
|
|
return;
|
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
/* filter overnumerous events */
|
|
|
|
if (event->type == Expose || event->type == MotionNotify ||
|
|
|
|
event->type == NoExpose)
|
|
|
|
return;
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case KeyPress:
|
|
|
|
name = "KeyPress";
|
|
|
|
extra = key_event_description (display->xdisplay, event);
|
|
|
|
break;
|
|
|
|
case KeyRelease:
|
|
|
|
name = "KeyRelease";
|
|
|
|
extra = key_event_description (display->xdisplay, event);
|
|
|
|
break;
|
|
|
|
case ButtonPress:
|
|
|
|
name = "ButtonPress";
|
2006-01-20 17:03:56 -05:00
|
|
|
extra = g_strdup_printf ("button %u state 0x%x x %d y %d root 0x%lx same_screen %d",
|
2002-10-11 14:42:40 -04:00
|
|
|
event->xbutton.button,
|
|
|
|
event->xbutton.state,
|
|
|
|
event->xbutton.x,
|
|
|
|
event->xbutton.y,
|
|
|
|
event->xbutton.root,
|
|
|
|
event->xbutton.same_screen);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case ButtonRelease:
|
|
|
|
name = "ButtonRelease";
|
2006-01-20 17:03:56 -05:00
|
|
|
extra = g_strdup_printf ("button %u state 0x%x x %d y %d root 0x%lx same_screen %d",
|
2002-10-11 14:42:40 -04:00
|
|
|
event->xbutton.button,
|
|
|
|
event->xbutton.state,
|
|
|
|
event->xbutton.x,
|
|
|
|
event->xbutton.y,
|
|
|
|
event->xbutton.root,
|
|
|
|
event->xbutton.same_screen);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case MotionNotify:
|
|
|
|
name = "MotionNotify";
|
2002-02-24 14:58:27 -05:00
|
|
|
extra = g_strdup_printf ("win: 0x%lx x: %d y: %d",
|
|
|
|
event->xmotion.window,
|
|
|
|
event->xmotion.x,
|
|
|
|
event->xmotion.y);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case EnterNotify:
|
|
|
|
name = "EnterNotify";
|
2002-08-20 16:18:18 -04:00
|
|
|
extra = g_strdup_printf ("win: 0x%lx root: 0x%lx subwindow: 0x%lx mode: %s detail: %s focus: %d x: %d y: %d",
|
2002-02-07 22:34:26 -05:00
|
|
|
event->xcrossing.window,
|
|
|
|
event->xcrossing.root,
|
|
|
|
event->xcrossing.subwindow,
|
2002-03-02 10:26:07 -05:00
|
|
|
meta_event_mode_to_string (event->xcrossing.mode),
|
|
|
|
meta_event_detail_to_string (event->xcrossing.detail),
|
2002-08-20 16:18:18 -04:00
|
|
|
event->xcrossing.focus,
|
|
|
|
event->xcrossing.x,
|
|
|
|
event->xcrossing.y);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case LeaveNotify:
|
|
|
|
name = "LeaveNotify";
|
2002-08-20 16:18:18 -04:00
|
|
|
extra = g_strdup_printf ("win: 0x%lx root: 0x%lx subwindow: 0x%lx mode: %s detail: %s focus: %d x: %d y: %d",
|
2002-02-07 22:34:26 -05:00
|
|
|
event->xcrossing.window,
|
|
|
|
event->xcrossing.root,
|
|
|
|
event->xcrossing.subwindow,
|
2002-03-02 10:26:07 -05:00
|
|
|
meta_event_mode_to_string (event->xcrossing.mode),
|
|
|
|
meta_event_detail_to_string (event->xcrossing.detail),
|
2002-08-20 16:18:18 -04:00
|
|
|
event->xcrossing.focus,
|
|
|
|
event->xcrossing.x,
|
|
|
|
event->xcrossing.y);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case FocusIn:
|
|
|
|
name = "FocusIn";
|
|
|
|
extra = g_strdup_printf ("detail: %s mode: %s\n",
|
2002-03-02 10:26:07 -05:00
|
|
|
meta_event_detail_to_string (event->xfocus.detail),
|
|
|
|
meta_event_mode_to_string (event->xfocus.mode));
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case FocusOut:
|
|
|
|
name = "FocusOut";
|
|
|
|
extra = g_strdup_printf ("detail: %s mode: %s\n",
|
2002-03-02 10:26:07 -05:00
|
|
|
meta_event_detail_to_string (event->xfocus.detail),
|
|
|
|
meta_event_mode_to_string (event->xfocus.mode));
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case KeymapNotify:
|
|
|
|
name = "KeymapNotify";
|
|
|
|
break;
|
|
|
|
case Expose:
|
|
|
|
name = "Expose";
|
|
|
|
break;
|
|
|
|
case GraphicsExpose:
|
|
|
|
name = "GraphicsExpose";
|
|
|
|
break;
|
|
|
|
case NoExpose:
|
|
|
|
name = "NoExpose";
|
|
|
|
break;
|
|
|
|
case VisibilityNotify:
|
|
|
|
name = "VisibilityNotify";
|
|
|
|
break;
|
|
|
|
case CreateNotify:
|
|
|
|
name = "CreateNotify";
|
2003-12-25 21:42:38 -05:00
|
|
|
extra = g_strdup_printf ("parent: 0x%lx window: 0x%lx",
|
|
|
|
event->xcreatewindow.parent,
|
|
|
|
event->xcreatewindow.window);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case DestroyNotify:
|
|
|
|
name = "DestroyNotify";
|
2003-12-25 21:42:38 -05:00
|
|
|
extra = g_strdup_printf ("event: 0x%lx window: 0x%lx",
|
|
|
|
event->xdestroywindow.event,
|
|
|
|
event->xdestroywindow.window);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case UnmapNotify:
|
|
|
|
name = "UnmapNotify";
|
2002-09-22 21:43:20 -04:00
|
|
|
extra = g_strdup_printf ("event: 0x%lx window: 0x%lx from_configure: %d",
|
|
|
|
event->xunmap.event,
|
|
|
|
event->xunmap.window,
|
|
|
|
event->xunmap.from_configure);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case MapNotify:
|
|
|
|
name = "MapNotify";
|
2002-09-22 21:43:20 -04:00
|
|
|
extra = g_strdup_printf ("event: 0x%lx window: 0x%lx override_redirect: %d",
|
|
|
|
event->xmap.event,
|
|
|
|
event->xmap.window,
|
|
|
|
event->xmap.override_redirect);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case MapRequest:
|
|
|
|
name = "MapRequest";
|
2003-01-21 17:40:25 -05:00
|
|
|
extra = g_strdup_printf ("window: 0x%lx parent: 0x%lx\n",
|
|
|
|
event->xmaprequest.window,
|
|
|
|
event->xmaprequest.parent);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case ReparentNotify:
|
|
|
|
name = "ReparentNotify";
|
2003-12-25 21:42:38 -05:00
|
|
|
extra = g_strdup_printf ("window: 0x%lx parent: 0x%lx event: 0x%lx\n",
|
|
|
|
event->xreparent.window,
|
|
|
|
event->xreparent.parent,
|
|
|
|
event->xreparent.event);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case ConfigureNotify:
|
|
|
|
name = "ConfigureNotify";
|
2002-09-22 21:43:20 -04:00
|
|
|
extra = g_strdup_printf ("x: %d y: %d w: %d h: %d above: 0x%lx override_redirect: %d",
|
2002-02-07 22:34:26 -05:00
|
|
|
event->xconfigure.x,
|
|
|
|
event->xconfigure.y,
|
|
|
|
event->xconfigure.width,
|
|
|
|
event->xconfigure.height,
|
2002-09-22 21:43:20 -04:00
|
|
|
event->xconfigure.above,
|
|
|
|
event->xconfigure.override_redirect);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case ConfigureRequest:
|
|
|
|
name = "ConfigureRequest";
|
2002-03-11 23:34:17 -05:00
|
|
|
extra = g_strdup_printf ("parent: 0x%lx window: 0x%lx x: %d %sy: %d %sw: %d %sh: %d %sborder: %d %sabove: %lx %sstackmode: %s %s",
|
2002-02-07 22:34:26 -05:00
|
|
|
event->xconfigurerequest.parent,
|
|
|
|
event->xconfigurerequest.window,
|
|
|
|
event->xconfigurerequest.x,
|
|
|
|
event->xconfigurerequest.value_mask &
|
|
|
|
CWX ? "" : "(unset) ",
|
|
|
|
event->xconfigurerequest.y,
|
|
|
|
event->xconfigurerequest.value_mask &
|
|
|
|
CWY ? "" : "(unset) ",
|
|
|
|
event->xconfigurerequest.width,
|
|
|
|
event->xconfigurerequest.value_mask &
|
|
|
|
CWWidth ? "" : "(unset) ",
|
|
|
|
event->xconfigurerequest.height,
|
|
|
|
event->xconfigurerequest.value_mask &
|
|
|
|
CWHeight ? "" : "(unset) ",
|
|
|
|
event->xconfigurerequest.border_width,
|
|
|
|
event->xconfigurerequest.value_mask &
|
2002-03-10 13:36:08 -05:00
|
|
|
CWBorderWidth ? "" : "(unset)",
|
|
|
|
event->xconfigurerequest.above,
|
|
|
|
event->xconfigurerequest.value_mask &
|
|
|
|
CWSibling ? "" : "(unset)",
|
|
|
|
stack_mode_to_string (event->xconfigurerequest.detail),
|
|
|
|
event->xconfigurerequest.value_mask &
|
|
|
|
CWStackMode ? "" : "(unset)");
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case GravityNotify:
|
|
|
|
name = "GravityNotify";
|
|
|
|
break;
|
|
|
|
case ResizeRequest:
|
|
|
|
name = "ResizeRequest";
|
2002-03-10 10:48:38 -05:00
|
|
|
extra = g_strdup_printf ("width = %d height = %d",
|
|
|
|
event->xresizerequest.width,
|
|
|
|
event->xresizerequest.height);
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
case CirculateNotify:
|
|
|
|
name = "CirculateNotify";
|
|
|
|
break;
|
|
|
|
case CirculateRequest:
|
|
|
|
name = "CirculateRequest";
|
|
|
|
break;
|
|
|
|
case PropertyNotify:
|
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
const char *state;
|
2001-06-10 23:24:20 -04:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
name = "PropertyNotify";
|
2001-06-10 23:24:20 -04:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
meta_error_trap_push (display);
|
|
|
|
str = XGetAtomName (display->xdisplay,
|
|
|
|
event->xproperty.atom);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, TRUE);
|
2002-02-07 22:34:26 -05:00
|
|
|
|
|
|
|
if (event->xproperty.state == PropertyNewValue)
|
|
|
|
state = "PropertyNewValue";
|
|
|
|
else if (event->xproperty.state == PropertyDelete)
|
|
|
|
state = "PropertyDelete";
|
|
|
|
else
|
|
|
|
state = "???";
|
2001-06-10 23:24:20 -04:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
extra = g_strdup_printf ("atom: %s state: %s",
|
|
|
|
str ? str : "(unknown atom)",
|
|
|
|
state);
|
2002-06-08 19:55:27 -04:00
|
|
|
meta_XFree (str);
|
2002-02-07 22:34:26 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SelectionClear:
|
|
|
|
name = "SelectionClear";
|
|
|
|
break;
|
|
|
|
case SelectionRequest:
|
|
|
|
name = "SelectionRequest";
|
|
|
|
break;
|
|
|
|
case SelectionNotify:
|
|
|
|
name = "SelectionNotify";
|
|
|
|
break;
|
|
|
|
case ColormapNotify:
|
|
|
|
name = "ColormapNotify";
|
|
|
|
break;
|
|
|
|
case ClientMessage:
|
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
name = "ClientMessage";
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
str = XGetAtomName (display->xdisplay,
|
|
|
|
event->xclient.message_type);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, TRUE);
|
2002-02-07 22:34:26 -05:00
|
|
|
extra = g_strdup_printf ("type: %s format: %d\n",
|
|
|
|
str ? str : "(unknown atom)",
|
|
|
|
event->xclient.format);
|
2002-06-08 19:55:27 -04:00
|
|
|
meta_XFree (str);
|
2002-02-07 22:34:26 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MappingNotify:
|
|
|
|
name = "MappingNotify";
|
|
|
|
break;
|
|
|
|
default:
|
2002-12-09 22:23:04 -05:00
|
|
|
#ifdef HAVE_XSYNC
|
|
|
|
if (META_DISPLAY_HAS_XSYNC (display) &&
|
|
|
|
event->type == (display->xsync_event_base + XSyncAlarmNotify))
|
|
|
|
{
|
|
|
|
XSyncAlarmNotifyEvent *aevent = (XSyncAlarmNotifyEvent*) event;
|
|
|
|
|
|
|
|
name = "XSyncAlarmNotify";
|
|
|
|
extra =
|
|
|
|
g_strdup_printf ("alarm: 0x%lx"
|
|
|
|
" counter_value: %" G_GINT64_FORMAT
|
|
|
|
" alarm_value: %" G_GINT64_FORMAT
|
|
|
|
" time: %u alarm state: %s",
|
|
|
|
aevent->alarm,
|
|
|
|
(gint64) sync_value_to_64 (&aevent->counter_value),
|
|
|
|
(gint64) sync_value_to_64 (&aevent->alarm_value),
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
(unsigned int)aevent->time,
|
2002-12-09 22:23:04 -05:00
|
|
|
alarm_state_to_string (aevent->state));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif /* HAVE_XSYNC */
|
2003-01-05 02:51:02 -05:00
|
|
|
#ifdef HAVE_SHAPE
|
|
|
|
if (META_DISPLAY_HAS_SHAPE (display) &&
|
|
|
|
event->type == (display->shape_event_base + ShapeNotify))
|
|
|
|
{
|
|
|
|
XShapeEvent *sev = (XShapeEvent*) event;
|
|
|
|
|
|
|
|
name = "ShapeNotify";
|
|
|
|
|
|
|
|
extra =
|
|
|
|
g_strdup_printf ("kind: %s "
|
2006-01-20 17:03:56 -05:00
|
|
|
"x: %d y: %d w: %u h: %u "
|
2003-01-05 02:51:02 -05:00
|
|
|
"shaped: %d",
|
|
|
|
sev->kind == ShapeBounding ?
|
|
|
|
"ShapeBounding" :
|
|
|
|
(sev->kind == ShapeClip ?
|
|
|
|
"ShapeClip" : "(unknown)"),
|
|
|
|
sev->x, sev->y, sev->width, sev->height,
|
|
|
|
sev->shaped);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif /* HAVE_SHAPE */
|
2002-12-09 22:23:04 -05:00
|
|
|
{
|
|
|
|
name = "(Unknown event)";
|
|
|
|
extra = g_strdup_printf ("type: %d", event->xany.type);
|
|
|
|
}
|
2002-02-07 22:34:26 -05:00
|
|
|
break;
|
|
|
|
}
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
screen = meta_display_screen_for_root (display, event->xany.window);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
if (screen)
|
|
|
|
winname = g_strdup_printf ("root %d", screen->number);
|
|
|
|
else
|
|
|
|
winname = g_strdup_printf ("0x%lx", event->xany.window);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
meta_topic (META_DEBUG_EVENTS,
|
2002-03-02 10:26:07 -05:00
|
|
|
"%s on %s%s %s %sserial %lu\n", name, winname,
|
2002-02-07 22:34:26 -05:00
|
|
|
extra ? ":" : "", extra ? extra : "",
|
2002-03-02 10:26:07 -05:00
|
|
|
event->xany.send_event ? "SEND " : "",
|
2002-02-07 22:34:26 -05:00
|
|
|
event->xany.serial);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
g_free (winname);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
if (extra)
|
|
|
|
g_free (extra);
|
2001-05-30 11:36:31 -04:00
|
|
|
}
|
2002-12-09 22:23:04 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2001-05-30 11:36:31 -04:00
|
|
|
|
|
|
|
MetaWindow*
|
2001-05-31 02:42:58 -04:00
|
|
|
meta_display_lookup_x_window (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
2001-05-30 11:36:31 -04:00
|
|
|
{
|
|
|
|
return g_hash_table_lookup (display->window_ids, &xwindow);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-05-31 02:42:58 -04:00
|
|
|
meta_display_register_x_window (MetaDisplay *display,
|
|
|
|
Window *xwindowp,
|
|
|
|
MetaWindow *window)
|
2001-05-30 11:36:31 -04:00
|
|
|
{
|
2001-05-31 02:42:58 -04:00
|
|
|
g_return_if_fail (g_hash_table_lookup (display->window_ids, xwindowp) == NULL);
|
2001-05-30 11:36:31 -04:00
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
g_hash_table_insert (display->window_ids, xwindowp, window);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_unregister_x_window (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
|
|
|
{
|
|
|
|
g_return_if_fail (g_hash_table_lookup (display->window_ids, &xwindow) != NULL);
|
|
|
|
|
|
|
|
g_hash_table_remove (display->window_ids, &xwindow);
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
|
|
|
|
/* Remove any pending pings */
|
|
|
|
remove_pending_pings_for_window (display, xwindow);
|
2001-05-30 11:36:31 -04:00
|
|
|
}
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2005-12-28 01:24:30 -05:00
|
|
|
gboolean
|
|
|
|
meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
|
|
|
{
|
|
|
|
gboolean is_a_no_focus_window = FALSE;
|
|
|
|
GSList *temp = display->screens;
|
|
|
|
while (temp != NULL) {
|
|
|
|
MetaScreen *screen = temp->data;
|
|
|
|
if (screen->no_focus_window == xwindow) {
|
|
|
|
is_a_no_focus_window = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
temp = temp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return is_a_no_focus_window;
|
|
|
|
}
|
|
|
|
|
2001-07-25 23:14:45 -04:00
|
|
|
Cursor
|
|
|
|
meta_display_create_x_cursor (MetaDisplay *display,
|
|
|
|
MetaCursor cursor)
|
|
|
|
{
|
|
|
|
Cursor xcursor;
|
|
|
|
guint glyph;
|
|
|
|
|
|
|
|
switch (cursor)
|
|
|
|
{
|
|
|
|
case META_CURSOR_DEFAULT:
|
|
|
|
glyph = XC_left_ptr;
|
|
|
|
break;
|
|
|
|
case META_CURSOR_NORTH_RESIZE:
|
|
|
|
glyph = XC_top_side;
|
|
|
|
break;
|
|
|
|
case META_CURSOR_SOUTH_RESIZE:
|
|
|
|
glyph = XC_bottom_side;
|
|
|
|
break;
|
|
|
|
case META_CURSOR_WEST_RESIZE:
|
|
|
|
glyph = XC_left_side;
|
|
|
|
break;
|
|
|
|
case META_CURSOR_EAST_RESIZE:
|
|
|
|
glyph = XC_right_side;
|
|
|
|
break;
|
|
|
|
case META_CURSOR_SE_RESIZE:
|
|
|
|
glyph = XC_bottom_right_corner;
|
|
|
|
break;
|
|
|
|
case META_CURSOR_SW_RESIZE:
|
|
|
|
glyph = XC_bottom_left_corner;
|
|
|
|
break;
|
|
|
|
case META_CURSOR_NE_RESIZE:
|
2002-01-19 18:59:11 -05:00
|
|
|
glyph = XC_top_right_corner;
|
2001-07-25 23:14:45 -04:00
|
|
|
break;
|
|
|
|
case META_CURSOR_NW_RESIZE:
|
2002-01-19 18:59:11 -05:00
|
|
|
glyph = XC_top_left_corner;
|
2001-07-25 23:14:45 -04:00
|
|
|
break;
|
2006-05-22 12:12:28 -04:00
|
|
|
case META_CURSOR_MOVE_OR_RESIZE_WINDOW:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
glyph = XC_fleur;
|
|
|
|
break;
|
2002-10-25 19:35:50 -04:00
|
|
|
case META_CURSOR_BUSY:
|
|
|
|
glyph = XC_watch;
|
|
|
|
break;
|
|
|
|
|
2001-07-25 23:14:45 -04:00
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
glyph = 0; /* silence compiler */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
xcursor = XCreateFontCursor (display->xdisplay, glyph);
|
|
|
|
|
|
|
|
return xcursor;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Cursor
|
|
|
|
xcursor_for_op (MetaDisplay *display,
|
|
|
|
MetaGrabOp op)
|
|
|
|
{
|
|
|
|
MetaCursor cursor = META_CURSOR_DEFAULT;
|
|
|
|
|
2002-02-24 14:58:27 -05:00
|
|
|
switch (op)
|
2001-07-25 23:14:45 -04:00
|
|
|
{
|
|
|
|
case META_GRAB_OP_RESIZING_SE:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
2001-07-25 23:14:45 -04:00
|
|
|
cursor = META_CURSOR_SE_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_S:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
2001-07-25 23:14:45 -04:00
|
|
|
cursor = META_CURSOR_SOUTH_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_SW:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
2001-07-25 23:14:45 -04:00
|
|
|
cursor = META_CURSOR_SW_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_N:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
2001-07-25 23:14:45 -04:00
|
|
|
cursor = META_CURSOR_NORTH_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_NE:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
2001-07-25 23:14:45 -04:00
|
|
|
cursor = META_CURSOR_NE_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_NW:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
2001-07-25 23:14:45 -04:00
|
|
|
cursor = META_CURSOR_NW_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_W:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
2001-07-25 23:14:45 -04:00
|
|
|
cursor = META_CURSOR_WEST_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_RESIZING_E:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
2001-07-25 23:14:45 -04:00
|
|
|
cursor = META_CURSOR_EAST_RESIZE;
|
|
|
|
break;
|
2003-08-16 10:36:56 -04:00
|
|
|
case META_GRAB_OP_MOVING:
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_MOVING:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
2006-05-22 12:12:28 -04:00
|
|
|
cursor = META_CURSOR_MOVE_OR_RESIZE_WINDOW;
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
break;
|
2001-07-25 23:14:45 -04:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-08-23 14:00:40 -04:00
|
|
|
if (cursor == META_CURSOR_DEFAULT)
|
|
|
|
return None;
|
2001-07-25 23:14:45 -04:00
|
|
|
return meta_display_create_x_cursor (display, cursor);
|
|
|
|
}
|
|
|
|
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
void
|
|
|
|
meta_display_set_grab_op_cursor (MetaDisplay *display,
|
2002-08-14 12:51:13 -04:00
|
|
|
MetaScreen *screen,
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
MetaGrabOp op,
|
|
|
|
gboolean change_pointer,
|
|
|
|
Window grab_xwindow,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
{
|
|
|
|
Cursor cursor;
|
|
|
|
|
|
|
|
cursor = xcursor_for_op (display, op);
|
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
#define GRAB_MASK (PointerMotionMask | \
|
|
|
|
ButtonPressMask | ButtonReleaseMask | \
|
2002-12-09 16:07:27 -05:00
|
|
|
EnterWindowMask | LeaveWindowMask)
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
|
|
|
|
if (change_pointer)
|
|
|
|
{
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_push_with_return (display);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
XChangeActivePointerGrab (display->xdisplay,
|
|
|
|
GRAB_MASK,
|
|
|
|
cursor,
|
|
|
|
timestamp);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
|
|
|
"Changed pointer with XChangeActivePointerGrab()\n");
|
2002-10-21 17:44:35 -04:00
|
|
|
|
|
|
|
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
|
|
|
"Error trapped from XChangeActivePointerGrab()\n");
|
|
|
|
if (display->grab_have_pointer)
|
|
|
|
display->grab_have_pointer = FALSE;
|
|
|
|
}
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-08-15 01:14:49 -04:00
|
|
|
g_assert (screen != NULL);
|
2002-10-21 17:44:35 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
if (XGrabPointer (display->xdisplay,
|
|
|
|
grab_xwindow,
|
|
|
|
False,
|
|
|
|
GRAB_MASK,
|
|
|
|
GrabModeAsync, GrabModeAsync,
|
2002-08-14 12:51:13 -04:00
|
|
|
screen->xroot,
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
cursor,
|
|
|
|
timestamp) == GrabSuccess)
|
|
|
|
{
|
|
|
|
display->grab_have_pointer = TRUE;
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"XGrabPointer() returned GrabSuccess time %u\n",
|
2003-01-21 17:40:25 -05:00
|
|
|
timestamp);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"XGrabPointer() failed time %u\n",
|
2003-01-21 17:40:25 -05:00
|
|
|
timestamp);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
}
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, TRUE);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
}
|
2002-10-21 17:44:35 -04:00
|
|
|
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
#undef GRAB_MASK
|
|
|
|
|
2002-08-23 14:00:40 -04:00
|
|
|
if (cursor != None)
|
|
|
|
XFreeCursor (display->xdisplay, cursor);
|
Patch to provide extra cues to the user when using window menu move and
2002-08-08 Craig Black <blackc@speakeasy.net>
Patch to provide extra cues to the user when using
window menu move and resize, #85724.
* src/common.h: add new cursors
* src/display.c: (grab_op_is_mouse)
(meta_display_create_x_cursor), (xcursor_for_op),
(meta_display_set_grab_op_cursor),
(meta_display_begin_grab_op):
The keyboard move and resize grab ops now also use the mouse.
Allow the grab cursor to be changed during the grab op.
Hold onto the initial grab position in case of reset.
* src/display.h: save the initial grab position
* src/keybindings.c: (process_keyboard_move_grab),
(process_keyboard_resize_grab), (handle_begin_move),
(handle_begin_resize):
The keyboard move and resize grab ops now also use the mouse.
* src/window.c: (meta_window_client_message), (menu_callback),
(update_move), (update_resize),
(meta_window_handle_mouse_grab_op_event), (warp_pointer),
(meta_window_warp_pointer), (meta_window_begin_grab_op),
(meta_window_update_resize_grab_op):
When moving or resizing a window use the last grab position
in computing change increment.
Provide support for warping the mouse pointer.
* src/window.h: new warp pointer and grab op helper functions
2002-08-09 00:27:23 -04:00
|
|
|
}
|
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
gboolean
|
|
|
|
meta_display_begin_grab_op (MetaDisplay *display,
|
2002-06-27 01:08:32 -04:00
|
|
|
MetaScreen *screen,
|
2001-07-11 02:22:00 -04:00
|
|
|
MetaWindow *window,
|
|
|
|
MetaGrabOp op,
|
|
|
|
gboolean pointer_already_grabbed,
|
2003-11-24 13:09:47 -05:00
|
|
|
int event_serial,
|
2001-07-11 02:22:00 -04:00
|
|
|
int button,
|
|
|
|
gulong modmask,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp,
|
2001-07-11 02:22:00 -04:00
|
|
|
int root_x,
|
|
|
|
int root_y)
|
|
|
|
{
|
2002-03-02 10:26:07 -05:00
|
|
|
Window grab_xwindow;
|
2001-07-25 23:14:45 -04:00
|
|
|
|
2006-02-25 11:54:39 -05:00
|
|
|
if (grab_op_is_mouse (op) && meta_grab_op_is_moving (op))
|
|
|
|
{
|
|
|
|
if (display->compositor)
|
|
|
|
{
|
|
|
|
meta_compositor_begin_move (display->compositor,
|
|
|
|
window, &window->rect,
|
|
|
|
root_x, root_y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-24 14:58:27 -05:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
2006-01-20 17:03:56 -05:00
|
|
|
"Doing grab op %u on window %s button %d pointer already grabbed: %d pointer pos %d,%d\n",
|
2003-10-12 02:25:38 -04:00
|
|
|
op, window ? window->desc : "none", button, pointer_already_grabbed,
|
|
|
|
root_x, root_y);
|
2001-07-11 02:22:00 -04:00
|
|
|
|
|
|
|
if (display->grab_op != META_GRAB_OP_NONE)
|
|
|
|
{
|
2006-01-20 17:03:56 -05:00
|
|
|
meta_warning ("Attempt to perform window operation %u on window %s when operation %u on %s already in effect\n",
|
2002-12-19 15:18:54 -05:00
|
|
|
op, window ? window->desc : "none", display->grab_op,
|
|
|
|
display->grab_window ? display->grab_window->desc : "none");
|
2001-07-11 02:22:00 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-07-25 23:14:45 -04:00
|
|
|
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
if (window &&
|
|
|
|
(meta_grab_op_is_moving (op) || meta_grab_op_is_resizing (op)))
|
|
|
|
{
|
|
|
|
if (meta_prefs_get_raise_on_click ())
|
|
|
|
meta_window_raise (window);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
display->grab_initial_x = root_x;
|
|
|
|
display->grab_initial_y = root_y;
|
|
|
|
display->grab_threshold_movement_reached = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-12 02:25:38 -04:00
|
|
|
/* We'll ignore any events < this serial. */
|
2003-11-24 13:09:47 -05:00
|
|
|
if (pointer_already_grabbed)
|
|
|
|
display->grab_start_serial = event_serial;
|
|
|
|
else
|
|
|
|
display->grab_start_serial = XNextRequest (display->xdisplay);
|
2003-10-12 02:25:38 -04:00
|
|
|
|
2002-06-30 23:20:29 -04:00
|
|
|
/* FIXME:
|
|
|
|
* If we have no MetaWindow we do our best
|
|
|
|
* and try to do the grab on the RootWindow.
|
|
|
|
* This will fail if anyone else has any
|
|
|
|
* key grab on the RootWindow.
|
|
|
|
*/
|
2002-06-27 01:08:32 -04:00
|
|
|
if (window)
|
|
|
|
grab_xwindow = window->frame ? window->frame->xwindow : window->xwindow;
|
|
|
|
else
|
|
|
|
grab_xwindow = screen->xroot;
|
2003-10-11 00:27:06 -04:00
|
|
|
|
|
|
|
display->grab_have_pointer = FALSE;
|
2002-03-02 10:26:07 -05:00
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
if (pointer_already_grabbed)
|
2001-07-25 23:14:45 -04:00
|
|
|
display->grab_have_pointer = TRUE;
|
2003-10-12 02:25:38 -04:00
|
|
|
|
2002-08-14 12:51:13 -04:00
|
|
|
meta_display_set_grab_op_cursor (display, screen, op, FALSE, grab_xwindow,
|
|
|
|
timestamp);
|
2001-07-11 02:22:00 -04:00
|
|
|
|
|
|
|
if (!display->grab_have_pointer)
|
|
|
|
{
|
2002-02-24 14:58:27 -05:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
|
|
|
"XGrabPointer() failed\n");
|
2001-07-11 02:22:00 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2006-08-21 14:38:21 -04:00
|
|
|
/* Grab keys for keyboard ops and mouse move/resizes; see #126497 */
|
|
|
|
if (grab_op_is_keyboard (op) || grab_op_is_mouse_only (op))
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
2002-06-27 01:08:32 -04:00
|
|
|
if (window)
|
|
|
|
display->grab_have_keyboard =
|
2006-08-21 14:38:21 -04:00
|
|
|
meta_window_grab_all_keys (window, timestamp);
|
2002-06-27 01:08:32 -04:00
|
|
|
|
2002-06-30 23:20:29 -04:00
|
|
|
else
|
|
|
|
display->grab_have_keyboard =
|
2006-09-09 16:19:56 -04:00
|
|
|
meta_screen_grab_all_keys (screen, timestamp);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
if (!display->grab_have_keyboard)
|
|
|
|
{
|
2002-02-24 14:58:27 -05:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
2002-06-30 23:20:29 -04:00
|
|
|
"grabbing all keys failed, ungrabbing pointer\n");
|
|
|
|
XUngrabPointer (display->xdisplay, CurrentTime);
|
|
|
|
display->grab_have_pointer = FALSE;
|
2001-07-11 02:22:00 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
display->grab_op = op;
|
|
|
|
display->grab_window = window;
|
2002-06-27 01:08:32 -04:00
|
|
|
display->grab_screen = screen;
|
2002-03-02 10:26:07 -05:00
|
|
|
display->grab_xwindow = grab_xwindow;
|
2001-07-11 02:22:00 -04:00
|
|
|
display->grab_button = button;
|
2002-04-28 00:52:26 -04:00
|
|
|
display->grab_mask = modmask;
|
2003-10-12 02:25:38 -04:00
|
|
|
display->grab_anchor_root_x = root_x;
|
|
|
|
display->grab_anchor_root_y = root_y;
|
2002-12-09 22:23:04 -05:00
|
|
|
display->grab_latest_motion_x = root_x;
|
|
|
|
display->grab_latest_motion_y = root_y;
|
2002-08-10 01:27:17 -04:00
|
|
|
display->grab_last_moveresize_time.tv_sec = 0;
|
|
|
|
display->grab_last_moveresize_time.tv_usec = 0;
|
2003-01-21 23:54:04 -05:00
|
|
|
display->grab_motion_notify_time = 0;
|
2005-01-24 12:39:26 -05:00
|
|
|
display->grab_old_window_stacking = NULL;
|
2002-12-09 22:23:04 -05:00
|
|
|
#ifdef HAVE_XSYNC
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
display->grab_sync_request_alarm = None;
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
display->grab_last_user_action_was_snap = FALSE;
|
2002-12-09 22:23:04 -05:00
|
|
|
#endif
|
2003-10-12 02:25:38 -04:00
|
|
|
display->grab_was_cancelled = FALSE;
|
2002-12-09 22:23:04 -05:00
|
|
|
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
if (display->grab_resize_timeout_id)
|
|
|
|
{
|
|
|
|
g_source_remove (display->grab_resize_timeout_id);
|
|
|
|
display->grab_resize_timeout_id = 0;
|
|
|
|
}
|
|
|
|
|
2002-06-27 01:08:32 -04:00
|
|
|
if (display->grab_window)
|
|
|
|
{
|
|
|
|
display->grab_initial_window_pos = display->grab_window->rect;
|
|
|
|
meta_window_get_position (display->grab_window,
|
|
|
|
&display->grab_initial_window_pos.x,
|
|
|
|
&display->grab_initial_window_pos.y);
|
2003-10-12 02:25:38 -04:00
|
|
|
display->grab_anchor_window_pos = display->grab_initial_window_pos;
|
2002-12-09 22:23:04 -05:00
|
|
|
|
2003-10-12 02:25:38 -04:00
|
|
|
display->grab_wireframe_active =
|
2005-01-26 03:43:38 -05:00
|
|
|
(meta_prefs_get_reduced_resources () && !meta_prefs_get_gnome_accessibility ()) &&
|
2003-10-12 02:25:38 -04:00
|
|
|
(meta_grab_op_is_resizing (display->grab_op) ||
|
|
|
|
meta_grab_op_is_moving (display->grab_op));
|
|
|
|
|
|
|
|
if (display->grab_wireframe_active)
|
|
|
|
{
|
|
|
|
meta_window_calc_showing (display->grab_window);
|
2005-05-26 15:58:17 -04:00
|
|
|
meta_window_begin_wireframe (window);
|
2003-10-12 02:25:38 -04:00
|
|
|
}
|
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
#ifdef HAVE_XSYNC
|
2003-10-12 02:25:38 -04:00
|
|
|
if (!display->grab_wireframe_active &&
|
|
|
|
meta_grab_op_is_resizing (display->grab_op) &&
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
display->grab_window->sync_request_counter != None)
|
2002-12-09 22:23:04 -05:00
|
|
|
{
|
|
|
|
XSyncAlarmAttributes values;
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
XSyncValue init;
|
2002-12-09 22:23:04 -05:00
|
|
|
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
meta_error_trap_push_with_return (display);
|
2002-12-09 22:23:04 -05:00
|
|
|
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
/* Set the counter to 0, so we know that the application's
|
|
|
|
* responses to the client messages will always trigger
|
|
|
|
* a PositiveTransition
|
|
|
|
*/
|
|
|
|
|
|
|
|
XSyncIntToValue (&init, 0);
|
|
|
|
XSyncSetCounter (display->xdisplay,
|
|
|
|
display->grab_window->sync_request_counter, init);
|
|
|
|
|
|
|
|
display->grab_window->sync_request_serial = 0;
|
|
|
|
display->grab_window->sync_request_time.tv_sec = 0;
|
|
|
|
display->grab_window->sync_request_time.tv_usec = 0;
|
|
|
|
|
|
|
|
values.trigger.counter = display->grab_window->sync_request_counter;
|
|
|
|
values.trigger.value_type = XSyncAbsolute;
|
|
|
|
values.trigger.test_type = XSyncPositiveTransition;
|
|
|
|
XSyncIntToValue (&values.trigger.wait_value,
|
|
|
|
display->grab_window->sync_request_serial + 1);
|
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
/* After triggering, increment test_value by this.
|
|
|
|
* (NOT wait_value above)
|
|
|
|
*/
|
|
|
|
XSyncIntToValue (&values.delta, 1);
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
/* we want events (on by default anyway) */
|
|
|
|
values.events = True;
|
|
|
|
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
display->grab_sync_request_alarm = XSyncCreateAlarm (display->xdisplay,
|
2002-12-09 22:23:04 -05:00
|
|
|
XSyncCACounter |
|
|
|
|
XSyncCAValueType |
|
|
|
|
XSyncCAValue |
|
|
|
|
XSyncCATestType |
|
|
|
|
XSyncCADelta |
|
|
|
|
XSyncCAEvents,
|
|
|
|
&values);
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
|
2002-12-09 22:23:04 -05:00
|
|
|
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
display->grab_sync_request_alarm = None;
|
2002-12-09 22:23:04 -05:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_RESIZING,
|
|
|
|
"Created update alarm 0x%lx\n",
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
display->grab_sync_request_alarm);
|
2002-12-09 22:23:04 -05:00
|
|
|
}
|
|
|
|
#endif
|
2002-06-27 01:08:32 -04:00
|
|
|
}
|
2001-07-12 01:53:56 -04:00
|
|
|
|
2002-02-24 14:58:27 -05:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
2006-01-20 17:03:56 -05:00
|
|
|
"Grab op %u on window %s successful\n",
|
2002-06-27 01:08:32 -04:00
|
|
|
display->grab_op, window ? window->desc : "(null)");
|
2001-07-11 02:22:00 -04:00
|
|
|
|
2002-06-27 01:08:32 -04:00
|
|
|
g_assert (display->grab_window != NULL || display->grab_screen != NULL);
|
2001-07-11 02:22:00 -04:00
|
|
|
g_assert (display->grab_op != META_GRAB_OP_NONE);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
/* If this is a move or resize, cache the window edges for
|
|
|
|
* resistance/snapping
|
|
|
|
*/
|
|
|
|
if (meta_grab_op_is_resizing (display->grab_op) ||
|
|
|
|
meta_grab_op_is_moving (display->grab_op))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
|
|
|
"Computing edges to resist-movement or snap-to for %s.\n",
|
|
|
|
window->desc);
|
|
|
|
meta_display_compute_resistance_and_snapping_edges (display);
|
|
|
|
}
|
|
|
|
|
2005-01-24 00:58:30 -05:00
|
|
|
/* Save the old stacking */
|
|
|
|
if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
|
|
|
"Saving old stack positions; old pointer was %p.\n",
|
|
|
|
display->grab_old_window_stacking);
|
|
|
|
display->grab_old_window_stacking =
|
|
|
|
meta_stack_get_positions (screen->stack);
|
|
|
|
}
|
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
/* Do this last, after everything is set up. */
|
2002-03-17 12:22:23 -05:00
|
|
|
switch (op)
|
|
|
|
{
|
2002-04-05 10:52:49 -05:00
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
|
2006-01-10 00:05:40 -05:00
|
|
|
meta_screen_ensure_tab_popup (screen,
|
|
|
|
META_TAB_LIST_NORMAL,
|
|
|
|
META_TAB_SHOW_ICON);
|
|
|
|
break;
|
2002-07-06 12:50:48 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL:
|
2002-06-27 01:08:32 -04:00
|
|
|
meta_screen_ensure_tab_popup (screen,
|
2006-01-10 00:05:40 -05:00
|
|
|
META_TAB_LIST_NORMAL,
|
|
|
|
META_TAB_SHOW_INSTANTLY);
|
2002-04-05 10:52:49 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
|
2006-01-10 00:05:40 -05:00
|
|
|
meta_screen_ensure_tab_popup (screen,
|
|
|
|
META_TAB_LIST_DOCKS,
|
|
|
|
META_TAB_SHOW_ICON);
|
|
|
|
break;
|
2002-07-06 12:50:48 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
|
2002-06-27 01:08:32 -04:00
|
|
|
meta_screen_ensure_tab_popup (screen,
|
2006-01-10 00:05:40 -05:00
|
|
|
META_TAB_LIST_DOCKS,
|
|
|
|
META_TAB_SHOW_INSTANTLY);
|
2002-03-17 12:22:23 -05:00
|
|
|
break;
|
2006-04-14 22:05:44 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_TABBING_GROUP:
|
|
|
|
meta_screen_ensure_tab_popup (screen,
|
|
|
|
META_TAB_LIST_GROUP,
|
|
|
|
META_TAB_SHOW_ICON);
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
|
|
|
|
meta_screen_ensure_tab_popup (screen,
|
|
|
|
META_TAB_LIST_GROUP,
|
|
|
|
META_TAB_SHOW_INSTANTLY);
|
2002-03-17 12:22:23 -05:00
|
|
|
|
2002-06-09 00:04:19 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
|
2002-06-27 01:08:32 -04:00
|
|
|
meta_screen_ensure_workspace_popup (screen);
|
2002-06-08 23:44:16 -04:00
|
|
|
break;
|
|
|
|
|
2002-03-17 12:22:23 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-06-27 01:08:32 -04:00
|
|
|
if (display->grab_window)
|
2003-11-29 22:30:27 -05:00
|
|
|
{
|
|
|
|
meta_window_refresh_resize_popup (display->grab_window);
|
|
|
|
}
|
2001-07-11 02:22:00 -04:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_end_grab_op (MetaDisplay *display,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2001-07-11 02:22:00 -04:00
|
|
|
{
|
2003-01-21 17:40:25 -05:00
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"Ending grab op %u at time %u\n", display->grab_op, timestamp);
|
2002-07-06 12:50:48 -04:00
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
if (display->grab_op == META_GRAB_OP_NONE)
|
|
|
|
return;
|
2001-08-19 14:09:10 -04:00
|
|
|
|
2003-06-12 01:55:06 -04:00
|
|
|
if (display->grab_window != NULL)
|
|
|
|
display->grab_window->shaken_loose = FALSE;
|
|
|
|
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
if (display->grab_window != NULL &&
|
|
|
|
!meta_prefs_get_raise_on_click () &&
|
|
|
|
(meta_grab_op_is_moving (display->grab_op) ||
|
|
|
|
meta_grab_op_is_resizing (display->grab_op)))
|
|
|
|
{
|
|
|
|
/* Only raise the window in orthogonal raise
|
|
|
|
* ('do-not-raise-on-click') mode if the user didn't try to move
|
|
|
|
* or resize the given window by at least a threshold amount.
|
|
|
|
* For raise on click mode, the window was raised at the
|
|
|
|
* beginning of the grab_op.
|
|
|
|
*/
|
|
|
|
if (!display->grab_threshold_movement_reached)
|
|
|
|
meta_window_raise (display->grab_window);
|
|
|
|
}
|
|
|
|
|
2005-01-24 00:58:30 -05:00
|
|
|
if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op) ||
|
2002-06-09 00:04:19 -04:00
|
|
|
display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING)
|
2001-08-19 14:09:10 -04:00
|
|
|
{
|
2002-06-27 01:08:32 -04:00
|
|
|
meta_ui_tab_popup_free (display->grab_screen->tab_popup);
|
|
|
|
display->grab_screen->tab_popup = NULL;
|
2002-03-02 10:26:07 -05:00
|
|
|
|
|
|
|
/* If the ungrab here causes an EnterNotify, ignore it for
|
|
|
|
* sloppy focus
|
|
|
|
*/
|
|
|
|
display->ungrab_should_not_cause_focus_window = display->grab_xwindow;
|
2001-08-19 14:09:10 -04:00
|
|
|
}
|
2001-07-11 02:22:00 -04:00
|
|
|
|
Merge of all the changes on the constraints_experiments branch. This is
2005-11-18 Elijah Newren <newren@gmail.com>
Merge of all the changes on the constraints_experiments branch.
This is just a summary, to get the full ChangeLog of those
changes (approx. 2000 lines):
cvs -q -z3 update -Pd -r constraints_experiments
cvs -q -z3 diff -pu -r CONSTRAINTS_EXPERIMENTS_BRANCHPOINT ChangeLog
Bugs fixed:
unfiled - constraints.c is overly complicated[1]
unfiled - constraints.c is not robust when all constraints
cannot simultaneously be met (constraints need to be
prioritized)
unfiled - keep-titlebar-onscreen constraint is decoration
unaware (since get_outermost_onscreen_positions()
forgets to include decorations)
unfiled - keyboard snap-moving and snap-resizing snap to hidden
edges
109553 - gravity w/ simultaneous move & resize doesn't work
113601 - maximize vertical and horizontal should toggle and be
constrained
122196 - windows show up under vertical panels
122670 - jerky/random resizing of window via keyboard[2]
124582 - keyboard and mouse snap-resizing and snap-moving
erroneously moves the window multidimensionally
136307 - don't allow apps to resize themselves off the screen
(*cough* filechooser *cough*)
142016, 143784 - windows should not span multiple xineramas
unless placed there by the user
143145 - clamp new windows to screensize and force them
onscreen, if they'll fit
144126 - Handle pathological strut lists sanely[3]
149867 - fixed aspect ratio windows are difficult to resize[4]
152898 - make screen edges consistent; allow easy slamming of
windows into the left, right, and bottom edges of the
screen too.
154706 - bouncing weirdness at screen edge with keyboard moving
or resizing
156699 - avoid struts when placing windows, if possible (nasty
a11y blocker)
302456 - dragging offscreen too restrictive
304857 - wireframe moving off the top of the screen is misleading
308521 - make uni-directional resizing easier with
alt-middle-drag and prevent the occasional super
annoying resize-the-wrong-side(s) behavior
312007 - snap-resize moves windows with a minimum size
constraint
312104 - resizing the top of a window can cause the bottom to
grow
319351 - don't instantly snap on mouse-move-snapping, remove
braindeadedness of having order of releasing shift and
releasing button press matter so much
[1] fixed in my opinion, anyway.
[2] Actually, it's not totally fixed--it's just annoying
instead of almost completely unusable. Matthias had a
suggestion that may fix the remainder of the problems (see
http://tinyurl.com/bwzuu).
[3] This bug was originally about not-quite-so-pathological
cases but was left open for the worse cases. The code from
the branch handles the remainder of the cases mentioned in
this bug.
[4] Actually, although it's far better there's still some minor
issues left: a slight drift that's only noticeable after
lots of resizing, and potential problems with partially
onscreen constraints due to not clearing any
fixed_directions flags (aspect ratio windows get resized in
both directions and thus aren't fixed in one of them)
New feature:
81704 - edge resistance for user move and resize operations;
in particular 3 different kinds of resistance are
implemented:
Pixel-Distance: window movement is resisted when it
aligns with an edge unless the movement is greater than
a threshold number of pixels
Timeout: window movement past an edge is prevented until
a certain amount of time has elapsed during the
operation since the first request to move it past that
edge
Keyboard-Buildup: when moving or resizing with the
keyboard, once a window is aligned with a certain edge
it cannot move past until the correct direction has
been pressed enough times (e.g. 2 or 3 times)
Major changes:
- constraints.c has been rewritten; very few lines of code from
the old version remain. There is a comment near the top of
the function explaining the basics of how the new framework
works. A more detailed explanation can be found in
doc/how-constraints-works.txt
- edge-resistance.[ch] are new files implementing edge-resistance.
- boxes.[ch] are new files containing low-level error-prone
functions used heavily in constraints.c and edge-resistance.c,
among various places throughout the code. testboxes.c
contains a thorough testsuite for the boxes.[ch] functions
compiled into a program, testboxes.
- meta_window_move_resize_internal() *must* be told the gravity
of the associated operation (if it's just a move operation,
the gravity will be ignored, but for resize and move+resize
the correct value is needed)
- the craziness of different values that
meta_window_move_resize_internal() accepts has been documented
in a large comment at the beginning of the function. It may
be possible to clean this up some, but until then things will
remain as they were before--caller beware.
- screen and xinerama usable areas (i.e. places not covered by
e.g. panels) are cached in the workspace now, as are the
screen and xinerama edges. These get updated with the
workarea in src/workspace.c:ensure_work_areas_validated()
2005-11-19 09:58:50 -05:00
|
|
|
/* If this was a move or resize clear out the edge cache */
|
|
|
|
if (meta_grab_op_is_resizing (display->grab_op) ||
|
|
|
|
meta_grab_op_is_moving (display->grab_op))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
|
|
|
"Clearing out the edges for resistance/snapping");
|
|
|
|
meta_display_cleanup_edges (display);
|
|
|
|
}
|
|
|
|
|
2005-01-24 00:58:30 -05:00
|
|
|
if (display->grab_old_window_stacking != NULL)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
|
|
|
"Clearing out the old stack position, which was %p.\n",
|
|
|
|
display->grab_old_window_stacking);
|
|
|
|
g_list_free (display->grab_old_window_stacking);
|
|
|
|
display->grab_old_window_stacking = NULL;
|
|
|
|
}
|
|
|
|
|
2004-08-20 06:56:41 -04:00
|
|
|
if (display->grab_wireframe_active)
|
|
|
|
{
|
|
|
|
display->grab_wireframe_active = FALSE;
|
2005-05-26 15:58:17 -04:00
|
|
|
meta_window_end_wireframe (display->grab_window);
|
|
|
|
|
2004-08-20 06:56:41 -04:00
|
|
|
if (!display->grab_was_cancelled)
|
2006-01-10 00:01:08 -05:00
|
|
|
{
|
|
|
|
if (meta_grab_op_is_moving (display->grab_op))
|
|
|
|
meta_window_move (display->grab_window,
|
|
|
|
TRUE,
|
|
|
|
display->grab_wireframe_rect.x,
|
|
|
|
display->grab_wireframe_rect.y);
|
|
|
|
if (meta_grab_op_is_resizing (display->grab_op))
|
|
|
|
meta_window_resize_with_gravity (display->grab_window,
|
|
|
|
TRUE,
|
|
|
|
display->grab_wireframe_rect.width,
|
|
|
|
display->grab_wireframe_rect.height,
|
|
|
|
meta_resize_gravity_from_grab_op (display->grab_op));
|
|
|
|
}
|
2004-08-20 06:56:41 -04:00
|
|
|
meta_window_calc_showing (display->grab_window);
|
|
|
|
}
|
|
|
|
|
2006-02-25 11:54:39 -05:00
|
|
|
if (display->compositor &&
|
|
|
|
display->grab_window &&
|
|
|
|
grab_op_is_mouse (display->grab_op) &&
|
|
|
|
meta_grab_op_is_moving (display->grab_op))
|
|
|
|
{
|
|
|
|
meta_compositor_end_move (display->compositor,
|
|
|
|
display->grab_window);
|
|
|
|
}
|
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
if (display->grab_have_pointer)
|
2002-03-02 10:26:07 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"Ungrabbing pointer with timestamp %u\n", timestamp);
|
2002-03-02 10:26:07 -05:00
|
|
|
XUngrabPointer (display->xdisplay, timestamp);
|
|
|
|
}
|
2001-07-11 02:22:00 -04:00
|
|
|
|
|
|
|
if (display->grab_have_keyboard)
|
2002-03-02 10:26:07 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WINDOW_OPS,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"Ungrabbing all keys timestamp %u\n", timestamp);
|
2002-06-27 01:08:32 -04:00
|
|
|
if (display->grab_window)
|
2006-09-09 16:19:56 -04:00
|
|
|
meta_window_ungrab_all_keys (display->grab_window, timestamp);
|
2002-06-27 01:08:32 -04:00
|
|
|
else
|
2006-09-09 16:19:56 -04:00
|
|
|
meta_screen_ungrab_all_keys (display->grab_screen, timestamp);
|
2002-03-02 10:26:07 -05:00
|
|
|
}
|
2002-12-09 22:23:04 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_XSYNC
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
if (display->grab_sync_request_alarm != None)
|
2002-12-09 22:23:04 -05:00
|
|
|
{
|
|
|
|
XSyncDestroyAlarm (display->xdisplay,
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
display->grab_sync_request_alarm);
|
|
|
|
display->grab_sync_request_alarm = None;
|
2002-12-09 22:23:04 -05:00
|
|
|
}
|
|
|
|
#endif /* HAVE_XSYNC */
|
2001-07-25 23:14:45 -04:00
|
|
|
|
2001-07-11 02:22:00 -04:00
|
|
|
display->grab_window = NULL;
|
2002-06-27 01:08:32 -04:00
|
|
|
display->grab_screen = NULL;
|
2002-03-02 10:26:07 -05:00
|
|
|
display->grab_xwindow = None;
|
2001-07-25 23:14:45 -04:00
|
|
|
display->grab_op = META_GRAB_OP_NONE;
|
2002-03-17 12:22:23 -05:00
|
|
|
|
|
|
|
if (display->grab_resize_popup)
|
|
|
|
{
|
|
|
|
meta_ui_resize_popup_free (display->grab_resize_popup);
|
|
|
|
display->grab_resize_popup = NULL;
|
|
|
|
}
|
Fix bug 143333, support for update counter spec, and 109362, schedule
Sat Jun 19 02:21:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Fix bug 143333, support for update counter spec, and 109362,
schedule compensation events when events are ignored.
* src/display.c (meta_display_open): Add _NET_WM_SYNC_REQUEST and
_NET_WM_SYNC_REQUEST_COUNTER atoms. Remove the old
METACITY_SYNC_COUNTER stuff.
(meta_display_begin_op): Setup the sync counter
* src/xprops.c, src/xprops.h, src/window-props.c, src/display.h:
Add new atoms.
* src/window.c (send_sync_request): new function.
(meta_window_move_resize_internal): send a sync request before
resizing.
(check_move_resize_frequence): Rework logic to also check the SYNC
case. If an event is ignored return the remaining time.
(update_resize_timeout): Timeout that gets called when a
compensation event is scheduled.
(uddate_resize): schedule compensation events when an event is
ignored.
(meta_window_handle_mouse_grap_op_event): When an alarm is
received and sync was turned off, turn it back on.
* src/window.h (struct MetaWindow) Add some variables
2004-06-18 20:45:24 -04:00
|
|
|
|
|
|
|
if (display->grab_resize_timeout_id)
|
|
|
|
{
|
|
|
|
g_source_remove (display->grab_resize_timeout_id);
|
|
|
|
display->grab_resize_timeout_id = 0;
|
|
|
|
}
|
2001-07-25 23:14:45 -04:00
|
|
|
}
|
|
|
|
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
void
|
|
|
|
meta_display_check_threshold_reached (MetaDisplay *display,
|
|
|
|
int x,
|
|
|
|
int y)
|
|
|
|
{
|
|
|
|
/* Don't bother doing the check again if we've already reached the threshold */
|
2006-01-23 20:07:41 -05:00
|
|
|
if (meta_prefs_get_raise_on_click () ||
|
|
|
|
display->grab_threshold_movement_reached)
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (ABS (display->grab_initial_x - x) >= 8 ||
|
|
|
|
ABS (display->grab_initial_y - y) >= 8)
|
|
|
|
display->grab_threshold_movement_reached = TRUE;
|
|
|
|
}
|
|
|
|
|
2001-10-26 00:00:38 -04:00
|
|
|
static void
|
|
|
|
meta_change_button_grab (MetaDisplay *display,
|
|
|
|
Window xwindow,
|
|
|
|
gboolean grab,
|
2001-12-10 23:03:58 -05:00
|
|
|
gboolean sync,
|
2001-10-26 00:00:38 -04:00
|
|
|
int button,
|
|
|
|
int modmask)
|
|
|
|
{
|
2003-05-20 23:45:58 -04:00
|
|
|
unsigned int ignored_mask;
|
2003-10-13 16:15:40 -04:00
|
|
|
|
|
|
|
meta_verbose ("%s 0x%lx sync = %d button = %d modmask 0x%x\n",
|
|
|
|
grab ? "Grabbing" : "Ungrabbing",
|
|
|
|
xwindow,
|
|
|
|
sync, button, modmask);
|
2002-10-21 17:44:35 -04:00
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
|
2001-10-26 00:00:38 -04:00
|
|
|
ignored_mask = 0;
|
2003-05-20 23:45:58 -04:00
|
|
|
while (ignored_mask <= display->ignored_modifier_mask)
|
2001-10-26 00:00:38 -04:00
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
if (ignored_mask & ~(display->ignored_modifier_mask))
|
2001-10-26 00:00:38 -04:00
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
/* Not a combination of ignored modifiers
|
2001-10-26 00:00:38 -04:00
|
|
|
* (it contains some non-ignored modifiers)
|
|
|
|
*/
|
|
|
|
++ignored_mask;
|
|
|
|
continue;
|
|
|
|
}
|
2002-10-21 17:44:35 -04:00
|
|
|
|
|
|
|
if (meta_is_debugging ())
|
|
|
|
meta_error_trap_push_with_return (display);
|
2003-10-13 16:15:40 -04:00
|
|
|
|
|
|
|
/* GrabModeSync means freeze until XAllowEvents */
|
2002-10-21 17:44:35 -04:00
|
|
|
|
2001-10-26 00:00:38 -04:00
|
|
|
if (grab)
|
|
|
|
XGrabButton (display->xdisplay, button, modmask | ignored_mask,
|
|
|
|
xwindow, False,
|
|
|
|
ButtonPressMask | ButtonReleaseMask |
|
|
|
|
PointerMotionMask | PointerMotionHintMask,
|
2001-12-10 23:03:58 -05:00
|
|
|
sync ? GrabModeSync : GrabModeAsync,
|
|
|
|
GrabModeAsync,
|
2001-10-26 00:00:38 -04:00
|
|
|
False, None);
|
|
|
|
else
|
|
|
|
XUngrabButton (display->xdisplay, button, modmask | ignored_mask,
|
|
|
|
xwindow);
|
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
if (meta_is_debugging ())
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
|
|
|
|
result = meta_error_trap_pop_with_return (display, FALSE);
|
|
|
|
|
|
|
|
if (result != Success)
|
|
|
|
meta_verbose ("Failed to %s button %d with mask 0x%x for window 0x%lx error code %d\n",
|
|
|
|
grab ? "grab" : "ungrab",
|
|
|
|
button, modmask | ignored_mask, xwindow, result);
|
|
|
|
}
|
2001-10-26 00:00:38 -04:00
|
|
|
|
|
|
|
++ignored_mask;
|
|
|
|
}
|
2002-10-21 17:44:35 -04:00
|
|
|
|
|
|
|
meta_error_trap_pop (display, FALSE);
|
2001-10-26 00:00:38 -04:00
|
|
|
}
|
|
|
|
|
2001-07-25 23:14:45 -04:00
|
|
|
void
|
|
|
|
meta_display_grab_window_buttons (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
2002-10-07 19:14:40 -04:00
|
|
|
{
|
2006-07-24 13:15:32 -04:00
|
|
|
/* Grab Alt + button1 for moving window.
|
|
|
|
* Grab Alt + button2 for resizing window.
|
|
|
|
* Grab Alt + button3 for popping up window menu.
|
|
|
|
* Grab Alt + Shift + button1 for snap-moving window.
|
2001-07-25 23:14:45 -04:00
|
|
|
*/
|
2001-07-25 23:58:24 -04:00
|
|
|
meta_verbose ("Grabbing window buttons for 0x%lx\n", xwindow);
|
2002-10-07 19:14:40 -04:00
|
|
|
|
2001-08-19 14:09:10 -04:00
|
|
|
/* FIXME If we ignored errors here instead of spewing, we could
|
|
|
|
* put one big error trap around the loop and avoid a bunch of
|
|
|
|
* XSync()
|
|
|
|
*/
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
|
|
if (display->window_grab_modifiers != 0)
|
|
|
|
{
|
|
|
|
gboolean debug = g_getenv ("METACITY_DEBUG_BUTTON_GRABS") != NULL;
|
2006-07-24 13:15:32 -04:00
|
|
|
int i;
|
|
|
|
for (i = 1; i < 4; i++)
|
2002-10-07 19:14:40 -04:00
|
|
|
{
|
2006-07-24 13:15:32 -04:00
|
|
|
meta_change_button_grab (display, xwindow,
|
2001-10-26 00:00:38 -04:00
|
|
|
TRUE,
|
2001-12-10 23:03:58 -05:00
|
|
|
FALSE,
|
2002-10-07 19:14:40 -04:00
|
|
|
i, display->window_grab_modifiers);
|
|
|
|
|
|
|
|
/* This is for debugging, since I end up moving the Xnest
|
|
|
|
* otherwise ;-)
|
|
|
|
*/
|
|
|
|
if (debug)
|
|
|
|
meta_change_button_grab (display, xwindow,
|
|
|
|
TRUE,
|
|
|
|
FALSE,
|
|
|
|
i, ControlMask);
|
|
|
|
}
|
2006-07-24 13:15:32 -04:00
|
|
|
|
|
|
|
/* In addition to grabbing Alt+Button1 for moving the window,
|
|
|
|
* grab Alt+Shift+Button1 for snap-moving the window. See bug
|
|
|
|
* 112478. Unfortunately, this doesn't work with
|
|
|
|
* Shift+Alt+Button1 for some reason; so at least part of the
|
|
|
|
* order still matters, which sucks (please FIXME).
|
|
|
|
*/
|
|
|
|
meta_change_button_grab (display, xwindow,
|
|
|
|
TRUE,
|
|
|
|
FALSE,
|
|
|
|
1, display->window_grab_modifiers | ShiftMask);
|
2002-10-07 19:14:40 -04:00
|
|
|
}
|
2001-07-11 02:22:00 -04:00
|
|
|
}
|
2001-07-25 23:14:45 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_ungrab_window_buttons (MetaDisplay *display,
|
|
|
|
Window xwindow)
|
|
|
|
{
|
2002-10-07 19:14:40 -04:00
|
|
|
gboolean debug;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (display->window_grab_modifiers == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
debug = g_getenv ("METACITY_DEBUG_BUTTON_GRABS") != NULL;
|
|
|
|
i = 1;
|
2001-08-19 14:09:10 -04:00
|
|
|
while (i < 4)
|
|
|
|
{
|
2001-10-26 00:00:38 -04:00
|
|
|
meta_change_button_grab (display, xwindow,
|
2002-10-07 19:14:40 -04:00
|
|
|
FALSE, FALSE, i,
|
|
|
|
display->window_grab_modifiers);
|
|
|
|
|
2001-10-26 00:00:38 -04:00
|
|
|
if (debug)
|
|
|
|
meta_change_button_grab (display, xwindow,
|
2001-12-10 23:03:58 -05:00
|
|
|
FALSE, FALSE, i, ControlMask);
|
2001-08-19 14:09:10 -04:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2001-07-25 23:14:45 -04:00
|
|
|
}
|
|
|
|
|
2001-12-10 02:48:21 -05:00
|
|
|
/* Grab buttons we only grab while unfocused in click-to-focus mode */
|
2002-02-08 01:50:09 -05:00
|
|
|
#define MAX_FOCUS_BUTTON 4
|
2001-12-10 02:48:21 -05:00
|
|
|
void
|
2001-12-10 23:03:58 -05:00
|
|
|
meta_display_grab_focus_window_button (MetaDisplay *display,
|
2003-10-13 16:15:40 -04:00
|
|
|
MetaWindow *window)
|
2001-12-10 02:48:21 -05:00
|
|
|
{
|
|
|
|
/* Grab button 1 for activating unfocused windows */
|
2003-10-13 16:15:40 -04:00
|
|
|
meta_verbose ("Grabbing unfocused window buttons for %s\n", window->desc);
|
2001-12-10 02:48:21 -05:00
|
|
|
|
2004-01-05 02:24:32 -05:00
|
|
|
#if 0
|
|
|
|
/* FIXME:115072 */
|
2003-10-13 16:15:40 -04:00
|
|
|
/* Don't grab at all unless in click to focus mode. In click to
|
|
|
|
* focus, we may sometimes be clever about intercepting and eating
|
|
|
|
* the focus click. But in mouse focus, we never do that since the
|
|
|
|
* focus window may not be raised, and who wants to think about
|
|
|
|
* mouse focus anyway.
|
|
|
|
*/
|
|
|
|
if (meta_prefs_get_focus_mode () != META_FOCUS_MODE_CLICK)
|
|
|
|
{
|
|
|
|
meta_verbose (" (well, not grabbing since not in click to focus mode)\n");
|
|
|
|
return;
|
|
|
|
}
|
2004-01-05 02:24:32 -05:00
|
|
|
#endif
|
2003-10-13 16:15:40 -04:00
|
|
|
|
|
|
|
if (window->have_focus_click_grab)
|
|
|
|
{
|
|
|
|
meta_verbose (" (well, not grabbing since we already have the grab)\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-12-10 02:48:21 -05:00
|
|
|
/* FIXME If we ignored errors here instead of spewing, we could
|
|
|
|
* put one big error trap around the loop and avoid a bunch of
|
|
|
|
* XSync()
|
|
|
|
*/
|
|
|
|
|
|
|
|
{
|
|
|
|
int i = 1;
|
2002-02-08 01:50:09 -05:00
|
|
|
while (i < MAX_FOCUS_BUTTON)
|
2001-12-10 02:48:21 -05:00
|
|
|
{
|
|
|
|
meta_change_button_grab (display,
|
2003-10-13 16:15:40 -04:00
|
|
|
window->xwindow,
|
|
|
|
TRUE, TRUE,
|
|
|
|
i, 0);
|
2001-12-10 02:48:21 -05:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2003-10-13 16:15:40 -04:00
|
|
|
|
|
|
|
window->have_focus_click_grab = TRUE;
|
2001-12-10 02:48:21 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-12-10 23:03:58 -05:00
|
|
|
meta_display_ungrab_focus_window_button (MetaDisplay *display,
|
2003-10-13 16:15:40 -04:00
|
|
|
MetaWindow *window)
|
2001-12-10 02:48:21 -05:00
|
|
|
{
|
2003-10-13 16:15:40 -04:00
|
|
|
meta_verbose ("Ungrabbing unfocused window buttons for %s\n", window->desc);
|
2001-12-10 02:48:21 -05:00
|
|
|
|
2003-10-13 16:15:40 -04:00
|
|
|
if (!window->have_focus_click_grab)
|
|
|
|
return;
|
|
|
|
|
2001-12-10 02:48:21 -05:00
|
|
|
{
|
|
|
|
int i = 1;
|
2002-02-08 01:50:09 -05:00
|
|
|
while (i < MAX_FOCUS_BUTTON)
|
2001-12-10 02:48:21 -05:00
|
|
|
{
|
2003-10-13 16:15:40 -04:00
|
|
|
meta_change_button_grab (display, window->xwindow,
|
|
|
|
FALSE, FALSE, i, 0);
|
2001-12-10 02:48:21 -05:00
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2003-10-13 16:15:40 -04:00
|
|
|
|
|
|
|
window->have_focus_click_grab = FALSE;
|
2001-12-10 02:48:21 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-08-30 00:01:38 -04:00
|
|
|
void
|
|
|
|
meta_display_increment_event_serial (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
/* We just make some random X request */
|
|
|
|
XDeleteProperty (display->xdisplay, display->leader_window,
|
|
|
|
display->atom_motif_wm_hints);
|
|
|
|
}
|
2001-10-07 19:06:19 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_update_active_window_hint (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
unsigned long data[2];
|
|
|
|
|
|
|
|
if (display->focus_window)
|
|
|
|
data[0] = display->focus_window->xwindow;
|
|
|
|
else
|
|
|
|
data[0] = None;
|
|
|
|
data[1] = None;
|
|
|
|
|
|
|
|
tmp = display->screens;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = tmp->data;
|
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
XChangeProperty (display->xdisplay, screen->xroot,
|
|
|
|
display->atom_net_active_window,
|
|
|
|
XA_WINDOW,
|
|
|
|
32, PropModeReplace, (guchar*) data, 2);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, FALSE);
|
2001-10-07 19:06:19 -04:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
2001-10-14 23:39:41 -04:00
|
|
|
|
2002-02-06 22:25:34 -05:00
|
|
|
void
|
|
|
|
meta_display_queue_retheme_all_windows (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
GSList* windows;
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
windows = meta_display_list_windows (display);
|
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
|
|
|
meta_window_queue_move_resize (window);
|
|
|
|
if (window->frame)
|
2002-05-30 20:02:54 -04:00
|
|
|
{
|
2003-01-05 02:51:02 -05:00
|
|
|
window->frame->need_reapply_frame_shape = TRUE;
|
|
|
|
|
2002-05-30 20:02:54 -04:00
|
|
|
meta_frame_queue_draw (window->frame);
|
2003-01-05 02:51:02 -05:00
|
|
|
}
|
2002-02-06 22:25:34 -05:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_retheme_all (void)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
tmp = meta_displays_list ();
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaDisplay *display = tmp->data;
|
|
|
|
meta_display_queue_retheme_all_windows (display);
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-11 09:25:08 -04:00
|
|
|
void
|
|
|
|
meta_display_set_cursor_theme (const char *theme,
|
|
|
|
int size)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_XCURSOR
|
|
|
|
GSList *tmp, *tmp2;
|
|
|
|
|
|
|
|
tmp = meta_displays_list ();
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaDisplay *display = tmp->data;
|
|
|
|
|
|
|
|
XcursorSetTheme (display->xdisplay, theme);
|
|
|
|
XcursorSetDefaultSize (display->xdisplay, size);
|
|
|
|
|
|
|
|
tmp2 = display->screens;
|
|
|
|
while (tmp2 != NULL)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = tmp2->data;
|
|
|
|
|
|
|
|
meta_screen_update_cursor (screen);
|
|
|
|
|
|
|
|
tmp2 = tmp2->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2002-01-27 21:09:12 -05:00
|
|
|
static gboolean is_syncing = FALSE;
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_is_syncing (void)
|
|
|
|
{
|
|
|
|
return is_syncing;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_set_syncing (gboolean setting)
|
|
|
|
{
|
|
|
|
if (setting != is_syncing)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
is_syncing = setting;
|
|
|
|
|
|
|
|
tmp = meta_displays_list ();
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaDisplay *display = tmp->data;
|
|
|
|
XSynchronize (display->xdisplay, is_syncing);
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
|
2002-04-13 00:58:45 -04:00
|
|
|
#define PING_TIMEOUT_DELAY 2250
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
meta_display_ping_timeout (gpointer data)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data;
|
|
|
|
|
|
|
|
ping_data = data;
|
|
|
|
|
|
|
|
ping_data->ping_timeout_id = 0;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_PING,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"Ping %u on window %lx timed out\n",
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
ping_data->timestamp, ping_data->xwindow);
|
|
|
|
|
|
|
|
(* ping_data->ping_timeout_func) (ping_data->display, ping_data->xwindow,
|
2004-08-25 20:59:12 -04:00
|
|
|
ping_data->timestamp, ping_data->user_data);
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
|
|
|
|
ping_data->display->pending_pings =
|
|
|
|
g_slist_remove (ping_data->display->pending_pings,
|
|
|
|
ping_data);
|
|
|
|
ping_data_free (ping_data);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_ping_window (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp,
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
MetaWindowPingFunc ping_reply_func,
|
|
|
|
MetaWindowPingFunc ping_timeout_func,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data;
|
|
|
|
|
|
|
|
if (timestamp == CurrentTime)
|
|
|
|
{
|
|
|
|
meta_warning ("Tried to ping a window with CurrentTime! Not allowed.\n");
|
|
|
|
return;
|
|
|
|
}
|
2002-04-15 18:14:06 -04:00
|
|
|
|
|
|
|
if (!window->net_wm_ping)
|
|
|
|
{
|
|
|
|
if (ping_reply_func)
|
2004-08-25 20:59:12 -04:00
|
|
|
(* ping_reply_func) (display, window->xwindow, timestamp, user_data);
|
2002-04-15 18:14:06 -04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
|
|
|
|
ping_data = g_new (MetaPingData, 1);
|
|
|
|
ping_data->display = display;
|
|
|
|
ping_data->xwindow = window->xwindow;
|
|
|
|
ping_data->timestamp = timestamp;
|
|
|
|
ping_data->ping_reply_func = ping_reply_func;
|
|
|
|
ping_data->ping_timeout_func = ping_timeout_func;
|
|
|
|
ping_data->user_data = user_data;
|
|
|
|
ping_data->ping_timeout_id = g_timeout_add (PING_TIMEOUT_DELAY,
|
|
|
|
meta_display_ping_timeout,
|
|
|
|
ping_data);
|
|
|
|
|
|
|
|
display->pending_pings = g_slist_prepend (display->pending_pings, ping_data);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_PING,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"Sending ping with timestamp %u to window %s\n",
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
timestamp, window->desc);
|
|
|
|
meta_window_send_icccm_message (window,
|
2003-06-25 23:09:38 -04:00
|
|
|
display->atom_net_wm_ping,
|
|
|
|
timestamp);
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
}
|
|
|
|
|
2004-01-10 12:16:07 -05:00
|
|
|
static void
|
|
|
|
process_request_frame_extents (MetaDisplay *display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
/* The X window whose frame extents will be set. */
|
|
|
|
Window xwindow = event->xclient.window;
|
|
|
|
unsigned long data[4] = { 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
MotifWmHints *hints = NULL;
|
|
|
|
gboolean hints_set = FALSE;
|
|
|
|
|
|
|
|
meta_verbose ("Setting frame extents for 0x%lx\n", xwindow);
|
|
|
|
|
|
|
|
/* See if the window is decorated. */
|
|
|
|
hints_set = meta_prop_get_motif_hints (display,
|
|
|
|
xwindow,
|
|
|
|
display->atom_motif_wm_hints,
|
|
|
|
&hints);
|
|
|
|
if ((hints_set && hints->decorations) || !hints_set)
|
|
|
|
{
|
|
|
|
int top = 0;
|
|
|
|
int bottom = 0;
|
|
|
|
int left = 0;
|
|
|
|
int right = 0;
|
|
|
|
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
screen = meta_display_screen_for_xwindow (display,
|
|
|
|
event->xclient.window);
|
|
|
|
if (screen == NULL)
|
|
|
|
{
|
|
|
|
meta_warning ("Received request to set _NET_FRAME_EXTENTS "
|
|
|
|
"on 0x%lx which is on a screen we are not managing\n",
|
|
|
|
event->xclient.window);
|
|
|
|
meta_XFree (hints);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return estimated frame extents for a normal window. */
|
|
|
|
meta_ui_theme_get_frame_borders (screen->ui,
|
|
|
|
META_FRAME_TYPE_NORMAL,
|
|
|
|
0,
|
|
|
|
&top,
|
|
|
|
&bottom,
|
|
|
|
&left,
|
|
|
|
&right);
|
|
|
|
|
|
|
|
data[0] = left;
|
|
|
|
data[1] = right;
|
|
|
|
data[2] = top;
|
|
|
|
data[3] = bottom;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_GEOMETRY,
|
|
|
|
"Setting _NET_FRAME_EXTENTS on unmanaged window 0x%lx "
|
2006-01-20 17:03:56 -05:00
|
|
|
"to top = %lu, left = %lu, bottom = %lu, right = %lu\n",
|
2004-01-10 12:16:07 -05:00
|
|
|
xwindow, data[0], data[1], data[2], data[3]);
|
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
XChangeProperty (display->xdisplay, xwindow,
|
|
|
|
display->atom_net_frame_extents,
|
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 4);
|
|
|
|
meta_error_trap_pop (display, FALSE);
|
|
|
|
|
|
|
|
meta_XFree (hints);
|
|
|
|
}
|
|
|
|
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
/* process the pong from our ping */
|
|
|
|
static void
|
|
|
|
process_pong_message (MetaDisplay *display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp = event->xclient.data.l[1];
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
meta_topic (META_DEBUG_PING, "Received a pong with timestamp %u\n",
|
|
|
|
timestamp);
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
|
|
|
|
for (tmp = display->pending_pings; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data = tmp->data;
|
|
|
|
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
if (timestamp == ping_data->timestamp)
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PING,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"Matching ping found for pong %u\n",
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
ping_data->timestamp);
|
|
|
|
|
|
|
|
/* Remove the ping data from the list */
|
|
|
|
display->pending_pings = g_slist_remove (display->pending_pings,
|
|
|
|
ping_data);
|
|
|
|
|
|
|
|
/* Remove the timeout */
|
|
|
|
if (ping_data->ping_timeout_id != 0)
|
|
|
|
{
|
|
|
|
g_source_remove (ping_data->ping_timeout_id);
|
|
|
|
ping_data->ping_timeout_id = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Call callback */
|
2004-08-25 20:59:12 -04:00
|
|
|
(* ping_data->ping_reply_func) (display,
|
|
|
|
ping_data->xwindow,
|
|
|
|
ping_data->timestamp,
|
Screw around with Anders's ping patch so he'll get plenty of CVS
2002-02-26 Havoc Pennington <hp@pobox.com>
Screw around with Anders's ping patch so he'll get plenty of CVS
conflicts. ;-)
* src/display.c (meta_display_ping_window): spew warnings
if we try to call this with CurrentTime
(meta_display_ping_timeout): remove ping from the pending pings
after it times out.
* src/util.h: added PING debug category
* src/display.c (remove_pending_pings_for_window): don't remove
"tmp" just before "tmp->next", don't break out of loop after
finding the first match
(meta_display_open): no trailing comma in array init
(event_callback): move the processing of ping replies into a
separate function
* src/screen.c (set_supported_hint): add _NET_WM_PING to supported
list
* src/display.h: change gpointer to void*
2002-02-26 Anders Carlsson <andersca@gnu.org>
* src/display.c: (ping_data_free),
(remove_pending_pings_for_window), (meta_display_open),
(event_callback), (meta_display_unregister_x_window),
(meta_display_ping_timeout), (meta_display_ping_window),
(meta_display_window_has_pending_pings):
Implement meta_display_ping_window, and filter out scroll wheel
events.
* src/display.h:
Add MetaWindowPingFunc, meta_display_ping_window and
meta_display_window_has_pending_pings.
2002-02-26 21:05:39 -05:00
|
|
|
ping_data->user_data);
|
|
|
|
|
|
|
|
ping_data_free (ping_data);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_display_window_has_pending_pings (MetaDisplay *display,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
for (tmp = display->pending_pings; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPingData *ping_data = tmp->data;
|
|
|
|
|
|
|
|
if (ping_data->xwindow == window->xwindow)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-04-14 22:05:44 -04:00
|
|
|
MetaGroup*
|
|
|
|
get_focussed_group (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
if (display->focus_window)
|
|
|
|
return display->focus_window->group;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define IN_TAB_CHAIN(w,t) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \
|
|
|
|
|| ((t) == META_TAB_LIST_DOCKS && META_WINDOW_IN_DOCK_TAB_CHAIN (w)) \
|
|
|
|
|| ((t) == META_TAB_LIST_GROUP && META_WINDOW_IN_GROUP_TAB_CHAIN (w, get_focussed_group(w->display))))
|
2002-04-05 10:52:49 -05:00
|
|
|
|
2002-03-11 23:34:17 -05:00
|
|
|
static MetaWindow*
|
|
|
|
find_tab_forward (MetaDisplay *display,
|
2002-04-05 10:52:49 -05:00
|
|
|
MetaTabList type,
|
2004-10-25 12:17:19 -04:00
|
|
|
MetaScreen *screen,
|
2002-03-11 23:34:17 -05:00
|
|
|
MetaWorkspace *workspace,
|
2004-10-25 12:17:19 -04:00
|
|
|
GList *start,
|
|
|
|
gboolean skip_first)
|
2002-03-11 23:34:17 -05:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
g_return_val_if_fail (start != NULL, NULL);
|
2003-08-15 18:09:55 -04:00
|
|
|
g_return_val_if_fail (workspace != NULL, NULL);
|
2002-05-11 02:59:54 -04:00
|
|
|
|
2004-10-25 12:17:19 -04:00
|
|
|
tmp = start;
|
|
|
|
if (skip_first)
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
2002-03-11 23:34:17 -05:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2002-05-11 02:59:54 -04:00
|
|
|
if (window->screen == screen &&
|
2003-08-15 18:09:55 -04:00
|
|
|
IN_TAB_CHAIN (window, type))
|
2002-03-11 23:34:17 -05:00
|
|
|
return window;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
2003-08-15 18:09:55 -04:00
|
|
|
tmp = workspace->mru_list;
|
2002-03-11 23:34:17 -05:00
|
|
|
while (tmp != start)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2003-08-15 18:09:55 -04:00
|
|
|
if (IN_TAB_CHAIN (window, type))
|
2002-03-11 23:34:17 -05:00
|
|
|
return window;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaWindow*
|
|
|
|
find_tab_backward (MetaDisplay *display,
|
2002-04-05 10:52:49 -05:00
|
|
|
MetaTabList type,
|
2004-10-25 12:17:19 -04:00
|
|
|
MetaScreen *screen,
|
2002-03-11 23:34:17 -05:00
|
|
|
MetaWorkspace *workspace,
|
2004-10-25 12:17:19 -04:00
|
|
|
GList *start,
|
|
|
|
gboolean skip_last)
|
2002-03-11 23:34:17 -05:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
g_return_val_if_fail (start != NULL, NULL);
|
2003-08-15 18:09:55 -04:00
|
|
|
g_return_val_if_fail (workspace != NULL, NULL);
|
2004-10-25 12:17:19 -04:00
|
|
|
|
|
|
|
tmp = start;
|
|
|
|
if (skip_last)
|
|
|
|
tmp = tmp->prev;
|
2002-03-11 23:34:17 -05:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2002-05-11 02:59:54 -04:00
|
|
|
if (window->screen == screen &&
|
2003-08-15 18:09:55 -04:00
|
|
|
IN_TAB_CHAIN (window, type))
|
2002-03-11 23:34:17 -05:00
|
|
|
return window;
|
|
|
|
|
|
|
|
tmp = tmp->prev;
|
|
|
|
}
|
|
|
|
|
2003-08-15 18:09:55 -04:00
|
|
|
tmp = g_list_last (workspace->mru_list);
|
2002-03-11 23:34:17 -05:00
|
|
|
while (tmp != start)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2003-08-15 18:09:55 -04:00
|
|
|
if (IN_TAB_CHAIN (window, type))
|
2002-03-11 23:34:17 -05:00
|
|
|
return window;
|
|
|
|
|
|
|
|
tmp = tmp->prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-03-14 21:16:21 -05:00
|
|
|
GList*
|
2002-03-11 23:34:17 -05:00
|
|
|
meta_display_get_tab_list (MetaDisplay *display,
|
2002-04-05 10:52:49 -05:00
|
|
|
MetaTabList type,
|
2002-03-11 23:34:17 -05:00
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWorkspace *workspace)
|
|
|
|
{
|
2003-03-14 21:16:21 -05:00
|
|
|
GList *tab_list;
|
2002-03-11 23:34:17 -05:00
|
|
|
|
2003-08-15 18:09:55 -04:00
|
|
|
g_return_val_if_fail (workspace != NULL, NULL);
|
2002-04-05 10:52:49 -05:00
|
|
|
|
2002-10-24 01:15:28 -04:00
|
|
|
/* Windows sellout mode - MRU order. Collect unminimized windows
|
|
|
|
* then minimized so minimized windows aren't in the way so much.
|
|
|
|
*/
|
2002-03-11 23:34:17 -05:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
tab_list = NULL;
|
2003-08-15 18:09:55 -04:00
|
|
|
tmp = workspace->mru_list;
|
2002-03-11 23:34:17 -05:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2002-10-24 01:15:28 -04:00
|
|
|
if (!window->minimized &&
|
|
|
|
window->screen == screen &&
|
2003-08-15 18:09:55 -04:00
|
|
|
IN_TAB_CHAIN (window, type))
|
2003-03-14 21:16:21 -05:00
|
|
|
tab_list = g_list_prepend (tab_list, window);
|
2002-03-11 23:34:17 -05:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-24 01:15:28 -04:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
2003-08-15 18:09:55 -04:00
|
|
|
tmp = workspace->mru_list;
|
2002-10-24 01:15:28 -04:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
|
|
|
if (window->minimized &&
|
|
|
|
window->screen == screen &&
|
2003-08-15 18:09:55 -04:00
|
|
|
IN_TAB_CHAIN (window, type))
|
2003-03-14 21:16:21 -05:00
|
|
|
tab_list = g_list_prepend (tab_list, window);
|
2002-10-24 01:15:28 -04:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-14 21:16:21 -05:00
|
|
|
tab_list = g_list_reverse (tab_list);
|
2002-10-24 01:15:28 -04:00
|
|
|
|
2002-03-11 23:34:17 -05:00
|
|
|
return tab_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaWindow*
|
|
|
|
meta_display_get_tab_next (MetaDisplay *display,
|
2002-04-05 10:52:49 -05:00
|
|
|
MetaTabList type,
|
2003-03-14 21:16:21 -05:00
|
|
|
MetaScreen *screen,
|
2002-03-11 23:34:17 -05:00
|
|
|
MetaWorkspace *workspace,
|
|
|
|
MetaWindow *window,
|
|
|
|
gboolean backward)
|
|
|
|
{
|
2004-10-25 12:17:19 -04:00
|
|
|
gboolean skip;
|
2003-03-14 21:16:21 -05:00
|
|
|
GList *tab_list;
|
2006-01-20 17:03:56 -05:00
|
|
|
MetaWindow *ret;
|
2003-03-14 21:16:21 -05:00
|
|
|
tab_list = meta_display_get_tab_list(display,
|
|
|
|
type,
|
|
|
|
screen,
|
|
|
|
workspace);
|
|
|
|
|
|
|
|
if (tab_list == NULL)
|
2002-03-11 23:34:17 -05:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (window != NULL)
|
|
|
|
{
|
|
|
|
g_assert (window->display == display);
|
|
|
|
|
|
|
|
if (backward)
|
2006-01-20 17:03:56 -05:00
|
|
|
ret = find_tab_backward (display, type, screen, workspace,
|
2003-03-14 21:16:21 -05:00
|
|
|
g_list_find (tab_list,
|
2004-10-25 12:17:19 -04:00
|
|
|
window),
|
|
|
|
TRUE);
|
2006-01-20 17:03:56 -05:00
|
|
|
else
|
|
|
|
ret = find_tab_forward (display, type, screen, workspace,
|
|
|
|
g_list_find (tab_list,
|
|
|
|
window),
|
|
|
|
TRUE);
|
2002-03-11 23:34:17 -05:00
|
|
|
}
|
|
|
|
else
|
2006-01-20 17:03:56 -05:00
|
|
|
{
|
|
|
|
skip = display->focus_window != NULL &&
|
|
|
|
IN_TAB_CHAIN (display->focus_window, type);
|
|
|
|
if (backward)
|
|
|
|
ret = find_tab_backward (display, type, screen, workspace,
|
|
|
|
tab_list, skip);
|
|
|
|
else
|
|
|
|
ret = find_tab_forward (display, type, screen, workspace,
|
|
|
|
tab_list, skip);
|
|
|
|
}
|
2003-03-14 21:16:21 -05:00
|
|
|
|
|
|
|
g_list_free (tab_list);
|
2006-01-20 17:03:56 -05:00
|
|
|
return ret;
|
2002-03-11 23:34:17 -05:00
|
|
|
}
|
2002-03-17 12:22:23 -05:00
|
|
|
|
2002-09-04 00:15:46 -04:00
|
|
|
MetaWindow*
|
|
|
|
meta_display_get_tab_current (MetaDisplay *display,
|
|
|
|
MetaTabList type,
|
|
|
|
MetaScreen *screen,
|
|
|
|
MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
MetaWindow *window;
|
|
|
|
|
|
|
|
window = display->focus_window;
|
|
|
|
|
|
|
|
if (window != NULL &&
|
|
|
|
window->screen == screen &&
|
|
|
|
IN_TAB_CHAIN (window, type) &&
|
|
|
|
(workspace == NULL ||
|
2004-12-22 19:20:33 -05:00
|
|
|
meta_window_located_on_workspace (window, workspace)))
|
2002-09-04 00:15:46 -04:00
|
|
|
return window;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-03-17 12:22:23 -05:00
|
|
|
int
|
|
|
|
meta_resize_gravity_from_grab_op (MetaGrabOp op)
|
|
|
|
{
|
|
|
|
int gravity;
|
|
|
|
|
|
|
|
gravity = -1;
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case META_GRAB_OP_RESIZING_SE:
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
|
|
|
gravity = NorthWestGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
|
|
|
case META_GRAB_OP_RESIZING_S:
|
|
|
|
gravity = NorthGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
|
|
|
case META_GRAB_OP_RESIZING_SW:
|
|
|
|
gravity = NorthEastGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
|
|
|
case META_GRAB_OP_RESIZING_N:
|
|
|
|
gravity = SouthGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
|
|
|
case META_GRAB_OP_RESIZING_NE:
|
|
|
|
gravity = SouthWestGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
|
|
|
case META_GRAB_OP_RESIZING_NW:
|
|
|
|
gravity = SouthEastGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
|
|
|
case META_GRAB_OP_RESIZING_E:
|
|
|
|
gravity = WestGravity;
|
|
|
|
break;
|
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
|
|
|
case META_GRAB_OP_RESIZING_W:
|
|
|
|
gravity = EastGravity;
|
|
|
|
break;
|
2002-06-19 00:12:49 -04:00
|
|
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
|
|
|
gravity = CenterGravity;
|
|
|
|
break;
|
2002-03-17 12:22:23 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gravity;
|
|
|
|
}
|
2002-05-23 22:23:46 -04:00
|
|
|
|
2002-06-08 19:55:27 -04:00
|
|
|
static MetaScreen*
|
|
|
|
find_screen_for_selection (MetaDisplay *display,
|
|
|
|
Window owner,
|
|
|
|
Atom selection)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
tmp = display->screens;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaScreen *screen = tmp->data;
|
|
|
|
|
|
|
|
if (screen->wm_sn_selection_window == owner &&
|
|
|
|
screen->wm_sn_atom == selection)
|
|
|
|
return screen;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-07-10 10:41:19 -04:00
|
|
|
/* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */
|
2002-06-08 19:55:27 -04:00
|
|
|
static gboolean
|
|
|
|
convert_property (MetaDisplay *display,
|
|
|
|
MetaScreen *screen,
|
|
|
|
Window w,
|
|
|
|
Atom target,
|
|
|
|
Atom property)
|
|
|
|
{
|
|
|
|
#define N_TARGETS 4
|
|
|
|
Atom conversion_targets[N_TARGETS];
|
|
|
|
long icccm_version[] = { 2, 0 };
|
|
|
|
|
|
|
|
conversion_targets[0] = display->atom_targets;
|
|
|
|
conversion_targets[1] = display->atom_multiple;
|
|
|
|
conversion_targets[2] = display->atom_timestamp;
|
|
|
|
conversion_targets[3] = display->atom_version;
|
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_push_with_return (display);
|
2002-06-08 19:55:27 -04:00
|
|
|
if (target == display->atom_targets)
|
|
|
|
XChangeProperty (display->xdisplay, w, property,
|
|
|
|
XA_ATOM, 32, PropModeReplace,
|
|
|
|
(unsigned char *)conversion_targets, N_TARGETS);
|
|
|
|
else if (target == display->atom_timestamp)
|
|
|
|
XChangeProperty (display->xdisplay, w, property,
|
|
|
|
XA_INTEGER, 32, PropModeReplace,
|
|
|
|
(unsigned char *)&screen->wm_sn_timestamp, 1);
|
|
|
|
else if (target == display->atom_version)
|
|
|
|
XChangeProperty (display->xdisplay, w, property,
|
|
|
|
XA_INTEGER, 32, PropModeReplace,
|
|
|
|
(unsigned char *)icccm_version, 2);
|
|
|
|
else
|
|
|
|
{
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop_with_return (display, FALSE);
|
2002-06-08 19:55:27 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
|
2002-06-08 19:55:27 -04:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Be sure the PropertyNotify has arrived so we
|
|
|
|
* can send SelectionNotify
|
|
|
|
*/
|
2002-10-21 17:44:35 -04:00
|
|
|
/* FIXME the error trap pop synced anyway, right? */
|
2002-11-06 11:00:56 -05:00
|
|
|
meta_topic (META_DEBUG_SYNC, "Syncing on %s\n", G_GNUC_FUNCTION);
|
2002-06-08 19:55:27 -04:00
|
|
|
XSync (display->xdisplay, False);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-07-10 10:41:19 -04:00
|
|
|
/* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */
|
2002-06-08 19:55:27 -04:00
|
|
|
static void
|
|
|
|
process_selection_request (MetaDisplay *display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
XSelectionEvent reply;
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
screen = find_screen_for_selection (display,
|
|
|
|
event->xselectionrequest.owner,
|
|
|
|
event->xselectionrequest.selection);
|
|
|
|
|
|
|
|
if (screen == NULL)
|
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
str = XGetAtomName (display->xdisplay,
|
|
|
|
event->xselectionrequest.selection);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, TRUE);
|
2002-06-08 19:55:27 -04:00
|
|
|
|
|
|
|
meta_verbose ("Selection request with selection %s window 0x%lx not a WM_Sn selection we recognize\n",
|
|
|
|
str ? str : "(bad atom)", event->xselectionrequest.owner);
|
|
|
|
|
|
|
|
meta_XFree (str);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
reply.type = SelectionNotify;
|
|
|
|
reply.display = display->xdisplay;
|
|
|
|
reply.requestor = event->xselectionrequest.requestor;
|
|
|
|
reply.selection = event->xselectionrequest.selection;
|
|
|
|
reply.target = event->xselectionrequest.target;
|
|
|
|
reply.property = None;
|
|
|
|
reply.time = event->xselectionrequest.time;
|
|
|
|
|
|
|
|
if (event->xselectionrequest.target == display->atom_multiple)
|
|
|
|
{
|
|
|
|
if (event->xselectionrequest.property != None)
|
|
|
|
{
|
|
|
|
Atom type, *adata;
|
|
|
|
int i, format;
|
|
|
|
unsigned long num, rest;
|
|
|
|
unsigned char *data;
|
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_push_with_return (display);
|
|
|
|
if (XGetWindowProperty (display->xdisplay,
|
|
|
|
event->xselectionrequest.requestor,
|
|
|
|
event->xselectionrequest.property, 0, 256, False,
|
|
|
|
display->atom_atom_pair,
|
|
|
|
&type, &format, &num, &rest, &data) != Success)
|
|
|
|
{
|
|
|
|
meta_error_trap_pop_with_return (display, TRUE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (meta_error_trap_pop_with_return (display, TRUE) == Success)
|
2002-06-08 19:55:27 -04:00
|
|
|
{
|
|
|
|
/* FIXME: to be 100% correct, should deal with rest > 0,
|
|
|
|
* but since we have 4 possible targets, we will hardly ever
|
|
|
|
* meet multiple requests with a length > 8
|
|
|
|
*/
|
|
|
|
adata = (Atom*)data;
|
|
|
|
i = 0;
|
|
|
|
while (i < (int) num)
|
|
|
|
{
|
|
|
|
if (!convert_property (display, screen,
|
|
|
|
event->xselectionrequest.requestor,
|
|
|
|
adata[i], adata[i+1]))
|
|
|
|
adata[i+1] = None;
|
|
|
|
i += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
XChangeProperty (display->xdisplay,
|
|
|
|
event->xselectionrequest.requestor,
|
|
|
|
event->xselectionrequest.property,
|
|
|
|
display->atom_atom_pair,
|
|
|
|
32, PropModeReplace, data, num);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, FALSE);
|
2002-06-08 19:55:27 -04:00
|
|
|
meta_XFree (data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (event->xselectionrequest.property == None)
|
|
|
|
event->xselectionrequest.property = event->xselectionrequest.target;
|
|
|
|
|
|
|
|
if (convert_property (display, screen,
|
|
|
|
event->xselectionrequest.requestor,
|
|
|
|
event->xselectionrequest.target,
|
|
|
|
event->xselectionrequest.property))
|
|
|
|
reply.property = event->xselectionrequest.property;
|
|
|
|
}
|
|
|
|
|
|
|
|
XSendEvent (display->xdisplay,
|
|
|
|
event->xselectionrequest.requestor,
|
|
|
|
False, 0L, (XEvent*)&reply);
|
|
|
|
|
|
|
|
meta_verbose ("Handled selection request\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
process_selection_clear (MetaDisplay *display,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
|
|
|
/* We need to unmanage the screen on which we lost the selection */
|
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
screen = find_screen_for_selection (display,
|
|
|
|
event->xselectionclear.window,
|
|
|
|
event->xselectionclear.selection);
|
|
|
|
|
|
|
|
|
|
|
|
if (screen != NULL)
|
|
|
|
{
|
|
|
|
meta_verbose ("Got selection clear for screen %d on display %s\n",
|
|
|
|
screen->number, display->name);
|
|
|
|
|
|
|
|
meta_display_unmanage_screen (display, screen);
|
|
|
|
|
|
|
|
/* display and screen may both be invalid memory... */
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
str = XGetAtomName (display->xdisplay,
|
|
|
|
event->xselectionclear.selection);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (display, TRUE);
|
2002-06-08 19:55:27 -04:00
|
|
|
|
|
|
|
meta_verbose ("Selection clear with selection %s window 0x%lx not a WM_Sn selection we recognize\n",
|
|
|
|
str ? str : "(bad atom)", event->xselectionclear.window);
|
|
|
|
|
|
|
|
meta_XFree (str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_unmanage_screen (MetaDisplay *display,
|
|
|
|
MetaScreen *screen)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
display->screens = g_slist_remove (display->screens, screen);
|
|
|
|
|
|
|
|
if (display->screens == NULL)
|
|
|
|
meta_display_close (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_unmanage_windows_for_screen (MetaDisplay *display,
|
|
|
|
MetaScreen *screen)
|
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
GSList *winlist;
|
|
|
|
|
|
|
|
winlist = meta_display_list_windows (display);
|
|
|
|
|
|
|
|
/* Unmanage all windows */
|
|
|
|
tmp = winlist;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
meta_window_free (tmp->data);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
g_slist_free (winlist);
|
|
|
|
}
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_devirtualize_modifiers (MetaDisplay *display,
|
|
|
|
MetaVirtualModifier modifiers,
|
|
|
|
unsigned int *mask)
|
|
|
|
{
|
|
|
|
*mask = 0;
|
|
|
|
|
|
|
|
if (modifiers & META_VIRTUAL_SHIFT_MASK)
|
|
|
|
*mask |= ShiftMask;
|
|
|
|
if (modifiers & META_VIRTUAL_CONTROL_MASK)
|
|
|
|
*mask |= ControlMask;
|
|
|
|
if (modifiers & META_VIRTUAL_ALT_MASK)
|
|
|
|
*mask |= Mod1Mask;
|
|
|
|
if (modifiers & META_VIRTUAL_META_MASK)
|
|
|
|
*mask |= display->meta_mask;
|
|
|
|
if (modifiers & META_VIRTUAL_HYPER_MASK)
|
|
|
|
*mask |= display->hyper_mask;
|
|
|
|
if (modifiers & META_VIRTUAL_SUPER_MASK)
|
|
|
|
*mask |= display->super_mask;
|
|
|
|
if (modifiers & META_VIRTUAL_MOD2_MASK)
|
|
|
|
*mask |= Mod2Mask;
|
|
|
|
if (modifiers & META_VIRTUAL_MOD3_MASK)
|
|
|
|
*mask |= Mod3Mask;
|
|
|
|
if (modifiers & META_VIRTUAL_MOD4_MASK)
|
|
|
|
*mask |= Mod4Mask;
|
|
|
|
if (modifiers & META_VIRTUAL_MOD5_MASK)
|
|
|
|
*mask |= Mod5Mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_window_grab_modifiers (MetaDisplay *display)
|
|
|
|
|
|
|
|
{
|
|
|
|
MetaVirtualModifier virtual_mods;
|
|
|
|
unsigned int mods;
|
|
|
|
|
|
|
|
virtual_mods = meta_prefs_get_mouse_button_mods ();
|
|
|
|
meta_display_devirtualize_modifiers (display, virtual_mods,
|
|
|
|
&mods);
|
|
|
|
|
|
|
|
display->window_grab_modifiers = mods;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
prefs_changed_callback (MetaPreference pref,
|
|
|
|
void *data)
|
|
|
|
{
|
2006-02-16 15:26:05 -05:00
|
|
|
MetaDisplay *display = data;
|
|
|
|
|
2003-10-13 16:15:40 -04:00
|
|
|
/* It may not be obvious why we regrab on focus mode
|
|
|
|
* change; it's because we handle focus clicks a
|
|
|
|
* bit differently for the different focus modes.
|
|
|
|
*/
|
|
|
|
if (pref == META_PREF_MOUSE_BUTTON_MODS ||
|
|
|
|
pref == META_PREF_FOCUS_MODE)
|
2002-10-07 19:14:40 -04:00
|
|
|
{
|
|
|
|
MetaDisplay *display = data;
|
|
|
|
GSList *windows;
|
|
|
|
GSList *tmp;
|
2003-10-13 16:15:40 -04:00
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
windows = meta_display_list_windows (display);
|
|
|
|
|
|
|
|
/* Ungrab all */
|
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
|
|
|
meta_display_ungrab_window_buttons (display, w->xwindow);
|
2003-10-13 16:15:40 -04:00
|
|
|
meta_display_ungrab_focus_window_button (display, w);
|
2002-10-07 19:14:40 -04:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2003-10-13 16:15:40 -04:00
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
/* change our modifier */
|
2003-10-13 16:15:40 -04:00
|
|
|
if (pref == META_PREF_MOUSE_BUTTON_MODS)
|
|
|
|
update_window_grab_modifiers (display);
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
|
|
/* Grab all */
|
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
2003-10-13 16:15:40 -04:00
|
|
|
meta_display_grab_focus_window_button (display, w);
|
2002-10-07 19:14:40 -04:00
|
|
|
meta_display_grab_window_buttons (display, w->xwindow);
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
2003-01-28 10:07:43 -05:00
|
|
|
else if (pref == META_PREF_AUDIBLE_BELL)
|
|
|
|
{
|
|
|
|
meta_bell_set_audible (display, meta_prefs_bell_is_audible ());
|
|
|
|
}
|
2006-02-16 15:26:05 -05:00
|
|
|
else if (pref == META_PREF_COMPOSITING_MANAGER)
|
|
|
|
{
|
|
|
|
gboolean cm = meta_prefs_get_compositing_manager ();
|
|
|
|
|
|
|
|
if (cm)
|
|
|
|
enable_compositor (display);
|
|
|
|
else
|
|
|
|
disable_compositor (display);
|
|
|
|
}
|
2002-10-07 19:14:40 -04:00
|
|
|
}
|
2003-05-30 16:24:00 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_increment_focus_sentinel (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
unsigned long data[1];
|
|
|
|
|
|
|
|
data[0] = meta_display_get_current_time (display);
|
|
|
|
|
|
|
|
XChangeProperty (display->xdisplay,
|
|
|
|
((MetaScreen*) display->screens->data)->xroot,
|
|
|
|
display->atom_metacity_sentinel,
|
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
|
|
|
|
|
|
|
display->sentinel_counter += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_decrement_focus_sentinel (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
display->sentinel_counter -= 1;
|
|
|
|
|
|
|
|
if (display->sentinel_counter < 0)
|
|
|
|
display->sentinel_counter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_display_focus_sentinel_clear (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
return (display->sentinel_counter == 0);
|
|
|
|
}
|
2004-10-04 17:09:08 -04:00
|
|
|
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
static void
|
|
|
|
sanity_check_timestamps (MetaDisplay *display,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
{
|
|
|
|
if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_focus_time))
|
|
|
|
{
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
meta_warning ("last_focus_time (%u) is greater than comparison "
|
|
|
|
"timestamp (%u). This most likely represents a buggy "
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
"client sending inaccurate timestamps in messages such as "
|
|
|
|
"_NET_ACTIVE_WINDOW. Trying to work around...\n",
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
display->last_focus_time, timestamp);
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
display->last_focus_time = timestamp;
|
|
|
|
}
|
|
|
|
if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_user_time))
|
|
|
|
{
|
|
|
|
GSList *windows;
|
|
|
|
GSList *tmp;
|
|
|
|
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
meta_warning ("last_user_time (%u) is greater than comparison "
|
|
|
|
"timestamp (%u). This most likely represents a buggy "
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
"client sending inaccurate timestamps in messages such as "
|
|
|
|
"_NET_ACTIVE_WINDOW. Trying to work around...\n",
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
display->last_user_time, timestamp);
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
display->last_user_time = timestamp;
|
|
|
|
|
|
|
|
windows = meta_display_list_windows (display);
|
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
|
|
|
if (XSERVER_TIME_IS_BEFORE (timestamp, window->net_wm_user_time))
|
|
|
|
{
|
|
|
|
meta_warning ("%s appears to be one of the offending windows "
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"with a timestamp of %u. Working around...\n",
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
window->desc, window->net_wm_user_time);
|
|
|
|
window->net_wm_user_time = timestamp;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (windows);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
timestamp_too_old (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 *timestamp)
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
{
|
|
|
|
/* FIXME: If Soeren's suggestion in bug 151984 is implemented, it will allow
|
|
|
|
* us to sanity check the timestamp here and ensure it doesn't correspond to
|
|
|
|
* a future time (though we would want to rename to
|
|
|
|
* timestamp_too_old_or_in_future).
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (*timestamp == CurrentTime)
|
|
|
|
{
|
|
|
|
meta_warning ("Got a request to focus %s with a timestamp of 0. This "
|
|
|
|
"shouldn't happen!\n",
|
|
|
|
window ? window->desc : "the no_focus_window");
|
|
|
|
meta_print_backtrace ();
|
|
|
|
*timestamp = meta_display_get_current_time_roundtrip (display);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (XSERVER_TIME_IS_BEFORE (*timestamp, display->last_focus_time))
|
|
|
|
{
|
|
|
|
if (XSERVER_TIME_IS_BEFORE (*timestamp, display->last_user_time))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"Ignoring focus request for %s since %u "
|
|
|
|
"is less than %u and %u.\n",
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
window ? window->desc : "the no_focus_window",
|
|
|
|
*timestamp,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
display->last_user_time,
|
|
|
|
display->last_focus_time);
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Received focus request for %s which is newer than most "
|
|
|
|
"recent user_time, but less recent than "
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
"last_focus_time (%u < %u < %u); adjusting "
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
"accordingly. (See bug 167358)\n",
|
|
|
|
window ? window->desc : "the no_focus_window",
|
|
|
|
display->last_user_time,
|
|
|
|
*timestamp,
|
|
|
|
display->last_focus_time);
|
|
|
|
*timestamp = display->last_focus_time;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-12-23 01:44:56 -05:00
|
|
|
void
|
|
|
|
meta_display_set_input_focus_window (MetaDisplay *display,
|
|
|
|
MetaWindow *window,
|
|
|
|
gboolean focus_frame,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2004-12-23 01:44:56 -05:00
|
|
|
{
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
if (timestamp_too_old (display, window, ×tamp))
|
2004-12-23 01:44:56 -05:00
|
|
|
return;
|
|
|
|
|
|
|
|
XSetInputFocus (display->xdisplay,
|
|
|
|
focus_frame ? window->frame->xwindow : window->xwindow,
|
|
|
|
RevertToPointerRoot,
|
|
|
|
timestamp);
|
|
|
|
display->expected_focus_window = window;
|
|
|
|
display->last_focus_time = timestamp;
|
2006-01-30 12:22:14 -05:00
|
|
|
display->active_screen = window->screen;
|
2004-12-23 01:44:56 -05:00
|
|
|
|
|
|
|
if (window != display->autoraise_window)
|
|
|
|
meta_display_remove_autoraise_callback (window->display);
|
|
|
|
}
|
|
|
|
|
2004-10-04 17:09:08 -04:00
|
|
|
void
|
|
|
|
meta_display_focus_the_no_focus_window (MetaDisplay *display,
|
2005-12-28 01:24:30 -05:00
|
|
|
MetaScreen *screen,
|
Fix issues on 64-bit machines with timestamps by using guint32 (like gtk+
2006-09-13 Elijah Newren <newren gmail com>
* src/common.h (MetaWindowMenuFunc):
* src/core.[ch] (meta_core_user_lower_and_unfocus,
meta_core_user_focus, meta_core_show_window_menu,
meta_core_begin_grab_op, meta_core_end_grab_op):
* src/delete.c (delete_ping_reply_func, delete_ping_timeout_func,
meta_window_delete):
* src/display.[ch] (struct MetaDisplay, struct MetaPingData,
sanity_check_timestamps, meta_display_open, event_callback,
meta_spew_event, meta_display_set_grab_op_cursor,
meta_display_begin_grab_op, meta_display_end_grab_op,
meta_display_ping_timeout, meta_display_ping_window,
process_pong_message, timestamp_too_old,
meta_display_set_input_focus_window):
* src/keybindings.[ch] (grab_keyboard, ungrab_keyboard,
meta_screen_grab_all_keys, meta_window_grab_all_keys,
meta_window_ungrab_all_keys, error_on_generic_command,
error_on_command, error_on_terminal_command):
* src/metacity-dialog.c (on_realize, warn_about_no_sm_support,
error_about_command, main):
* src/screen.[ch] (struct _MetaScreen, meta_screen_new,
meta_screen_show_desktop, meta_screen_apply_startup_properties):
* src/session.c (warn_about_lame_clients_and_finish_interact):
* src/window.[ch] (struct _MetaWindow,
intervening_user_event_occurred, window_activate,
meta_window_delete, meta_window_focus,
meta_window_send_icccm_message, meta_window_client_message,
menu_callback, meta_window_show_menu, struct EventScannerData,
check_use_this_motion_notify, meta_window_begin_grab_op,
meta_window_set_user_time):
* src/workspace.[ch] (focus_ancestor_or_mru_window,
meta_workspace_activate_with_focus, meta_workspace_activate,
meta_workspace_focus_default_window,
focus_ancestor_or_mru_window):
Fix issues on 64-bit machines with timestamps by using guint32
(like gtk+ does) instead of Time. #348305
2006-09-13 12:32:33 -04:00
|
|
|
guint32 timestamp)
|
2004-10-04 17:09:08 -04:00
|
|
|
{
|
Big patch to cover about 6 different issues in order to correct rare
2005-02-20 Elijah Newren <newren@gmail.com>
Big patch to cover about 6 different issues in order to correct
rare problems with timestamps (make sure window selected in
tasklist actually gets focus, sanity check timestamps to avoid
rogue apps hosing the system, correct the updating of
net_wm_user_time, correctly handle timestamps of 0 when comparing
xserver timestamps for those who have had their systems up for
over 25 days or so, add some debugging information to verbose
logs, some code cleanups). Fixes all issues listed in #167358.
* src/display.h: (struct _MetaDisplay): clarify comment on
last_focus_time, introduce a new variable--last_user_time,
(XSERVER_TIME_IS_BEFORE macro): put this functionality into a
separate macro and then introduce a new macro with this name that
uses the old one but adds additional special-case checks for
timestamps that are 0, (comment to
meta_display_set_input_focus_window): add information about how
last_user_time should be used in this function
* src/display.c (santiy_check_timestamps): new function,
(meta_display_open): intialize display->last_user_time,
(meta_display_get_current_time_roundtrip): use the timestamp,
which is known to be good, in order to sanity_check_timestamps,
(event_callback): use the new meta_window_ste_user_time() function
in order to correct problems, use the timestamp of KeyPress and
ButtonPress events, which are known to be good, in order to
sanity_check_timestamps, (timestamp_too_old): new function for
common behavior of meta_display_focus_the_no_focus_window and
meta_display_set_input_focus_window, with added checking for
display->last_user_time in addition to display->last_focus_time,
(meta_display_set_input_focus_window): replace some of the code
with a call to timestamp_too_old(),
(meta_display_focus_the_no_focus_window): replace some of th ecode
with a call to timestamp_too_old()
* src/window.h: (meta_window_set_user_time): new function to
abstract the many things that need to be done when updating the
net_wm_user_time of any window
* src/window.c: (meta_window_activate): add debugging spew, make
sure the comparison is made with last_user_time NOT
last_focus_time, use meta_window_set_user_time() function in order
to correct problems, (meta_window_client_message): add a newline
to a debugging message to make them easier to read,
(meta_window_set_user_time): new function
* src/window-props.c (reload_net_wm_user_time): use the new
meta_window_ste_user_time() function in order to correct problems
2005-02-20 12:14:16 -05:00
|
|
|
if (timestamp_too_old (display, NULL, ×tamp))
|
2004-12-23 01:44:56 -05:00
|
|
|
return;
|
|
|
|
|
2004-10-04 17:09:08 -04:00
|
|
|
XSetInputFocus (display->xdisplay,
|
2005-12-28 01:24:30 -05:00
|
|
|
screen->no_focus_window,
|
2004-10-04 17:09:08 -04:00
|
|
|
RevertToPointerRoot,
|
|
|
|
timestamp);
|
2004-10-08 17:57:01 -04:00
|
|
|
display->expected_focus_window = NULL;
|
2004-12-23 01:44:56 -05:00
|
|
|
display->last_focus_time = timestamp;
|
2006-01-30 12:22:14 -05:00
|
|
|
display->active_screen = screen;
|
2004-12-23 01:44:56 -05:00
|
|
|
|
2004-10-04 17:09:08 -04:00
|
|
|
meta_display_remove_autoraise_callback (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_display_remove_autoraise_callback (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
if (display->autoraise_timeout_id != 0)
|
|
|
|
{
|
|
|
|
g_source_remove (display->autoraise_timeout_id);
|
|
|
|
display->autoraise_timeout_id = 0;
|
|
|
|
display->autoraise_window = NULL;
|
|
|
|
}
|
|
|
|
}
|