Commit 85826d0d authored by Rob Adams's avatar Rob Adams Committed by Rob Adams
Browse files

Remove legacy support for Gnome 1 hints, since we deem it unlikely that

2003-06-12  Rob Adams  <robadams@ucla.edu>

	Remove legacy support for Gnome 1 hints, since we deem it unlikely
	that anyone is running a current metacity with Gnome 1.  The
	removed hints are _WIN_WORKSPACE, _WIN_LAYER, _WIN_PROTOCOLS,
	_WIN_SUPPORTING_WM_CHECK, and _WIN_HINTS.

	* display.c (meta_display_open): remove hints

	* display.h: remove atoms for hints

	* screen.c (set_wm_check_hint): don't set legacy hint
	(set_supported_hint): don't set legacy hint

	* window-props.c (init_win_workspace): removed
	(reload_win_workspace): removed
	(meta_display_init_window_prop_hooks): remove hints

	* window.h: remove do_not_cover flag

	* window.c: remove GnomeWinHints enum
	(recalc_do_not_cover_struts): removed
	(meta_window_new): don't initialize removed flags or compute
	legacy struts
	(move_resize_cmp): removed
	(idle_move_resize): Don't bother sorting the idle queue
	(meta_window_client_message): don't set legacy hint
	(process_property_notify): remove hints
	(update_net_wm_type): don't fall back to WIN_LAYER hint
	(update_struts): remove legacy struts
parent 0a204196
2003-06-12 Rob Adams <robadams@ucla.edu>
Remove legacy support for Gnome 1 hints, since we deem it unlikely
that anyone is running a current metacity with Gnome 1. The
removed hints are _WIN_WORKSPACE, _WIN_LAYER, _WIN_PROTOCOLS,
_WIN_SUPPORTING_WM_CHECK, and _WIN_HINTS.
* display.c (meta_display_open): remove hints
* display.h: remove atoms for hints
* screen.c (set_wm_check_hint): don't set legacy hint
(set_supported_hint): don't set legacy hint
* window-props.c (init_win_workspace): removed
(reload_win_workspace): removed
(meta_display_init_window_prop_hooks): remove hints
* window.h: remove do_not_cover flag
* window.c: remove GnomeWinHints enum
(recalc_do_not_cover_struts): removed
(meta_window_new): don't initialize removed flags or compute
legacy struts
(move_resize_cmp): removed
(idle_move_resize): Don't bother sorting the idle queue
(meta_window_client_message): don't set legacy hint
(process_property_notify): remove hints
(update_net_wm_type): don't fall back to WIN_LAYER hint
(update_struts): remove legacy struts
2003-06-12 Havoc Pennington <hp@pobox.com>
* src/display.c (event_callback): make raise-on-click explicitly
......
......@@ -216,10 +216,6 @@ meta_display_open (const char *name)
"_NET_CLIENT_LIST_STACKING",
"_NET_WM_STATE_SKIP_TASKBAR",
"_NET_WM_STATE_SKIP_PAGER",
"_WIN_WORKSPACE",
"_WIN_LAYER",
"_WIN_PROTOCOLS",
"_WIN_SUPPORTING_WM_CHECK",
"_NET_WM_ICON_NAME",
"_NET_WM_ICON",
"_NET_WM_ICON_GEOMETRY",
......@@ -230,7 +226,6 @@ meta_display_open (const char *name)
"_NET_ACTIVE_WINDOW",
"_METACITY_RESTART_MESSAGE",
"_NET_WM_STRUT",
"_WIN_HINTS",
"_METACITY_RELOAD_THEME_MESSAGE",
"_METACITY_SET_KEYBINDINGS_MESSAGE",
"_NET_WM_STATE_HIDDEN",
......@@ -363,59 +358,54 @@ meta_display_open (const char *name)
display->atom_net_client_list_stacking = atoms[29];
display->atom_net_wm_state_skip_taskbar = atoms[30];
display->atom_net_wm_state_skip_pager = atoms[31];
display->atom_win_workspace = atoms[32];
display->atom_win_layer = atoms[33];
display->atom_win_protocols = atoms[34];
display->atom_win_supporting_wm_check = atoms[35];
display->atom_net_wm_icon_name = atoms[36];
display->atom_net_wm_icon = atoms[37];
display->atom_net_wm_icon_geometry = atoms[38];
display->atom_utf8_string = atoms[39];
display->atom_wm_icon_size = atoms[40];
display->atom_kwm_win_icon = atoms[41];
display->atom_net_wm_moveresize = atoms[42];
display->atom_net_active_window = atoms[43];
display->atom_metacity_restart_message = atoms[44];
display->atom_net_wm_strut = atoms[45];
display->atom_win_hints = atoms[46];
display->atom_metacity_reload_theme_message = atoms[47];
display->atom_metacity_set_keybindings_message = atoms[48];
display->atom_net_wm_state_hidden = atoms[49];
display->atom_net_wm_window_type_utility = atoms[50];
display->atom_net_wm_window_type_splash = atoms[51];
display->atom_net_wm_state_fullscreen = atoms[52];
display->atom_net_wm_ping = atoms[53];
display->atom_net_wm_pid = atoms[54];
display->atom_wm_client_machine = atoms[55];
display->atom_net_workarea = atoms[56];
display->atom_net_showing_desktop = atoms[57];
display->atom_net_desktop_layout = atoms[58];
display->atom_manager = atoms[59];
display->atom_targets = atoms[60];
display->atom_multiple = atoms[61];
display->atom_timestamp = atoms[62];
display->atom_version = atoms[63];
display->atom_atom_pair = atoms[64];
display->atom_net_desktop_names = atoms[65];
display->atom_net_wm_allowed_actions = atoms[66];
display->atom_net_wm_action_move = atoms[67];
display->atom_net_wm_action_resize = atoms[68];
display->atom_net_wm_action_shade = atoms[69];
display->atom_net_wm_action_stick = atoms[70];
display->atom_net_wm_action_maximize_horz = atoms[71];
display->atom_net_wm_action_maximize_vert = atoms[72];
display->atom_net_wm_action_change_desktop = atoms[73];
display->atom_net_wm_action_close = atoms[74];
display->atom_net_wm_state_above = atoms[75];
display->atom_net_wm_state_below = atoms[76];
display->atom_net_startup_id = atoms[77];
display->atom_metacity_toggle_verbose = atoms[78];
display->atom_metacity_update_counter = atoms[79];
display->atom_sync_counter = atoms[80];
display->atom_gnome_panel_action = atoms[81];
display->atom_gnome_panel_action_main_menu = atoms[82];
display->atom_gnome_panel_action_run_dialog = atoms[83];
display->atom_metacity_sentinel = atoms[84];
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];
display->atom_metacity_update_counter = atoms[74];
display->atom_sync_counter = atoms[75];
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];
display->prop_hooks = NULL;
meta_display_init_window_prop_hooks (display);
......@@ -563,20 +553,9 @@ meta_display_open (const char *name)
display->leader_window,
display->atom_net_wm_name,
"Metacity");
{
/* The legacy GNOME hint is to set a cardinal which is the window
* id of the supporting_wm_check window on the supporting_wm_check
* window itself
*/
gulong data[1];
data[0] = display->leader_window;
XChangeProperty (display->xdisplay,
display->leader_window,
display->atom_win_supporting_wm_check,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
XChangeProperty (display->xdisplay,
display->leader_window,
......@@ -584,7 +563,7 @@ meta_display_open (const char *name)
XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
}
meta_display_grab (display);
/* Now manage all existing windows */
......
......@@ -120,10 +120,6 @@ struct _MetaDisplay
Atom atom_net_client_list_stacking;
Atom atom_net_wm_state_skip_taskbar;
Atom atom_net_wm_state_skip_pager;
Atom atom_win_workspace;
Atom atom_win_layer;
Atom atom_win_protocols;
Atom atom_win_supporting_wm_check;
Atom atom_net_wm_icon_name;
Atom atom_net_wm_icon;
Atom atom_net_wm_icon_geometry;
......@@ -134,7 +130,6 @@ struct _MetaDisplay
Atom atom_net_active_window;
Atom atom_metacity_restart_message;
Atom atom_net_wm_strut;
Atom atom_win_hints;
Atom atom_metacity_reload_theme_message;
Atom atom_metacity_set_keybindings_message;
Atom atom_net_wm_state_hidden;
......
......@@ -75,16 +75,6 @@ set_wm_check_hint (MetaScreen *screen)
XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
/* Legacy GNOME hint (uses cardinal, dunno why) */
/* do this after setting up window fully, to avoid races
* with clients listening to property notify on root.
*/
XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom_win_supporting_wm_check,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
return Success;
}
......@@ -145,14 +135,6 @@ set_supported_hint (MetaScreen *screen)
screen->display->atom_net_supported,
XA_ATOM,
32, PropModeReplace, (guchar*) atoms, N_SUPPORTED);
/* Set legacy GNOME hints */
atoms[0] = screen->display->atom_win_layer;
XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom_win_protocols,
XA_ATOM,
32, PropModeReplace, (guchar*) atoms, N_WIN_SUPPORTED);
return Success;
#undef N_SUPPORTED
......
......@@ -354,40 +354,6 @@ reload_net_wm_desktop (MetaWindow *window,
}
}
static void
init_win_workspace (MetaDisplay *display,
Atom property,
MetaPropValue *value)
{
value->type = META_PROP_VALUE_CARDINAL;
value->atom = display->atom_win_workspace;
}
static void
reload_win_workspace (MetaWindow *window,
MetaPropValue *value)
{
if (value->type != META_PROP_VALUE_INVALID)
{
meta_topic (META_DEBUG_PLACEMENT,
"Read legacy GNOME workspace prop %d for %s\n",
(int) value->v.cardinal, window->desc);
if (window->initial_workspace_set)
{
meta_topic (META_DEBUG_PLACEMENT,
"Ignoring legacy GNOME workspace prop %d for %s as we already set initial workspace\n",
(int) value->v.cardinal, window->desc);
}
else
{
window->initial_workspace_set = TRUE;
window->initial_workspace = value->v.cardinal;
}
}
}
static void
init_net_startup_id (MetaDisplay *display,
Atom property,
......@@ -848,7 +814,7 @@ reload_wm_hints (MetaWindow *window,
#define N_HOOKS 25
#define N_HOOKS 22
void
meta_display_init_window_prop_hooks (MetaDisplay *display)
......@@ -938,31 +904,16 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
hooks[i].reload_func = NULL;
++i;
hooks[i].property = display->atom_win_layer;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
++i;
hooks[i].property = display->atom_net_wm_desktop;
hooks[i].init_func = init_net_wm_desktop;
hooks[i].reload_func = reload_net_wm_desktop;
++i;
hooks[i].property = display->atom_win_workspace;
hooks[i].init_func = init_win_workspace;
hooks[i].reload_func = reload_win_workspace;
++i;
hooks[i].property = display->atom_net_wm_strut;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
++i;
hooks[i].property = display->atom_win_hints;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
++i;
hooks[i].property = display->atom_net_startup_id;
hooks[i].init_func = init_net_startup_id;
hooks[i].reload_func = reload_net_startup_id;
......
......@@ -54,16 +54,6 @@ typedef enum
META_USER_MOVE_RESIZE = 1 << 2
} MetaMoveResizeFlags;
typedef enum
{
WIN_HINTS_SKIP_FOCUS = (1<<0), /* "alt-tab" skips this win */
WIN_HINTS_SKIP_WINLIST = (1<<1), /* not in win list */
WIN_HINTS_SKIP_TASKBAR = (1<<2), /* not on taskbar */
WIN_HINTS_GROUP_TRANSIENT = (1<<3), /* ??????? */
WIN_HINTS_FOCUS_ON_CLICK = (1<<4), /* app only accepts focus when clicked */
WIN_HINTS_DO_NOT_COVER = (1<<5) /* attempt to not cover this window */
} GnomeWinHints;
static int destroying_windows_disallowed = 0;
......@@ -77,7 +67,6 @@ static void update_net_wm_type (MetaWindow *window);
static void update_struts (MetaWindow *window);
static void recalc_window_type (MetaWindow *window);
static void recalc_window_features (MetaWindow *window);
static void recalc_do_not_cover_struts(MetaWindow *window);
static void invalidate_work_areas (MetaWindow *window);
static void set_wm_state (MetaWindow *window,
int state);
......@@ -192,7 +181,7 @@ meta_window_new (MetaDisplay *display,
MetaWorkspace *space;
gulong existing_wm_state;
gulong event_mask;
#define N_INITIAL_PROPS 13
#define N_INITIAL_PROPS 12
Atom initial_props[N_INITIAL_PROPS];
int i;
gboolean has_shape;
......@@ -491,7 +480,6 @@ meta_window_new (MetaDisplay *display,
window->type_atom = None;
window->has_struts = FALSE;
window->do_not_cover = FALSE;
window->left_strut = 0;
window->right_strut = 0;
window->top_strut = 0;
......@@ -520,7 +508,6 @@ meta_window_new (MetaDisplay *display,
initial_props[i++] = display->atom_net_wm_icon_name;
initial_props[i++] = XA_WM_ICON_NAME;
initial_props[i++] = display->atom_net_wm_desktop;
initial_props[i++] = display->atom_win_workspace;
initial_props[i++] = display->atom_net_startup_id;
initial_props[i++] = display->atom_metacity_update_counter;
initial_props[i++] = XA_WM_NORMAL_HINTS;
......@@ -2609,22 +2596,6 @@ meta_window_move_resize_internal (MetaWindow *window,
meta_topic (META_DEBUG_GEOMETRY, "Size/position not modified\n");
}
/* Update struts for new window size */
if (window->do_not_cover && (need_resize_client || need_move_client))
{
recalc_do_not_cover_struts (window);
/* Does a resize on all windows on entire current workspace,
* would be an infinite loop except for need_resize_client
* above. We rely on reaching an equilibrium state, which
* is somewhat fragile, though.
*/
meta_topic (META_DEBUG_WORKAREA, "Window %s resized so invalidating its work areas\n",
window->desc);
invalidate_work_areas (window);
}
meta_window_refresh_resize_popup (window);
/* Invariants leaving this function are:
......@@ -2799,23 +2770,6 @@ meta_window_fill_vertical (MetaWindow *window)
static guint move_resize_idle = 0;
static GSList *move_resize_pending = NULL;
/* We want to put windows whose size/pos affects other
* windows earlier in the queue, for efficiency.
*/
static int
move_resize_cmp (gconstpointer a, gconstpointer b)
{
MetaWindow *aw = (gpointer) a;
MetaWindow *bw = (gpointer) b;
if (aw->do_not_cover && !bw->do_not_cover)
return -1; /* aw before bw */
else if (!aw->do_not_cover && bw->do_not_cover)
return 1;
else
return 0;
}
static gboolean
idle_move_resize (gpointer data)
{
......@@ -2834,8 +2788,6 @@ idle_move_resize (gpointer data)
move_resize_idle = 0;
destroying_windows_disallowed += 1;
copy = g_slist_sort (copy, move_resize_cmp);
tmp = copy;
while (tmp != NULL)
......@@ -3884,46 +3836,6 @@ meta_window_client_message (MetaWindow *window,
return TRUE;
}
else if (event->xclient.message_type ==
display->atom_win_hints)
{
/* gnome-winhints.c seems to indicate that the hints are
* in l[1], though god knows why it's like that
*/
gulong data[1];
meta_verbose ("_WIN_HINTS client message, hints: %ld\n",
event->xclient.data.l[1]);
if (event->xclient.data.l[1] & WIN_HINTS_DO_NOT_COVER)
{
meta_topic (META_DEBUG_WORKAREA,
"Setting WIN_HINTS_DO_NOT_COVER\n");
data[0] = WIN_HINTS_DO_NOT_COVER;
meta_error_trap_push (window->display);
XChangeProperty (window->display->xdisplay,
window->xwindow, window->display->atom_win_hints,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *)data, 1);
meta_error_trap_pop (window->display, FALSE);
}
else
{
meta_topic (META_DEBUG_WORKAREA,
"Unsetting WIN_HINTS_DO_NOT_COVER\n");
data[0] = 0;
meta_error_trap_push (window->display);
XDeleteProperty (window->display->xdisplay,
window->xwindow, window->display->atom_win_hints);
meta_error_trap_pop (window->display, FALSE);
}
return TRUE;
}
return FALSE;
}
......@@ -4184,11 +4096,9 @@ process_property_notify (MetaWindow *window,
meta_warning ("Broken client! Window %s changed client leader window or SM client ID\n", window->desc);
}
else if (event->atom ==
window->display->atom_net_wm_window_type ||
/* update_net_wm_type falls back to this */
event->atom == window->display->atom_win_layer)
window->display->atom_net_wm_window_type)
{
meta_verbose ("Property notify on %s for NET_WM_WINDOW_TYPE or WIN_LAYER\n", window->desc);
meta_verbose ("Property notify on %s for NET_WM_WINDOW_TYPE\n", window->desc);
update_net_wm_type (window);
}
else if (event->atom == window->display->atom_net_wm_icon)
......@@ -4213,11 +4123,6 @@ process_property_notify (MetaWindow *window,
meta_verbose ("Property notify on %s for _NET_WM_STRUT\n", window->desc);
update_struts (window);
}
else if (event->atom == window->display->atom_win_hints)
{
meta_verbose ("Property notify on %s for _WIN_HINTS\n", window->desc);
update_struts (window);
}
else if (event->atom == window->display->atom_net_startup_id)
{
meta_verbose ("Property notify on %s for _NET_STARTUP_ID\n", window->desc);
......@@ -4687,41 +4592,12 @@ update_net_wm_type (MetaWindow *window)
n_atoms = 0;
atoms = NULL;
if (!meta_prop_get_atom_list (window->display, window->xwindow,
window->display->atom_net_wm_window_type,
&atoms, &n_atoms))
{
/* Fall back to WIN_LAYER */
gulong layer = WIN_LAYER_NORMAL;
meta_prop_get_atom_list (window->display, window->xwindow,
window->display->atom_net_wm_window_type,
&atoms, &n_atoms);
if (meta_prop_get_cardinal (window->display,
window->xwindow,
window->display->atom_win_layer,
&layer))
{
meta_verbose ("%s falling back to _WIN_LAYER hint, layer %ld\n",
window->desc, layer);
switch (layer)
{
case WIN_LAYER_DESKTOP:
window->type_atom =
window->display->atom_net_wm_window_type_desktop;
break;
case WIN_LAYER_NORMAL:
window->type_atom =
window->display->atom_net_wm_window_type_normal;
break;
case WIN_LAYER_DOCK:
window->type_atom =
window->display->atom_net_wm_window_type_dock;
break;
default:
break;
}
}
recalc_window_type (window);
}
/* Fall back to a normal window */
window->type_atom = window->display->atom_net_wm_window_type_normal;
i = 0;
while (i < n_atoms)
......@@ -4941,7 +4817,6 @@ update_struts (MetaWindow *window)
gulong *struts = NULL;
int nitems;
gboolean old_has_struts;
gboolean old_do_not_cover;
int old_left;
int old_right;
int old_top;
......@@ -4950,14 +4825,12 @@ update_struts (MetaWindow *window)
meta_verbose ("Updating struts for %s\n", window->desc);
old_has_struts = window->has_struts;
old_do_not_cover = window->do_not_cover;
old_left = window->left_strut;
old_right = window->right_strut;
old_top = window->top_strut;
old_bottom = window->bottom_strut;
window->has_struts = FALSE;
window->do_not_cover = FALSE;
window->left_strut = 0;
window->right_strut = 0;
window->top_strut = 0;
......@@ -5007,42 +4880,8 @@ update_struts (MetaWindow *window)
meta_verbose ("No _NET_WM_STRUT property for %s\n",
window->desc);
}
if (!window->has_struts)
{
/* Try _WIN_HINTS */
gulong hints;
if (meta_prop_get_cardinal (window->display,
window->xwindow,
window->display->atom_win_hints,
&hints))
{
if (hints & WIN_HINTS_DO_NOT_COVER)
{
window->has_struts = TRUE;
window->do_not_cover = TRUE;
recalc_do_not_cover_struts (window);
meta_verbose ("Using _WIN_HINTS struts %d %d %d %d for window %s\n",
window->left_strut, window->right_strut,
window->top_strut, window->bottom_strut,
window->desc);
}
else
{
meta_verbose ("DO_NOT_COVER hint not set in _WIN_HINTS\n");
}
}
else
{
meta_verbose ("No _WIN_HINTS property on %s\n",
window->desc);
}
}
if (old_has_struts != window->has_struts ||
old_do_not_cover != window->do_not_cover ||
old_left != window->left_strut ||
old_right != window->right_strut ||
old_top != window->top_strut ||
......@@ -5060,61 +4899,6 @@ update_struts (MetaWindow *window)
}
}
static void
recalc_do_not_cover_struts (MetaWindow *window)
{
if (window->do_not_cover)
{
/* We only understand windows that are aligned to
* a screen edge
*/
gboolean horizontal;
gboolean on_left_edge;
gboolean on_right_edge;
gboolean on_bottom_edge;
gboolean on_top_edge;
window->left_strut = 0;
window->right_strut = 0;
window->top_strut = 0