diff --git a/ChangeLog b/ChangeLog index c622fae86..978721f5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2008-05-02 Thomas Thurman + + All information should live in exactly one place. This means + that the list of atoms should not be replicated anywhere. + Therefore, we include it via x-macros. Closes #530843. + + * src/core/atomnames.h: added list of atom names + * src/Makefile.am: added reference to new file + * src/core/display.h + * src/core/display.c (twice) + * src/core/screen.c: #included atomnames.h instead of having + an enormous list of atoms + * src/core/group-props.c + * src/core/window.c + * src/core/compositor.c + * src/core/window-props.c + * src/core/delete.c + * src/core/workspace.c + * src/core/stack.c + * src/core/keybindings.c + * src/core/iconcache.c + * src/core/group.c + * src/core/xprops.c: changed to new, simpler identifiers + for atoms + 2008-04-29 Chris Wang * src/core/window.c (meta_window_new): XGetWindowAttributes diff --git a/src/Makefile.am b/src/Makefile.am index 1679db5c7..e5f9e131e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,6 +7,7 @@ INCLUDES=@METACITY_CFLAGS@ -I $(srcdir)/include -DMETACITY_LIBEXECDIR=\"$(libexe metacity_SOURCES= \ core/async-getprop.c \ core/async-getprop.h \ + core/atomnames.h \ core/bell.c \ core/bell.h \ core/boxes.c \ diff --git a/src/core/atomnames.h b/src/core/atomnames.h new file mode 100644 index 000000000..18e5dcc0a --- /dev/null +++ b/src/core/atomnames.h @@ -0,0 +1,164 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (C) 2001 Havoc Pennington + * Copyright (C) 2002, 2003, 2004 Red Hat, Inc. + * Copyright (C) 2003, 2004 Rob Adams + * Copyright (C) 2004-2006 Elijah Newren + * Copyright (C) 2008 Thomas Thurman + * + * 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. + */ + +/** + * \file atomnames.h A list of atom names. + * + * This is a list of the names of all the X atoms that Metacity uses. + * Each is wrapped in a macro "item()" which is undefined here; the + * idea is that when you need to make a big list of all the X atoms, + * you can define item(), include this file, and then undefine it + * again. + * + * If you also define EWMH_ATOMS_ONLY then you will only get _NET_WM_* + * hints rather than all of them. + */ + +#ifndef item +#error "item(x) must be defined when you include atomnames.h" +#endif + +#ifndef EWMH_ATOMS_ONLY + +item(WM_PROTOCOLS) +item(WM_TAKE_FOCUS) +item(WM_DELETE_WINDOW) +item(WM_STATE) +item(_MOTIF_WM_HINTS) +item(WM_CHANGE_STATE) +item(SM_CLIENT_ID) +item(WM_CLIENT_LEADER) +item(WM_WINDOW_ROLE) +item(UTF8_STRING) +item(WM_ICON_SIZE) +item(_KWM_WIN_ICON) +item(_METACITY_RESTART_MESSAGE) +item(_METACITY_RELOAD_THEME_MESSAGE) +item(_METACITY_SET_KEYBINDINGS_MESSAGE) +item(_METACITY_TOGGLE_VERBOSE) +item(_GNOME_PANEL_ACTION) +item(_GNOME_PANEL_ACTION_MAIN_MENU) +item(_GNOME_PANEL_ACTION_RUN_DIALOG) +item(_METACITY_SENTINEL) +item(_METACITY_VERSION) +item(WM_CLIENT_MACHINE) +item(MANAGER) +item(TARGETS) +item(MULTIPLE) +item(TIMESTAMP) +item(VERSION) +item(ATOM_PAIR) + +/* Oddities: These are used, and we need atoms for them, + * but when we need all _NET_WM hints (i.e. when we're making + * lists of which _NET_WM hints we support in order to advertise + * it) we haven't historically listed them. I don't know what + * the reason for this is. It may be a bug. + */ +item(_NET_WM_SYNC_REQUEST) +item(_NET_WM_SYNC_REQUEST_COUNTER) +item(_NET_WM_VISIBLE_NAME) +item(_NET_WM_VISIBLE_ICON_NAME) +item(_NET_SUPPORTING_WM_CHECK) + +/* But I suppose it's quite reasonable not to advertise using + * _NET_SUPPORTED that we support _NET_SUPPORTED :) + */ +item(_NET_SUPPORTED) + +#endif /* !EWMH_ATOMS_ONLY */ + +/**************************************************************************/ + +item(_NET_WM_NAME) +item(_NET_CLOSE_WINDOW) +item(_NET_WM_STATE) +item(_NET_WM_STATE_SHADED) +item(_NET_WM_STATE_MAXIMIZED_HORZ) +item(_NET_WM_STATE_MAXIMIZED_VERT) +item(_NET_WM_DESKTOP) +item(_NET_NUMBER_OF_DESKTOPS) +item(_NET_CURRENT_DESKTOP) +item(_NET_WM_WINDOW_TYPE) +item(_NET_WM_WINDOW_TYPE_DESKTOP) +item(_NET_WM_WINDOW_TYPE_DOCK) +item(_NET_WM_WINDOW_TYPE_TOOLBAR) +item(_NET_WM_WINDOW_TYPE_MENU) +item(_NET_WM_WINDOW_TYPE_DIALOG) +item(_NET_WM_WINDOW_TYPE_NORMAL) +item(_NET_WM_STATE_MODAL) +item(_NET_CLIENT_LIST) +item(_NET_CLIENT_LIST_STACKING) +item(_NET_WM_STATE_SKIP_TASKBAR) +item(_NET_WM_STATE_SKIP_PAGER) +item(_NET_WM_ICON_NAME) +item(_NET_WM_ICON) +item(_NET_WM_ICON_GEOMETRY) +item(_NET_WM_MOVERESIZE) +item(_NET_ACTIVE_WINDOW) +item(_NET_WM_STRUT) +item(_NET_WM_STATE_HIDDEN) +item(_NET_WM_WINDOW_TYPE_UTILITY) +item(_NET_WM_WINDOW_TYPE_SPLASH) +item(_NET_WM_STATE_FULLSCREEN) +item(_NET_WM_PING) +item(_NET_WM_PID) +item(_NET_WORKAREA) +item(_NET_SHOWING_DESKTOP) +item(_NET_DESKTOP_LAYOUT) +item(_NET_DESKTOP_NAMES) +item(_NET_WM_ALLOWED_ACTIONS) +item(_NET_WM_ACTION_MOVE) +item(_NET_WM_ACTION_RESIZE) +item(_NET_WM_ACTION_SHADE) +item(_NET_WM_ACTION_STICK) +item(_NET_WM_ACTION_MAXIMIZE_HORZ) +item(_NET_WM_ACTION_MAXIMIZE_VERT) +item(_NET_WM_ACTION_CHANGE_DESKTOP) +item(_NET_WM_ACTION_CLOSE) +item(_NET_WM_STATE_ABOVE) +item(_NET_WM_STATE_BELOW) +item(_NET_STARTUP_ID) +item(_NET_WM_STRUT_PARTIAL) +item(_NET_WM_ACTION_FULLSCREEN) +item(_NET_WM_ACTION_MINIMIZE) +item(_NET_FRAME_EXTENTS) +item(_NET_REQUEST_FRAME_EXTENTS) +item(_NET_WM_USER_TIME) +item(_NET_WM_STATE_DEMANDS_ATTENTION) +item(_NET_MOVERESIZE_WINDOW) +item(_NET_DESKTOP_GEOMETRY) +item(_NET_DESKTOP_VIEWPORT) +item(_NET_WM_USER_TIME_WINDOW) +item(_NET_WM_ACTION_ABOVE) +item(_NET_WM_ACTION_BELOW) + +#if 0 +/* We apparently never use: */ +/* item(_NET_RESTACK_WINDOW) */ +#endif + +/* eof atomnames.h */ + diff --git a/src/core/compositor.c b/src/core/compositor.c index 4c44a6f04..f3f19a9a6 100644 --- a/src/core/compositor.c +++ b/src/core/compositor.c @@ -1675,20 +1675,20 @@ get_window_type (MetaDisplay *display, atoms = NULL; meta_prop_get_atom_list (display, cw->id, - display->atom_net_wm_window_type, + display->atom__NET_WM_WINDOW_TYPE, &atoms, &n_atoms); for (i = 0; i < n_atoms; i++) { if (atoms[i] == compositor->atom_net_wm_window_type_dnd || - atoms[i] == display->atom_net_wm_window_type_desktop || - atoms[i] == display->atom_net_wm_window_type_dock || - atoms[i] == display->atom_net_wm_window_type_toolbar || - atoms[i] == display->atom_net_wm_window_type_menu || - atoms[i] == display->atom_net_wm_window_type_dialog || - atoms[i] == display->atom_net_wm_window_type_normal || - atoms[i] == display->atom_net_wm_window_type_utility || - atoms[i] == display->atom_net_wm_window_type_splash) + atoms[i] == display->atom__NET_WM_WINDOW_TYPE_DESKTOP || + atoms[i] == display->atom__NET_WM_WINDOW_TYPE_DOCK || + atoms[i] == display->atom__NET_WM_WINDOW_TYPE_TOOLBAR || + atoms[i] == display->atom__NET_WM_WINDOW_TYPE_MENU || + atoms[i] == display->atom__NET_WM_WINDOW_TYPE_DIALOG || + atoms[i] == display->atom__NET_WM_WINDOW_TYPE_NORMAL || + atoms[i] == display->atom__NET_WM_WINDOW_TYPE_UTILITY || + atoms[i] == display->atom__NET_WM_WINDOW_TYPE_SPLASH) { type_atom = atoms[i]; break; @@ -1699,9 +1699,9 @@ get_window_type (MetaDisplay *display, if (type_atom == compositor->atom_net_wm_window_type_dnd) cw->type = META_COMP_WINDOW_DND; - else if (type_atom == display->atom_net_wm_window_type_desktop) + else if (type_atom == display->atom__NET_WM_WINDOW_TYPE_DESKTOP) cw->type = META_COMP_WINDOW_DESKTOP; - else if (type_atom == display->atom_net_wm_window_type_dock) + else if (type_atom == display->atom__NET_WM_WINDOW_TYPE_DOCK) cw->type = META_COMP_WINDOW_DOCK; else cw->type = META_COMP_WINDOW_NORMAL; @@ -2173,7 +2173,7 @@ process_property_notify (MetaCompositor *compositor, return; } - if (event->atom == display->atom_net_wm_window_type) { + if (event->atom == display->atom__NET_WM_WINDOW_TYPE) { MetaCompWindow *cw = find_window_in_display (display, event->window); if (!cw) diff --git a/src/core/delete.c b/src/core/delete.c index 792bd9c0f..787843618 100644 --- a/src/core/delete.c +++ b/src/core/delete.c @@ -365,7 +365,7 @@ meta_window_delete (MetaWindow *window, "Deleting %s with delete_window request\n", window->desc); meta_window_send_icccm_message (window, - window->display->atom_wm_delete_window, + window->display->atom_WM_DELETE_WINDOW, timestamp); } else diff --git a/src/core/display.c b/src/core/display.c index 6e0154b7a..045169dda 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -306,10 +306,6 @@ disable_compositor (MetaDisplay *display) * otherwise-- that is, if the display doesn't exist or it already * has a window manager. * - * \bug The list of atom_names is prone to get out of sync with the - * main list; I'd rather include them in that list using the stringify - * operator or something. - * * \ingroup main */ gboolean @@ -320,107 +316,12 @@ meta_display_open (void) GSList *tmp; int i; guint32 timestamp; - /* Remember to edit code that assigns each atom to display struct - * when adding an atom name here. - */ + + /* A list of all atom names, so that we can intern them in one go. */ char *atom_names[] = { - "_NET_WM_NAME", - "WM_PROTOCOLS", - "WM_TAKE_FOCUS", - "WM_DELETE_WINDOW", - "WM_STATE", - "_NET_CLOSE_WINDOW", - "_NET_WM_STATE", - "_MOTIF_WM_HINTS", - "_NET_WM_STATE_SHADED", - "_NET_WM_STATE_MAXIMIZED_HORZ", - "_NET_WM_STATE_MAXIMIZED_VERT", - "_NET_WM_DESKTOP", - "_NET_NUMBER_OF_DESKTOPS", - "WM_CHANGE_STATE", - "SM_CLIENT_ID", - "WM_CLIENT_LEADER", - "WM_WINDOW_ROLE", - "_NET_CURRENT_DESKTOP", - "_NET_SUPPORTING_WM_CHECK", - "_NET_SUPPORTED", - "_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", - "_NET_WM_STATE_MODAL", - "_NET_CLIENT_LIST", - "_NET_CLIENT_LIST_STACKING", - "_NET_WM_STATE_SKIP_TASKBAR", - "_NET_WM_STATE_SKIP_PAGER", - "_NET_WM_ICON_NAME", - "_NET_WM_ICON", - "_NET_WM_ICON_GEOMETRY", - "UTF8_STRING", - "WM_ICON_SIZE", - "_KWM_WIN_ICON", - "_NET_WM_MOVERESIZE", - "_NET_ACTIVE_WINDOW", - "_METACITY_RESTART_MESSAGE", - "_NET_WM_STRUT", - "_METACITY_RELOAD_THEME_MESSAGE", - "_METACITY_SET_KEYBINDINGS_MESSAGE", - "_NET_WM_STATE_HIDDEN", - "_NET_WM_WINDOW_TYPE_UTILITY", - "_NET_WM_WINDOW_TYPE_SPLASH", - "_NET_WM_STATE_FULLSCREEN", - "_NET_WM_PING", - "_NET_WM_PID", - "WM_CLIENT_MACHINE", - "_NET_WORKAREA", - "_NET_SHOWING_DESKTOP", - "_NET_DESKTOP_LAYOUT", - "MANAGER", - "TARGETS", - "MULTIPLE", - "TIMESTAMP", - "VERSION", - "ATOM_PAIR", - "_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", - "_NET_WM_STATE_ABOVE", - "_NET_WM_STATE_BELOW", - "_NET_STARTUP_ID", - "_METACITY_TOGGLE_VERBOSE", - "_NET_WM_SYNC_REQUEST", - "_NET_WM_SYNC_REQUEST_COUNTER", - "_GNOME_PANEL_ACTION", - "_GNOME_PANEL_ACTION_MAIN_MENU", - "_GNOME_PANEL_ACTION_RUN_DIALOG", - "_METACITY_SENTINEL", - "_NET_WM_STRUT_PARTIAL", - "_NET_WM_ACTION_FULLSCREEN", - "_NET_WM_ACTION_MINIMIZE", - "_NET_FRAME_EXTENTS", - "_NET_REQUEST_FRAME_EXTENTS", - "_NET_WM_USER_TIME", - "_NET_WM_STATE_DEMANDS_ATTENTION", - "_NET_RESTACK_WINDOW", - "_NET_MOVERESIZE_WINDOW", - "_NET_DESKTOP_GEOMETRY", - "_NET_DESKTOP_VIEWPORT", - "_METACITY_VERSION", - "_NET_WM_VISIBLE_NAME", - "_NET_WM_VISIBLE_ICON_NAME", - "_NET_WM_USER_TIME_WINDOW", - "_NET_WM_ACTION_ABOVE", - "_NET_WM_ACTION_BELOW", +#define item(x) #x, +#include "atomnames.h" +#undef item }; Atom atoms[G_N_ELEMENTS(atom_names)]; @@ -484,103 +385,12 @@ meta_display_open (void) meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names)); XInternAtoms (the_display->xdisplay, atom_names, G_N_ELEMENTS (atom_names), False, atoms); - the_display->atom_net_wm_name = atoms[0]; - the_display->atom_wm_protocols = atoms[1]; - the_display->atom_wm_take_focus = atoms[2]; - the_display->atom_wm_delete_window = atoms[3]; - the_display->atom_wm_state = atoms[4]; - the_display->atom_net_close_window = atoms[5]; - the_display->atom_net_wm_state = atoms[6]; - the_display->atom_motif_wm_hints = atoms[7]; - the_display->atom_net_wm_state_shaded = atoms[8]; - the_display->atom_net_wm_state_maximized_horz = atoms[9]; - the_display->atom_net_wm_state_maximized_vert = atoms[10]; - the_display->atom_net_wm_desktop = atoms[11]; - the_display->atom_net_number_of_desktops = atoms[12]; - the_display->atom_wm_change_state = atoms[13]; - the_display->atom_sm_client_id = atoms[14]; - the_display->atom_wm_client_leader = atoms[15]; - the_display->atom_wm_window_role = atoms[16]; - the_display->atom_net_current_desktop = atoms[17]; - the_display->atom_net_supporting_wm_check = atoms[18]; - the_display->atom_net_supported = atoms[19]; - the_display->atom_net_wm_window_type = atoms[20]; - the_display->atom_net_wm_window_type_desktop = atoms[21]; - the_display->atom_net_wm_window_type_dock = atoms[22]; - the_display->atom_net_wm_window_type_toolbar = atoms[23]; - the_display->atom_net_wm_window_type_menu = atoms[24]; - the_display->atom_net_wm_window_type_dialog = atoms[25]; - the_display->atom_net_wm_window_type_normal = atoms[26]; - the_display->atom_net_wm_state_modal = atoms[27]; - the_display->atom_net_client_list = atoms[28]; - the_display->atom_net_client_list_stacking = atoms[29]; - the_display->atom_net_wm_state_skip_taskbar = atoms[30]; - the_display->atom_net_wm_state_skip_pager = atoms[31]; - the_display->atom_net_wm_icon_name = atoms[32]; - the_display->atom_net_wm_icon = atoms[33]; - the_display->atom_net_wm_icon_geometry = atoms[34]; - the_display->atom_utf8_string = atoms[35]; - the_display->atom_wm_icon_size = atoms[36]; - the_display->atom_kwm_win_icon = atoms[37]; - the_display->atom_net_wm_moveresize = atoms[38]; - the_display->atom_net_active_window = atoms[39]; - the_display->atom_metacity_restart_message = atoms[40]; - the_display->atom_net_wm_strut = atoms[41]; - the_display->atom_metacity_reload_theme_message = atoms[42]; - the_display->atom_metacity_set_keybindings_message = atoms[43]; - the_display->atom_net_wm_state_hidden = atoms[44]; - the_display->atom_net_wm_window_type_utility = atoms[45]; - the_display->atom_net_wm_window_type_splash = atoms[46]; - the_display->atom_net_wm_state_fullscreen = atoms[47]; - the_display->atom_net_wm_ping = atoms[48]; - the_display->atom_net_wm_pid = atoms[49]; - the_display->atom_wm_client_machine = atoms[50]; - the_display->atom_net_workarea = atoms[51]; - the_display->atom_net_showing_desktop = atoms[52]; - the_display->atom_net_desktop_layout = atoms[53]; - the_display->atom_manager = atoms[54]; - the_display->atom_targets = atoms[55]; - the_display->atom_multiple = atoms[56]; - the_display->atom_timestamp = atoms[57]; - the_display->atom_version = atoms[58]; - the_display->atom_atom_pair = atoms[59]; - the_display->atom_net_desktop_names = atoms[60]; - the_display->atom_net_wm_allowed_actions = atoms[61]; - the_display->atom_net_wm_action_move = atoms[62]; - the_display->atom_net_wm_action_resize = atoms[63]; - the_display->atom_net_wm_action_shade = atoms[64]; - the_display->atom_net_wm_action_stick = atoms[65]; - the_display->atom_net_wm_action_maximize_horz = atoms[66]; - the_display->atom_net_wm_action_maximize_vert = atoms[67]; - the_display->atom_net_wm_action_change_desktop = atoms[68]; - the_display->atom_net_wm_action_close = atoms[69]; - the_display->atom_net_wm_state_above = atoms[70]; - the_display->atom_net_wm_state_below = atoms[71]; - the_display->atom_net_startup_id = atoms[72]; - the_display->atom_metacity_toggle_verbose = atoms[73]; - the_display->atom_net_wm_sync_request = atoms[74]; - the_display->atom_net_wm_sync_request_counter = atoms[75]; - the_display->atom_gnome_panel_action = atoms[76]; - the_display->atom_gnome_panel_action_main_menu = atoms[77]; - the_display->atom_gnome_panel_action_run_dialog = atoms[78]; - the_display->atom_metacity_sentinel = atoms[79]; - the_display->atom_net_wm_strut_partial = atoms[80]; - the_display->atom_net_wm_action_fullscreen = atoms[81]; - the_display->atom_net_wm_action_minimize = atoms[82]; - the_display->atom_net_frame_extents = atoms[83]; - the_display->atom_net_request_frame_extents = atoms[84]; - the_display->atom_net_wm_user_time = atoms[85]; - the_display->atom_net_wm_state_demands_attention = atoms[86]; - the_display->atom_net_restack_window = atoms[87]; - the_display->atom_net_moveresize_window = atoms[88]; - the_display->atom_net_desktop_geometry = atoms[89]; - the_display->atom_net_desktop_viewport = atoms[90]; - the_display->atom_metacity_version = atoms[91]; - the_display->atom_net_wm_visible_name = atoms[92]; - the_display->atom_net_wm_visible_icon_name = atoms[93]; - the_display->atom_net_wm_user_time_window = atoms[94]; - the_display->atom_net_wm_action_above = atoms[95]; - the_display->atom_net_wm_action_below = atoms[96]; + { + int i = 0; +#define item(x) the_display->atom_##x = atoms[i++]; +#include "atomnames.h" +#undef item + } the_display->prop_hooks = NULL; meta_display_init_window_prop_hooks (the_display); @@ -839,18 +649,18 @@ meta_display_open (void) meta_prop_set_utf8_string_hint (the_display, the_display->leader_window, - the_display->atom_net_wm_name, + the_display->atom__NET_WM_NAME, "Metacity"); meta_prop_set_utf8_string_hint (the_display, the_display->leader_window, - the_display->atom_metacity_version, + the_display->atom__METACITY_VERSION, VERSION); data[0] = the_display->leader_window; XChangeProperty (the_display->xdisplay, the_display->leader_window, - the_display->atom_net_supporting_wm_check, + the_display->atom__NET_SUPPORTING_WM_CHECK, XA_WINDOW, 32, PropModeReplace, (guchar*) data, 1); @@ -2345,14 +2155,14 @@ event_callback (XEvent *event, if (screen != NULL) { if (event->xproperty.atom == - display->atom_net_desktop_layout) + display->atom__NET_DESKTOP_LAYOUT) meta_screen_update_workspace_layout (screen); else if (event->xproperty.atom == - display->atom_net_desktop_names) + display->atom__NET_DESKTOP_NAMES) meta_screen_update_workspace_names (screen); #if 0 else if (event->xproperty.atom == - display->atom_net_restack_window) + display->atom__NET_RESTACK_WINDOW) handle_net_restack_window (display, event); #endif @@ -2361,7 +2171,7 @@ event_callback (XEvent *event, * sentinel_counter variable declaration in display.h */ if (event->xproperty.atom == - display->atom_metacity_sentinel) + display->atom__METACITY_SENTINEL) { meta_display_decrement_focus_sentinel (display); } @@ -2408,7 +2218,7 @@ event_callback (XEvent *event, if (screen) { if (event->xclient.message_type == - display->atom_net_current_desktop) + display->atom__NET_CURRENT_DESKTOP) { int space; MetaWorkspace *workspace; @@ -2440,7 +2250,7 @@ event_callback (XEvent *event, meta_verbose ("Don't know about workspace %d\n", space); } else if (event->xclient.message_type == - display->atom_net_number_of_desktops) + display->atom__NET_NUMBER_OF_DESKTOPS) { int num_spaces; @@ -2452,7 +2262,7 @@ event_callback (XEvent *event, meta_prefs_set_num_workspaces (num_spaces); } else if (event->xclient.message_type == - display->atom_net_showing_desktop) + display->atom__NET_SHOWING_DESKTOP) { gboolean showing_desktop; guint32 timestamp; @@ -2472,13 +2282,13 @@ event_callback (XEvent *event, } } else if (event->xclient.message_type == - display->atom_metacity_restart_message) + display->atom__METACITY_RESTART_MESSAGE) { meta_verbose ("Received restart request\n"); meta_restart (); } else if (event->xclient.message_type == - display->atom_metacity_reload_theme_message) + display->atom__METACITY_RELOAD_THEME_MESSAGE) { meta_verbose ("Received reload theme request\n"); meta_ui_set_current_theme (meta_prefs_get_theme (), @@ -2486,24 +2296,24 @@ event_callback (XEvent *event, meta_display_retheme_all (); } else if (event->xclient.message_type == - display->atom_metacity_set_keybindings_message) + 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]); } else if (event->xclient.message_type == - display->atom_metacity_toggle_verbose) + display->atom__METACITY_TOGGLE_VERBOSE) { meta_verbose ("Received toggle verbose message\n"); meta_set_verbose (!meta_is_verbose ()); } else if (event->xclient.message_type == - display->atom_wm_protocols) + display->atom_WM_PROTOCOLS) { meta_verbose ("Received WM_PROTOCOLS message\n"); - if ((Atom)event->xclient.data.l[0] == display->atom_net_wm_ping) + if ((Atom)event->xclient.data.l[0] == display->atom__NET_WM_PING) { process_pong_message (display, event); @@ -2517,7 +2327,7 @@ event_callback (XEvent *event, } if (event->xclient.message_type == - display->atom_net_request_frame_extents) + display->atom__NET_REQUEST_FRAME_EXTENTS) { meta_verbose ("Received _NET_REQUEST_FRAME_EXTENTS message\n"); process_request_frame_extents (display, event); @@ -4057,7 +3867,7 @@ 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); + display->atom__MOTIF_WM_HINTS); } void @@ -4079,7 +3889,7 @@ meta_display_update_active_window_hint (MetaDisplay *display) meta_error_trap_push (display); XChangeProperty (display->xdisplay, screen->xroot, - display->atom_net_active_window, + display->atom__NET_ACTIVE_WINDOW, XA_WINDOW, 32, PropModeReplace, (guchar*) data, 1); @@ -4296,7 +4106,7 @@ meta_display_ping_window (MetaDisplay *display, "Sending ping with timestamp %u to window %s\n", timestamp, window->desc); meta_window_send_icccm_message (window, - display->atom_net_wm_ping, + display->atom__NET_WM_PING, timestamp); } @@ -4316,7 +4126,7 @@ process_request_frame_extents (MetaDisplay *display, /* See if the window is decorated. */ hints_set = meta_prop_get_motif_hints (display, xwindow, - display->atom_motif_wm_hints, + display->atom__MOTIF_WM_HINTS, &hints); if ((hints_set && hints->decorations) || !hints_set) { @@ -4360,7 +4170,7 @@ process_request_frame_extents (MetaDisplay *display, meta_error_trap_push (display); XChangeProperty (display->xdisplay, xwindow, - display->atom_net_frame_extents, + display->atom__NET_FRAME_EXTENTS, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 4); meta_error_trap_pop (display, FALSE); @@ -4781,21 +4591,21 @@ convert_property (MetaDisplay *display, 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; + conversion_targets[0] = display->atom_TARGETS; + conversion_targets[1] = display->atom_MULTIPLE; + conversion_targets[2] = display->atom_TIMESTAMP; + conversion_targets[3] = display->atom_VERSION; meta_error_trap_push_with_return (display); - if (target == display->atom_targets) + 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) + 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) + else if (target == display->atom_VERSION) XChangeProperty (display->xdisplay, w, property, XA_INTEGER, 32, PropModeReplace, (unsigned char *)icccm_version, 2); @@ -4855,7 +4665,7 @@ process_selection_request (MetaDisplay *display, reply.property = None; reply.time = event->xselectionrequest.time; - if (event->xselectionrequest.target == display->atom_multiple) + if (event->xselectionrequest.target == display->atom_MULTIPLE) { if (event->xselectionrequest.property != None) { @@ -4868,7 +4678,7 @@ process_selection_request (MetaDisplay *display, if (XGetWindowProperty (display->xdisplay, event->xselectionrequest.requestor, event->xselectionrequest.property, 0, 256, False, - display->atom_atom_pair, + display->atom_ATOM_PAIR, &type, &format, &num, &rest, &data) != Success) { meta_error_trap_pop_with_return (display, TRUE); @@ -4896,7 +4706,7 @@ process_selection_request (MetaDisplay *display, XChangeProperty (display->xdisplay, event->xselectionrequest.requestor, event->xselectionrequest.property, - display->atom_atom_pair, + display->atom_ATOM_PAIR, 32, PropModeReplace, data, num); meta_error_trap_pop (display, FALSE); meta_XFree (data); @@ -5132,7 +4942,7 @@ meta_display_increment_focus_sentinel (MetaDisplay *display) XChangeProperty (display->xdisplay, ((MetaScreen*) display->screens->data)->xroot, - display->atom_metacity_sentinel, + display->atom__METACITY_SENTINEL, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); diff --git a/src/core/display.h b/src/core/display.h index 65b95a508..659f79d2f 100644 --- a/src/core/display.h +++ b/src/core/display.h @@ -87,103 +87,12 @@ struct _MetaDisplay Window leader_window; Window timestamp_pinging_window; - Atom atom_net_wm_name; - Atom atom_wm_protocols; - Atom atom_wm_take_focus; - Atom atom_wm_delete_window; - Atom atom_wm_state; - Atom atom_net_close_window; - Atom atom_net_wm_state; - Atom atom_motif_wm_hints; - Atom atom_net_wm_state_shaded; - Atom atom_net_wm_state_maximized_horz; - Atom atom_net_wm_state_maximized_vert; - Atom atom_net_wm_desktop; - Atom atom_net_number_of_desktops; - Atom atom_wm_change_state; - Atom atom_sm_client_id; - Atom atom_wm_client_leader; - Atom atom_wm_window_role; - Atom atom_net_current_desktop; - Atom atom_net_supporting_wm_check; - Atom atom_net_supported; - Atom atom_net_wm_window_type; - Atom atom_net_wm_window_type_desktop; - Atom atom_net_wm_window_type_dock; - Atom atom_net_wm_window_type_toolbar; - Atom atom_net_wm_window_type_menu; - Atom atom_net_wm_window_type_dialog; - Atom atom_net_wm_window_type_normal; - Atom atom_net_wm_state_modal; - Atom atom_net_client_list; - Atom atom_net_client_list_stacking; - Atom atom_net_wm_state_skip_taskbar; - Atom atom_net_wm_state_skip_pager; - Atom atom_net_wm_icon_name; - Atom atom_net_wm_icon; - Atom atom_net_wm_icon_geometry; - Atom atom_utf8_string; - Atom atom_wm_icon_size; - Atom atom_kwm_win_icon; - Atom atom_net_wm_moveresize; - Atom atom_net_active_window; - Atom atom_metacity_restart_message; - Atom atom_net_wm_strut; - Atom atom_metacity_reload_theme_message; - Atom atom_metacity_set_keybindings_message; - Atom atom_net_wm_state_hidden; - Atom atom_net_wm_window_type_utility; - Atom atom_net_wm_window_type_splash; - Atom atom_net_wm_ping; - Atom atom_net_wm_pid; - Atom atom_wm_client_machine; - Atom atom_net_wm_state_fullscreen; - Atom atom_net_workarea; - Atom atom_net_showing_desktop; - Atom atom_net_desktop_layout; - Atom atom_manager; - Atom atom_targets; - Atom atom_multiple; - Atom atom_timestamp; - Atom atom_version; - Atom atom_atom_pair; - Atom atom_net_desktop_names; - Atom atom_net_wm_allowed_actions; - Atom atom_net_wm_action_move; - Atom atom_net_wm_action_resize; - Atom atom_net_wm_action_fullscreen; - Atom atom_net_wm_action_minimize; - Atom atom_net_wm_action_shade; - Atom atom_net_wm_action_stick; - Atom atom_net_wm_action_maximize_horz; - Atom atom_net_wm_action_maximize_vert; - Atom atom_net_wm_action_change_desktop; - Atom atom_net_wm_action_close; - Atom atom_net_wm_action_above; - Atom atom_net_wm_action_below; - Atom atom_net_wm_state_above; - Atom atom_net_wm_state_below; - Atom atom_net_startup_id; - Atom atom_metacity_toggle_verbose; - Atom atom_net_wm_sync_request; - Atom atom_net_wm_sync_request_counter; - Atom atom_gnome_panel_action; - Atom atom_gnome_panel_action_main_menu; - Atom atom_gnome_panel_action_run_dialog; - Atom atom_metacity_sentinel; - Atom atom_net_wm_strut_partial; - Atom atom_net_frame_extents; - Atom atom_net_request_frame_extents; - Atom atom_net_wm_user_time; - Atom atom_net_wm_state_demands_attention; - Atom atom_net_restack_window; - Atom atom_net_moveresize_window; - Atom atom_net_desktop_geometry; - Atom atom_net_desktop_viewport; - Atom atom_metacity_version; - Atom atom_net_wm_visible_name; - Atom atom_net_wm_visible_icon_name; - Atom atom_net_wm_user_time_window; + /* Pull in all the names of atoms as fields; we will intern them when the + * class is constructed. + */ +#define item(x) Atom atom_##x; +#include "atomnames.h" +#undef item /* This is the actual window from focus events, * not the one we last set diff --git a/src/core/group-props.c b/src/core/group-props.c index 9d5af05ec..3ca91e370 100644 --- a/src/core/group-props.c +++ b/src/core/group-props.c @@ -126,7 +126,7 @@ init_wm_client_machine (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_STRING; - value->atom = display->atom_wm_client_machine; + value->atom = display->atom_WM_CLIENT_MACHINE; } static void @@ -149,7 +149,7 @@ init_net_startup_id (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_UTF8; - value->atom = display->atom_net_startup_id; + value->atom = display->atom__NET_STARTUP_ID; } static void @@ -181,17 +181,17 @@ meta_display_init_group_prop_hooks (MetaDisplay *display) i = 0; - hooks[i].property = display->atom_wm_client_machine; + hooks[i].property = display->atom_WM_CLIENT_MACHINE; hooks[i].init_func = init_wm_client_machine; hooks[i].reload_func = reload_wm_client_machine; ++i; - hooks[i].property = display->atom_net_wm_pid; + hooks[i].property = display->atom__NET_WM_PID; hooks[i].init_func = NULL; hooks[i].reload_func = NULL; ++i; - hooks[i].property = display->atom_net_startup_id; + hooks[i].property = display->atom__NET_STARTUP_ID; hooks[i].init_func = init_net_startup_id; hooks[i].reload_func = reload_net_startup_id; ++i; diff --git a/src/core/group.c b/src/core/group.c index 1e721a958..5b3274072 100644 --- a/src/core/group.c +++ b/src/core/group.c @@ -58,9 +58,9 @@ meta_group_new (MetaDisplay *display, /* Fill these in the order we want them to be gotten */ i = 0; - initial_props[i++] = display->atom_wm_client_machine; - initial_props[i++] = display->atom_net_wm_pid; - initial_props[i++] = display->atom_net_startup_id; + initial_props[i++] = display->atom_WM_CLIENT_MACHINE; + initial_props[i++] = display->atom__NET_WM_PID; + initial_props[i++] = display->atom__NET_STARTUP_ID; g_assert (N_INITIAL_PROPS == i); meta_group_reload_properties (group, initial_props, N_INITIAL_PROPS); diff --git a/src/core/iconcache.c b/src/core/iconcache.c index 6f8d01ab4..db96bbbb2 100644 --- a/src/core/iconcache.c +++ b/src/core/iconcache.c @@ -236,7 +236,7 @@ read_rgb_icon (MetaDisplay *display, data = NULL; result = XGetWindowProperty (display->xdisplay, xwindow, - display->atom_net_wm_icon, + display->atom__NET_WM_ICON, 0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems, &bytes_after, ((guchar **)&data)); @@ -473,10 +473,10 @@ get_kwm_win_icon (MetaDisplay *display, meta_error_trap_push_with_return (display); icons = NULL; result = XGetWindowProperty (display->xdisplay, xwindow, - display->atom_kwm_win_icon, + display->atom__KWM_WIN_ICON, 0, G_MAXLONG, False, - display->atom_kwm_win_icon, + display->atom__KWM_WIN_ICON, &type, &format, &nitems, &bytes_after, (guchar **)&icons); @@ -485,7 +485,7 @@ get_kwm_win_icon (MetaDisplay *display, result != Success) return; - if (type != display->atom_kwm_win_icon) + if (type != display->atom__KWM_WIN_ICON) { XFree (icons); return; @@ -556,9 +556,9 @@ meta_icon_cache_property_changed (MetaIconCache *icon_cache, MetaDisplay *display, Atom atom) { - if (atom == display->atom_net_wm_icon) + if (atom == display->atom__NET_WM_ICON) icon_cache->net_wm_icon_dirty = TRUE; - else if (atom == display->atom_kwm_win_icon) + else if (atom == display->atom__KWM_WIN_ICON) icon_cache->kwm_win_icon_dirty = TRUE; else if (atom == XA_WM_HINTS) icon_cache->wm_hints_dirty = TRUE; diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 3c304c13e..ab7545c35 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -3186,10 +3186,10 @@ handle_panel_keybinding (MetaDisplay *display, switch (action) { case META_KEYBINDING_ACTION_PANEL_MAIN_MENU: - action_atom = display->atom_gnome_panel_action_main_menu; + action_atom = display->atom__GNOME_PANEL_ACTION_MAIN_MENU; break; case META_KEYBINDING_ACTION_PANEL_RUN_DIALOG: - action_atom = display->atom_gnome_panel_action_run_dialog; + action_atom = display->atom__GNOME_PANEL_ACTION_RUN_DIALOG; break; default: return; @@ -3197,7 +3197,7 @@ handle_panel_keybinding (MetaDisplay *display, ev.type = ClientMessage; ev.window = screen->xroot; - ev.message_type = display->atom_gnome_panel_action; + ev.message_type = display->atom__GNOME_PANEL_ACTION; ev.format = 32; ev.data.l[0] = action_atom; ev.data.l[1] = event->xkey.time; diff --git a/src/core/screen.c b/src/core/screen.c index 419b53763..406780ee9 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -79,7 +79,7 @@ set_wm_check_hint (MetaScreen *screen) data[0] = screen->display->leader_window; XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_supporting_wm_check, + screen->display->atom__NET_SUPPORTING_WM_CHECK, XA_WINDOW, 32, PropModeReplace, (guchar*) data, 1); @@ -89,81 +89,21 @@ set_wm_check_hint (MetaScreen *screen) static int set_supported_hint (MetaScreen *screen) { -#define N_SUPPORTED 62 - Atom atoms[N_SUPPORTED]; - - atoms[0] = screen->display->atom_net_wm_name; - atoms[1] = screen->display->atom_net_close_window; - atoms[2] = screen->display->atom_net_wm_state; - atoms[3] = screen->display->atom_net_wm_state_shaded; - atoms[4] = screen->display->atom_net_wm_state_maximized_vert; - atoms[5] = screen->display->atom_net_wm_state_maximized_horz; - atoms[6] = screen->display->atom_net_wm_desktop; - atoms[7] = screen->display->atom_net_number_of_desktops; - atoms[8] = screen->display->atom_net_current_desktop; - atoms[9] = screen->display->atom_net_wm_window_type; - atoms[10] = screen->display->atom_net_wm_window_type_desktop; - atoms[11] = screen->display->atom_net_wm_window_type_dock; - atoms[12] = screen->display->atom_net_wm_window_type_toolbar; - atoms[13] = screen->display->atom_net_wm_window_type_menu; - atoms[14] = screen->display->atom_net_wm_window_type_dialog; - atoms[15] = screen->display->atom_net_wm_window_type_normal; - atoms[16] = screen->display->atom_net_wm_state_modal; - atoms[17] = screen->display->atom_net_client_list; - atoms[18] = screen->display->atom_net_client_list_stacking; - atoms[19] = screen->display->atom_net_wm_state_skip_taskbar; - atoms[20] = screen->display->atom_net_wm_state_skip_pager; - atoms[21] = screen->display->atom_net_wm_icon_name; - atoms[22] = screen->display->atom_net_wm_icon; - atoms[23] = screen->display->atom_net_wm_icon_geometry; - atoms[24] = screen->display->atom_net_wm_moveresize; - atoms[25] = screen->display->atom_net_active_window; - atoms[26] = screen->display->atom_net_wm_strut; - atoms[27] = screen->display->atom_net_wm_state_hidden; - atoms[28] = screen->display->atom_net_wm_window_type_utility; - atoms[29] = screen->display->atom_net_wm_window_type_splash; - atoms[30] = screen->display->atom_net_wm_state_fullscreen; - atoms[31] = screen->display->atom_net_wm_ping; - atoms[32] = screen->display->atom_net_wm_pid; - atoms[33] = screen->display->atom_net_workarea; - atoms[34] = screen->display->atom_net_showing_desktop; - atoms[35] = screen->display->atom_net_desktop_layout; - atoms[36] = screen->display->atom_net_desktop_names; - atoms[37] = screen->display->atom_net_wm_allowed_actions; - atoms[38] = screen->display->atom_net_wm_action_move; - atoms[39] = screen->display->atom_net_wm_action_resize; - atoms[40] = screen->display->atom_net_wm_action_shade; - atoms[41] = screen->display->atom_net_wm_action_stick; - atoms[42] = screen->display->atom_net_wm_action_maximize_horz; - atoms[43] = screen->display->atom_net_wm_action_maximize_vert; - atoms[44] = screen->display->atom_net_wm_action_change_desktop; - atoms[45] = screen->display->atom_net_wm_action_close; - atoms[46] = screen->display->atom_net_wm_state_above; - atoms[47] = screen->display->atom_net_wm_state_below; - atoms[48] = screen->display->atom_net_startup_id; - atoms[49] = screen->display->atom_net_wm_strut_partial; - atoms[50] = screen->display->atom_net_wm_action_fullscreen; - atoms[51] = screen->display->atom_net_wm_action_minimize; - atoms[52] = screen->display->atom_net_frame_extents; - atoms[53] = screen->display->atom_net_request_frame_extents; - atoms[54] = screen->display->atom_net_wm_user_time; - atoms[55] = screen->display->atom_net_wm_state_demands_attention; - atoms[56] = screen->display->atom_net_desktop_geometry; - atoms[57] = screen->display->atom_net_desktop_viewport; - atoms[58] = screen->display->atom_net_wm_user_time_window; - atoms[59] = screen->display->atom_net_moveresize_window; - atoms[60] = screen->display->atom_net_wm_action_above; - atoms[61] = screen->display->atom_net_wm_action_below; + Atom atoms[] = { +#define EWMH_ATOMS_ONLY +#define item(x) screen->display->atom_##x, +#include "atomnames.h" +#undef item +#undef EWMH_ATOMS_ONLY + }; - /* atoms[58] = screen->display->atom_net_restack_window; */ - XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_supported, + screen->display->atom__NET_SUPPORTED, XA_ATOM, - 32, PropModeReplace, (guchar*) atoms, N_SUPPORTED); + 32, PropModeReplace, + (guchar*) atoms, G_N_ELEMENTS(atoms)); return Success; -#undef N_SUPPORTED } static int @@ -181,7 +121,7 @@ set_wm_icon_size_hint (MetaScreen *screen) vals[5] = 0; XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_wm_icon_size, + screen->display->atom_WM_ICON_SIZE, XA_CARDINAL, 32, PropModeReplace, (guchar*) vals, N_VALS); @@ -464,7 +404,7 @@ meta_screen_new (MetaDisplay *display, ev.type = ClientMessage; ev.window = xroot; - ev.message_type = display->atom_manager; + ev.message_type = display->atom_MANAGER; ev.format = 32; ev.data.l[0] = manager_timestamp; ev.data.l[1] = wm_sn_atom; @@ -612,7 +552,7 @@ meta_screen_new (MetaDisplay *display, current_workspace = 0; if (meta_prop_get_cardinal (screen->display, screen->xroot, - screen->display->atom_net_current_desktop, + screen->display->atom__NET_CURRENT_DESKTOP, ¤t_workspace)) meta_verbose ("Read existing _NET_CURRENT_DESKTOP = %d\n", (int) current_workspace); @@ -1080,7 +1020,7 @@ set_number_of_spaces_hint (MetaScreen *screen, meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_number_of_desktops, + screen->display->atom__NET_NUMBER_OF_DESKTOPS, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); meta_error_trap_pop (screen->display, FALSE); @@ -1101,7 +1041,7 @@ set_desktop_geometry_hint (MetaScreen *screen) meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_desktop_geometry, + screen->display->atom__NET_DESKTOP_GEOMETRY, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 2); meta_error_trap_pop (screen->display, FALSE); @@ -1125,7 +1065,7 @@ set_desktop_viewport_hint (MetaScreen *screen) meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_desktop_viewport, + screen->display->atom__NET_DESKTOP_VIEWPORT, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 2); meta_error_trap_pop (screen->display, FALSE); @@ -1770,7 +1710,7 @@ meta_screen_update_workspace_layout (MetaScreen *screen) if (meta_prop_get_cardinal_list (screen->display, screen->xroot, - screen->display->atom_net_desktop_layout, + screen->display->atom__NET_DESKTOP_LAYOUT, &list, &n_items)) { if (n_items == 3 || n_items == 4) @@ -1883,8 +1823,8 @@ set_workspace_names (MetaScreen *screen) meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_desktop_names, - screen->display->atom_utf8_string, + screen->display->atom__NET_DESKTOP_NAMES, + screen->display->atom_UTF8_STRING, 8, PropModeReplace, (unsigned char *)flattened->str, flattened->len); meta_error_trap_pop (screen->display, FALSE); @@ -1907,7 +1847,7 @@ meta_screen_update_workspace_names (MetaScreen *screen) n_names = 0; if (!meta_prop_get_utf8_list (screen->display, screen->xroot, - screen->display->atom_net_desktop_names, + screen->display->atom__NET_DESKTOP_NAMES, &names, &n_names)) { meta_verbose ("Failed to get workspace names from root window %d\n", @@ -1987,7 +1927,7 @@ set_work_area_hint (MetaScreen *screen) meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_workarea, + screen->display->atom__NET_WORKAREA, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, num_workspaces*4); g_free (data); @@ -2357,7 +2297,7 @@ meta_screen_update_showing_desktop_hint (MetaScreen *screen) meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_showing_desktop, + screen->display->atom__NET_SHOWING_DESKTOP, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); meta_error_trap_pop (screen->display, FALSE); diff --git a/src/core/stack.c b/src/core/stack.c index de3402eaf..aa34f5a26 100644 --- a/src/core/stack.c +++ b/src/core/stack.c @@ -1159,14 +1159,14 @@ meta_stack_sync_to_server (MetaStack *stack) XChangeProperty (stack->screen->display->xdisplay, stack->screen->xroot, - stack->screen->display->atom_net_client_list, + stack->screen->display->atom__NET_CLIENT_LIST, XA_WINDOW, 32, PropModeReplace, (unsigned char *)stack->windows->data, stack->windows->len); XChangeProperty (stack->screen->display->xdisplay, stack->screen->xroot, - stack->screen->display->atom_net_client_list_stacking, + stack->screen->display->atom__NET_CLIENT_LIST_STACKING, XA_WINDOW, 32, PropModeReplace, (unsigned char *)stacked->data, diff --git a/src/core/window-props.c b/src/core/window-props.c index fb952450e..5ccc8c6a8 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -157,7 +157,7 @@ init_wm_client_machine (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_STRING; - value->atom = display->atom_wm_client_machine; + value->atom = display->atom_WM_CLIENT_MACHINE; } static void @@ -180,7 +180,7 @@ init_net_wm_pid (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_CARDINAL; - value->atom = display->atom_net_wm_pid; + value->atom = display->atom__NET_WM_PID; } static void @@ -209,7 +209,7 @@ init_net_wm_user_time (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_CARDINAL; - value->atom = display->atom_net_wm_user_time; + value->atom = display->atom__NET_WM_USER_TIME; } static void @@ -229,7 +229,7 @@ init_net_wm_user_time_window (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_WINDOW; - value->atom = display->atom_net_wm_user_time_window; + value->atom = display->atom__NET_WM_USER_TIME_WINDOW; } static void @@ -264,7 +264,7 @@ reload_net_wm_user_time_window (MetaWindow *window, * treated identically and will result in functions for * window being called to update it. Maybe we should ignore * any property notifies to window->user_time_window other - * than atom_net_wm_user_time ones, but I just don't care + * than atom__NET_WM_USER_TIME ones, but I just don't care * and it's not specified in the spec anyway. */ meta_display_register_x_window (window->display, @@ -282,7 +282,7 @@ reload_net_wm_user_time_window (MetaWindow *window, meta_window_reload_property_from_xwindow ( window, window->user_time_window, - window->display->atom_net_wm_user_time); + window->display->atom__NET_WM_USER_TIME); } } } @@ -359,7 +359,7 @@ set_window_title (MetaWindow *window, set_title_text (window, window->using_net_wm_visible_name, title, - window->display->atom_net_wm_visible_name, + window->display->atom__NET_WM_VISIBLE_NAME, &window->title); window->using_net_wm_visible_name = modified; @@ -381,7 +381,7 @@ init_net_wm_name (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_UTF8; - value->atom = display->atom_net_wm_name; + value->atom = display->atom__NET_WM_NAME; } static void @@ -445,7 +445,7 @@ set_icon_title (MetaWindow *window, set_title_text (window, window->using_net_wm_visible_icon_name, title, - window->display->atom_net_wm_visible_icon_name, + window->display->atom__NET_WM_VISIBLE_ICON_NAME, &window->icon_name); window->using_net_wm_visible_icon_name = modified; } @@ -456,7 +456,7 @@ init_net_wm_icon_name (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_UTF8; - value->atom = display->atom_net_wm_icon_name; + value->atom = display->atom__NET_WM_ICON_NAME; } static void @@ -518,7 +518,7 @@ init_net_wm_state (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_ATOM_LIST; - value->atom = display->atom_net_wm_state; + value->atom = display->atom__NET_WM_STATE; } static void @@ -547,27 +547,27 @@ reload_net_wm_state (MetaWindow *window, i = 0; while (i < value->v.atom_list.n_atoms) { - if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_shaded) + if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SHADED) window->shaded = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_maximized_horz) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MAXIMIZED_HORZ) window->maximize_horizontally_after_placement = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_maximized_vert) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MAXIMIZED_VERT) window->maximize_vertically_after_placement = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_hidden) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_HIDDEN) window->minimize_after_placement = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_modal) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MODAL) window->wm_state_modal = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_skip_taskbar) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_TASKBAR) window->wm_state_skip_taskbar = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_skip_pager) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_PAGER) window->wm_state_skip_pager = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_fullscreen) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_FULLSCREEN) window->fullscreen = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_above) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_ABOVE) window->wm_state_above = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_below) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_BELOW) window->wm_state_below = TRUE; - else if (value->v.atom_list.atoms[i] == window->display->atom_net_wm_state_demands_attention) + else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_DEMANDS_ATTENTION) window->wm_state_demands_attention = TRUE; ++i; @@ -585,7 +585,7 @@ init_mwm_hints (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_MOTIF_HINTS; - value->atom = display->atom_motif_wm_hints; + value->atom = display->atom__MOTIF_WM_HINTS; } static void @@ -754,7 +754,7 @@ init_net_wm_desktop (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_CARDINAL; - value->atom = display->atom_net_wm_desktop; + value->atom = display->atom__NET_WM_DESKTOP; } static void @@ -777,7 +777,7 @@ init_net_startup_id (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_UTF8; - value->atom = display->atom_net_startup_id; + value->atom = display->atom__NET_STARTUP_ID; } static void @@ -823,7 +823,7 @@ init_update_counter (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_SYNC_COUNTER; - value->atom = display->atom_net_wm_sync_request_counter; + value->atom = display->atom__NET_WM_SYNC_REQUEST_COUNTER; } static void @@ -1282,7 +1282,7 @@ init_wm_protocols (MetaDisplay *display, MetaPropValue *value) { value->type = META_PROP_VALUE_ATOM_LIST; - value->atom = display->atom_wm_protocols; + value->atom = display->atom_WM_PROTOCOLS; } static void @@ -1302,13 +1302,13 @@ reload_wm_protocols (MetaWindow *window, while (i < value->v.atom_list.n_atoms) { if (value->v.atom_list.atoms[i] == - window->display->atom_wm_take_focus) + window->display->atom_WM_TAKE_FOCUS) window->take_focus = TRUE; else if (value->v.atom_list.atoms[i] == - window->display->atom_wm_delete_window) + window->display->atom_WM_DELETE_WINDOW) window->delete_window = TRUE; else if (value->v.atom_list.atoms[i] == - window->display->atom_net_wm_ping) + window->display->atom__NET_WM_PING) window->net_wm_ping = TRUE; ++i; } @@ -1455,27 +1455,27 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) i = 0; - hooks[i].property = display->atom_wm_state; + hooks[i].property = display->atom_WM_STATE; hooks[i].init_func = NULL; hooks[i].reload_func = NULL; ++i; - hooks[i].property = display->atom_wm_client_machine; + hooks[i].property = display->atom_WM_CLIENT_MACHINE; hooks[i].init_func = init_wm_client_machine; hooks[i].reload_func = reload_wm_client_machine; ++i; - hooks[i].property = display->atom_net_wm_pid; + hooks[i].property = display->atom__NET_WM_PID; hooks[i].init_func = init_net_wm_pid; hooks[i].reload_func = reload_net_wm_pid; ++i; - hooks[i].property = display->atom_net_wm_user_time; + hooks[i].property = display->atom__NET_WM_USER_TIME; hooks[i].init_func = init_net_wm_user_time; hooks[i].reload_func = reload_net_wm_user_time; ++i; - hooks[i].property = display->atom_net_wm_name; + hooks[i].property = display->atom__NET_WM_NAME; hooks[i].init_func = init_net_wm_name; hooks[i].reload_func = reload_net_wm_name; ++i; @@ -1485,7 +1485,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) hooks[i].reload_func = reload_wm_name; ++i; - hooks[i].property = display->atom_net_wm_icon_name; + hooks[i].property = display->atom__NET_WM_ICON_NAME; hooks[i].init_func = init_net_wm_icon_name; hooks[i].reload_func = reload_net_wm_icon_name; ++i; @@ -1495,17 +1495,17 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) hooks[i].reload_func = reload_wm_icon_name; ++i; - hooks[i].property = display->atom_net_wm_state; + hooks[i].property = display->atom__NET_WM_STATE; hooks[i].init_func = init_net_wm_state; hooks[i].reload_func = reload_net_wm_state; ++i; - hooks[i].property = display->atom_motif_wm_hints; + hooks[i].property = display->atom__MOTIF_WM_HINTS; hooks[i].init_func = init_mwm_hints; hooks[i].reload_func = reload_mwm_hints; ++i; - hooks[i].property = display->atom_net_wm_icon_geometry; + hooks[i].property = display->atom__NET_WM_ICON_GEOMETRY; hooks[i].init_func = NULL; hooks[i].reload_func = NULL; ++i; @@ -1515,47 +1515,47 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) hooks[i].reload_func = reload_wm_class; ++i; - hooks[i].property = display->atom_wm_client_leader; + hooks[i].property = display->atom_WM_CLIENT_LEADER; hooks[i].init_func = NULL; hooks[i].reload_func = NULL; ++i; - hooks[i].property = display->atom_sm_client_id; + hooks[i].property = display->atom_SM_CLIENT_ID; hooks[i].init_func = NULL; hooks[i].reload_func = NULL; ++i; - hooks[i].property = display->atom_wm_window_role; + hooks[i].property = display->atom_WM_WINDOW_ROLE; hooks[i].init_func = NULL; hooks[i].reload_func = NULL; ++i; - hooks[i].property = display->atom_net_wm_window_type; + hooks[i].property = display->atom__NET_WM_WINDOW_TYPE; hooks[i].init_func = NULL; hooks[i].reload_func = NULL; ++i; - hooks[i].property = display->atom_net_wm_desktop; + 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_net_wm_strut; + hooks[i].property = display->atom__NET_WM_STRUT; hooks[i].init_func = NULL; hooks[i].reload_func = NULL; ++i; - hooks[i].property = display->atom_net_wm_strut_partial; + hooks[i].property = display->atom__NET_WM_STRUT_PARTIAL; hooks[i].init_func = NULL; hooks[i].reload_func = NULL; ++i; - hooks[i].property = display->atom_net_startup_id; + hooks[i].property = display->atom__NET_STARTUP_ID; hooks[i].init_func = init_net_startup_id; hooks[i].reload_func = reload_net_startup_id; ++i; - hooks[i].property = display->atom_net_wm_sync_request_counter; + hooks[i].property = display->atom__NET_WM_SYNC_REQUEST_COUNTER; hooks[i].init_func = init_update_counter; hooks[i].reload_func = reload_update_counter; ++i; @@ -1565,7 +1565,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) hooks[i].reload_func = reload_normal_hints; ++i; - hooks[i].property = display->atom_wm_protocols; + hooks[i].property = display->atom_WM_PROTOCOLS; hooks[i].init_func = init_wm_protocols; hooks[i].reload_func = reload_wm_protocols; ++i; @@ -1580,7 +1580,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) hooks[i].reload_func = reload_transient_for; ++i; - hooks[i].property = display->atom_net_wm_user_time_window; + hooks[i].property = display->atom__NET_WM_USER_TIME_WINDOW; hooks[i].init_func = init_net_wm_user_time_window; hooks[i].reload_func = reload_net_wm_user_time_window; ++i; diff --git a/src/core/window.c b/src/core/window.c index 90997a838..bd68bae04 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -296,8 +296,8 @@ meta_window_new_with_attrs (MetaDisplay *display, /* WM_STATE isn't a cardinal, it's type WM_STATE, but is an int */ if (!(meta_prop_get_cardinal_with_atom_type (display, xwindow, - display->atom_wm_state, - display->atom_wm_state, + display->atom_WM_STATE, + display->atom_WM_STATE, &state) && (state == IconicState || state == NormalState))) { @@ -572,24 +572,24 @@ meta_window_new_with_attrs (MetaDisplay *display, * wm_client_machine, so push it slightly sooner. */ i = 0; - initial_props[i++] = display->atom_wm_client_machine; - initial_props[i++] = display->atom_net_wm_name; + initial_props[i++] = display->atom_WM_CLIENT_MACHINE; + initial_props[i++] = display->atom__NET_WM_NAME; initial_props[i++] = XA_WM_CLASS; - initial_props[i++] = display->atom_net_wm_pid; + initial_props[i++] = display->atom__NET_WM_PID; initial_props[i++] = XA_WM_NAME; - initial_props[i++] = display->atom_net_wm_icon_name; + 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_net_startup_id; - initial_props[i++] = display->atom_net_wm_sync_request_counter; + initial_props[i++] = display->atom__NET_WM_DESKTOP; + initial_props[i++] = display->atom__NET_STARTUP_ID; + initial_props[i++] = display->atom__NET_WM_SYNC_REQUEST_COUNTER; initial_props[i++] = XA_WM_NORMAL_HINTS; - initial_props[i++] = display->atom_wm_protocols; + initial_props[i++] = display->atom_WM_PROTOCOLS; initial_props[i++] = XA_WM_HINTS; - initial_props[i++] = display->atom_net_wm_user_time; - initial_props[i++] = display->atom_net_wm_state; - initial_props[i++] = display->atom_motif_wm_hints; + initial_props[i++] = display->atom__NET_WM_USER_TIME; + initial_props[i++] = display->atom__NET_WM_STATE; + initial_props[i++] = display->atom__MOTIF_WM_HINTS; initial_props[i++] = XA_WM_TRANSIENT_FOR; - initial_props[i++] = display->atom_net_wm_user_time_window; + initial_props[i++] = display->atom__NET_WM_USER_TIME_WINDOW; g_assert (N_INITIAL_PROPS == i); meta_window_reload_properties (window, initial_props, N_INITIAL_PROPS); @@ -1103,10 +1103,10 @@ meta_window_free (MetaWindow *window, meta_verbose ("Cleaning state from window %s\n", window->desc); XDeleteProperty (window->display->xdisplay, window->xwindow, - window->display->atom_net_wm_desktop); + window->display->atom__NET_WM_DESKTOP); XDeleteProperty (window->display->xdisplay, window->xwindow, - window->display->atom_net_wm_state); + window->display->atom__NET_WM_STATE); set_wm_state (window, WithdrawnState); meta_error_trap_pop (window->display, FALSE); } @@ -1210,8 +1210,8 @@ set_wm_state (MetaWindow *window, meta_error_trap_push (window->display); XChangeProperty (window->display->xdisplay, window->xwindow, - window->display->atom_wm_state, - window->display->atom_wm_state, + window->display->atom_WM_STATE, + window->display->atom_WM_STATE, 32, PropModeReplace, (guchar*) data, 2); meta_error_trap_pop (window->display, FALSE); } @@ -1225,57 +1225,57 @@ set_net_wm_state (MetaWindow *window) i = 0; if (window->shaded) { - data[i] = window->display->atom_net_wm_state_shaded; + data[i] = window->display->atom__NET_WM_STATE_SHADED; ++i; } if (window->wm_state_modal) { - data[i] = window->display->atom_net_wm_state_modal; + data[i] = window->display->atom__NET_WM_STATE_MODAL; ++i; } if (window->skip_pager) { - data[i] = window->display->atom_net_wm_state_skip_pager; + data[i] = window->display->atom__NET_WM_STATE_SKIP_PAGER; ++i; } if (window->skip_taskbar) { - data[i] = window->display->atom_net_wm_state_skip_taskbar; + data[i] = window->display->atom__NET_WM_STATE_SKIP_TASKBAR; ++i; } if (window->maximized_horizontally) { - data[i] = window->display->atom_net_wm_state_maximized_horz; + data[i] = window->display->atom__NET_WM_STATE_MAXIMIZED_HORZ; ++i; } if (window->maximized_vertically) { - data[i] = window->display->atom_net_wm_state_maximized_vert; + data[i] = window->display->atom__NET_WM_STATE_MAXIMIZED_VERT; ++i; } if (window->fullscreen) { - data[i] = window->display->atom_net_wm_state_fullscreen; + data[i] = window->display->atom__NET_WM_STATE_FULLSCREEN; ++i; } if (!meta_window_showing_on_its_workspace (window) || window->shaded) { - data[i] = window->display->atom_net_wm_state_hidden; + data[i] = window->display->atom__NET_WM_STATE_HIDDEN; ++i; } if (window->wm_state_above) { - data[i] = window->display->atom_net_wm_state_above; + data[i] = window->display->atom__NET_WM_STATE_ABOVE; ++i; } if (window->wm_state_below) { - data[i] = window->display->atom_net_wm_state_below; + data[i] = window->display->atom__NET_WM_STATE_BELOW; ++i; } if (window->wm_state_demands_attention) { - data[i] = window->display->atom_net_wm_state_demands_attention; + data[i] = window->display->atom__NET_WM_STATE_DEMANDS_ATTENTION; ++i; } @@ -1283,7 +1283,7 @@ set_net_wm_state (MetaWindow *window) meta_error_trap_push (window->display); XChangeProperty (window->display->xdisplay, window->xwindow, - window->display->atom_net_wm_state, + window->display->atom__NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (guchar*) data, i); meta_error_trap_pop (window->display, FALSE); @@ -3096,9 +3096,9 @@ send_sync_request (MetaWindow *window) ev.type = ClientMessage; ev.window = window->xwindow; - ev.message_type = window->display->atom_wm_protocols; + ev.message_type = window->display->atom_WM_PROTOCOLS; ev.format = 32; - ev.data.l[0] = window->display->atom_net_wm_sync_request; + ev.data.l[0] = window->display->atom__NET_WM_SYNC_REQUEST; /* FIXME: meta_display_get_current_time() is bad, but since calls * come from meta_window_move_resize_internal (which in turn come * from all over), I'm not sure what we can do to fix it. Do we @@ -4094,7 +4094,7 @@ meta_window_focus (MetaWindow *window, "Sending WM_TAKE_FOCUS to %s since take_focus = true\n", window->desc); meta_window_send_icccm_message (window, - window->display->atom_wm_take_focus, + window->display->atom_WM_TAKE_FOCUS, timestamp); window->display->expected_focus_window = window; } @@ -4286,7 +4286,7 @@ update_net_frame_extents (MetaWindow *window) meta_error_trap_push (window->display); XChangeProperty (window->display->xdisplay, window->xwindow, - window->display->atom_net_frame_extents, + window->display->atom__NET_FRAME_EXTENTS, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 4); meta_error_trap_pop (window->display, FALSE); @@ -4313,7 +4313,7 @@ meta_window_set_current_workspace_hint (MetaWindow *window) meta_error_trap_push (window->display); XChangeProperty (window->display->xdisplay, window->xwindow, - window->display->atom_net_wm_desktop, + window->display->atom__NET_WM_DESKTOP, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); meta_error_trap_pop (window->display, FALSE); @@ -4417,7 +4417,7 @@ meta_window_send_icccm_message (MetaWindow *window, ev.type = ClientMessage; ev.window = window->xwindow; - ev.message_type = window->display->atom_wm_protocols; + ev.message_type = window->display->atom_WM_PROTOCOLS; ev.format = 32; ev.data.l[0] = atom; ev.data.l[1] = timestamp; @@ -4705,7 +4705,7 @@ meta_window_client_message (MetaWindow *window, display = window->display; if (event->xclient.message_type == - display->atom_net_close_window) + display->atom__NET_CLOSE_WINDOW) { guint32 timestamp; @@ -4725,7 +4725,7 @@ meta_window_client_message (MetaWindow *window, return TRUE; } else if (event->xclient.message_type == - display->atom_net_wm_desktop) + display->atom__NET_WM_DESKTOP) { int space; MetaWorkspace *workspace; @@ -4760,7 +4760,7 @@ meta_window_client_message (MetaWindow *window, return TRUE; } else if (event->xclient.message_type == - display->atom_net_wm_state) + display->atom__NET_WM_STATE) { gulong action; Atom first; @@ -4794,8 +4794,8 @@ meta_window_client_message (MetaWindow *window, meta_XFree (str2); } - if (first == display->atom_net_wm_state_shaded || - second == display->atom_net_wm_state_shaded) + if (first == display->atom__NET_WM_STATE_SHADED || + second == display->atom__NET_WM_STATE_SHADED) { gboolean shade; guint32 timestamp; @@ -4814,8 +4814,8 @@ meta_window_client_message (MetaWindow *window, meta_window_unshade (window, timestamp); } - if (first == display->atom_net_wm_state_fullscreen || - second == display->atom_net_wm_state_fullscreen) + if (first == display->atom__NET_WM_STATE_FULLSCREEN || + second == display->atom__NET_WM_STATE_FULLSCREEN) { gboolean make_fullscreen; @@ -4827,8 +4827,8 @@ meta_window_client_message (MetaWindow *window, meta_window_unmake_fullscreen (window); } - if (first == display->atom_net_wm_state_maximized_horz || - second == display->atom_net_wm_state_maximized_horz) + if (first == display->atom__NET_WM_STATE_MAXIMIZED_HORZ || + second == display->atom__NET_WM_STATE_MAXIMIZED_HORZ) { gboolean max; @@ -4849,8 +4849,8 @@ meta_window_client_message (MetaWindow *window, } } - if (first == display->atom_net_wm_state_maximized_vert || - second == display->atom_net_wm_state_maximized_vert) + if (first == display->atom__NET_WM_STATE_MAXIMIZED_VERT || + second == display->atom__NET_WM_STATE_MAXIMIZED_VERT) { gboolean max; @@ -4871,8 +4871,8 @@ meta_window_client_message (MetaWindow *window, } } - if (first == display->atom_net_wm_state_modal || - second == display->atom_net_wm_state_modal) + if (first == display->atom__NET_WM_STATE_MODAL || + second == display->atom__NET_WM_STATE_MODAL) { window->wm_state_modal = (action == _NET_WM_STATE_ADD) || @@ -4882,8 +4882,8 @@ meta_window_client_message (MetaWindow *window, meta_window_queue(window, META_QUEUE_MOVE_RESIZE); } - if (first == display->atom_net_wm_state_skip_pager || - second == display->atom_net_wm_state_skip_pager) + if (first == display->atom__NET_WM_STATE_SKIP_PAGER || + second == display->atom__NET_WM_STATE_SKIP_PAGER) { window->wm_state_skip_pager = (action == _NET_WM_STATE_ADD) || @@ -4893,8 +4893,8 @@ meta_window_client_message (MetaWindow *window, set_net_wm_state (window); } - if (first == display->atom_net_wm_state_skip_taskbar || - second == display->atom_net_wm_state_skip_taskbar) + if (first == display->atom__NET_WM_STATE_SKIP_TASKBAR || + second == display->atom__NET_WM_STATE_SKIP_TASKBAR) { window->wm_state_skip_taskbar = (action == _NET_WM_STATE_ADD) || @@ -4904,8 +4904,8 @@ meta_window_client_message (MetaWindow *window, set_net_wm_state (window); } - if (first == display->atom_net_wm_state_above || - second == display->atom_net_wm_state_above) + if (first == display->atom__NET_WM_STATE_ABOVE || + second == display->atom__NET_WM_STATE_ABOVE) { window->wm_state_above = (action == _NET_WM_STATE_ADD) || @@ -4915,8 +4915,8 @@ meta_window_client_message (MetaWindow *window, set_net_wm_state (window); } - if (first == display->atom_net_wm_state_below || - second == display->atom_net_wm_state_below) + if (first == display->atom__NET_WM_STATE_BELOW || + second == display->atom__NET_WM_STATE_BELOW) { window->wm_state_below = (action == _NET_WM_STATE_ADD) || @@ -4926,8 +4926,8 @@ meta_window_client_message (MetaWindow *window, set_net_wm_state (window); } - if (first == display->atom_net_wm_state_demands_attention || - second == display->atom_net_wm_state_demands_attention) + if (first == display->atom__NET_WM_STATE_DEMANDS_ATTENTION || + second == display->atom__NET_WM_STATE_DEMANDS_ATTENTION) { if ((action == _NET_WM_STATE_ADD) || (action == _NET_WM_STATE_TOGGLE && !window->wm_state_demands_attention)) @@ -4939,7 +4939,7 @@ meta_window_client_message (MetaWindow *window, return TRUE; } else if (event->xclient.message_type == - display->atom_wm_change_state) + display->atom_WM_CHANGE_STATE) { meta_verbose ("WM_CHANGE_STATE client message, state: %ld\n", event->xclient.data.l[0]); @@ -4950,7 +4950,7 @@ meta_window_client_message (MetaWindow *window, return TRUE; } else if (event->xclient.message_type == - display->atom_net_wm_moveresize) + display->atom__NET_WM_MOVERESIZE) { int x_root; int y_root; @@ -5085,7 +5085,7 @@ meta_window_client_message (MetaWindow *window, return TRUE; } else if (event->xclient.message_type == - display->atom_net_moveresize_window) + display->atom__NET_MOVERESIZE_WINDOW) { int gravity, source; guint value_mask; @@ -5106,7 +5106,7 @@ meta_window_client_message (MetaWindow *window, event->xclient.data.l[4]); /* height */ } else if (event->xclient.message_type == - display->atom_net_active_window) + display->atom__NET_ACTIVE_WINDOW) { MetaClientType source_indication; guint32 timestamp; @@ -5332,7 +5332,7 @@ process_property_notify (MetaWindow *window, /* First, property notifies to ignore because we shouldn't honor * new values */ - if (event->atom == window->display->atom_net_wm_state) + if (event->atom == window->display->atom__NET_WM_STATE) { meta_verbose ("Property notify on %s for _NET_WM_STATE, ignoring (we should be the one who set the property in the first place)\n", window->desc); @@ -5353,10 +5353,10 @@ process_property_notify (MetaWindow *window, if (!window->using_net_wm_name) meta_window_reload_property (window, XA_WM_NAME); } - else if (event->atom == window->display->atom_net_wm_name) + else if (event->atom == window->display->atom__NET_WM_NAME) { meta_verbose ("Property notify on %s for NET_WM_NAME\n", window->desc); - meta_window_reload_property (window, window->display->atom_net_wm_name); + meta_window_reload_property (window, window->display->atom__NET_WM_NAME); /* if _NET_WM_NAME was unset, reload WM_NAME */ if (!window->using_net_wm_name) @@ -5370,10 +5370,10 @@ process_property_notify (MetaWindow *window, if (!window->using_net_wm_icon_name) meta_window_reload_property (window, XA_WM_ICON_NAME); } - else if (event->atom == window->display->atom_net_wm_icon_name) + else if (event->atom == window->display->atom__NET_WM_ICON_NAME) { meta_verbose ("Property notify on %s for NET_WM_ICON_NAME\n", window->desc); - meta_window_reload_property (window, window->display->atom_net_wm_icon_name); + meta_window_reload_property (window, window->display->atom__NET_WM_ICON_NAME); /* if _NET_WM_ICON_NAME was unset, reload WM_ICON_NAME */ if (!window->using_net_wm_icon_name) @@ -5388,11 +5388,11 @@ process_property_notify (MetaWindow *window, /* See if we need to constrain current size */ meta_window_queue(window, META_QUEUE_MOVE_RESIZE); } - else if (event->atom == window->display->atom_wm_protocols) + else if (event->atom == window->display->atom_WM_PROTOCOLS) { meta_verbose ("Property notify on %s for WM_PROTOCOLS\n", window->desc); - meta_window_reload_property (window, window->display->atom_wm_protocols); + meta_window_reload_property (window, window->display->atom_WM_PROTOCOLS); } else if (event->atom == XA_WM_HINTS) { @@ -5400,12 +5400,12 @@ process_property_notify (MetaWindow *window, meta_window_reload_property (window, XA_WM_HINTS); } - else if (event->atom == window->display->atom_motif_wm_hints) + else if (event->atom == window->display->atom__MOTIF_WM_HINTS) { meta_verbose ("Property notify on %s for MOTIF_WM_HINTS\n", window->desc); meta_window_reload_property (window, - window->display->atom_motif_wm_hints); + window->display->atom__MOTIF_WM_HINTS); } else if (event->atom == XA_WM_CLASS) { @@ -5420,26 +5420,26 @@ process_property_notify (MetaWindow *window, meta_window_reload_property (window, XA_WM_TRANSIENT_FOR); } else if (event->atom == - window->display->atom_wm_window_role) + window->display->atom_WM_WINDOW_ROLE) { meta_verbose ("Property notify on %s for WM_WINDOW_ROLE\n", window->desc); update_role (window); } else if (event->atom == - window->display->atom_wm_client_leader || + window->display->atom_WM_CLIENT_LEADER || event->atom == - window->display->atom_sm_client_id) + window->display->atom_SM_CLIENT_ID) { 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) + window->display->atom__NET_WM_WINDOW_TYPE) { 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) + else if (event->atom == window->display->atom__NET_WM_ICON) { meta_verbose ("Property notify on %s for NET_WM_ICON\n", window->desc); meta_icon_cache_property_changed (&window->icon_cache, @@ -5447,7 +5447,7 @@ process_property_notify (MetaWindow *window, event->atom); meta_window_queue(window, META_QUEUE_UPDATE_ICON); } - else if (event->atom == window->display->atom_kwm_win_icon) + else if (event->atom == window->display->atom__KWM_WIN_ICON) { meta_verbose ("Property notify on %s for KWM_WIN_ICON\n", window->desc); @@ -5456,41 +5456,41 @@ process_property_notify (MetaWindow *window, event->atom); meta_window_queue(window, META_QUEUE_UPDATE_ICON); } - else if ((event->atom == window->display->atom_net_wm_strut) || - (event->atom == window->display->atom_net_wm_strut_partial)) + else if ((event->atom == window->display->atom__NET_WM_STRUT) || + (event->atom == window->display->atom__NET_WM_STRUT_PARTIAL)) { meta_verbose ("Property notify on %s for _NET_WM_STRUT\n", window->desc); meta_window_update_struts (window); } - else if (event->atom == window->display->atom_net_startup_id) + else if (event->atom == window->display->atom__NET_STARTUP_ID) { meta_verbose ("Property notify on %s for _NET_STARTUP_ID\n", window->desc); meta_window_reload_property (window, - window->display->atom_net_startup_id); + window->display->atom__NET_STARTUP_ID); } - else if (event->atom == window->display->atom_net_wm_sync_request_counter) + else if (event->atom == window->display->atom__NET_WM_SYNC_REQUEST_COUNTER) { meta_verbose ("Property notify on %s for _NET_WM_SYNC_REQUEST_COUNTER\n", window->desc); meta_window_reload_property (window, - window->display->atom_net_wm_sync_request_counter); + window->display->atom__NET_WM_SYNC_REQUEST_COUNTER); } - else if (event->atom == window->display->atom_net_wm_user_time) + else if (event->atom == window->display->atom__NET_WM_USER_TIME) { Window xid; - Atom atom_net_wm_user_time; + Atom atom__NET_WM_USER_TIME; meta_verbose ("Property notify on %s for _NET_WM_USER_TIME\n", window->desc); - atom_net_wm_user_time = window->display->atom_net_wm_user_time; + atom__NET_WM_USER_TIME = window->display->atom__NET_WM_USER_TIME; if (window->user_time_window) xid = window->user_time_window; else xid = window->xwindow; meta_window_reload_property_from_xwindow (window, xid, - atom_net_wm_user_time); + atom__NET_WM_USER_TIME); } return TRUE; @@ -5554,7 +5554,7 @@ meta_window_get_icon_geometry (MetaWindow *window, if (meta_prop_get_cardinal_list (window->display, window->xwindow, - window->display->atom_net_wm_icon_geometry, + window->display->atom__NET_WM_ICON_GEOMETRY, &geometry, &nitems)) { if (nitems != 4) @@ -5588,7 +5588,7 @@ read_client_leader (MetaDisplay *display, Window retval = None; meta_prop_get_window (display, xwindow, - display->atom_wm_client_leader, + display->atom_WM_CLIENT_LEADER, &retval); return retval; @@ -5643,7 +5643,7 @@ update_sm_hints (MetaWindow *window) window->xclient_leader = leader; if (meta_prop_get_latin1_string (window->display, leader, - window->display->atom_sm_client_id, + window->display->atom_SM_CLIENT_ID, &str)) { window->sm_client_id = g_strdup (str); @@ -5663,7 +5663,7 @@ update_sm_hints (MetaWindow *window) str = NULL; if (meta_prop_get_latin1_string (window->display, window->xwindow, - window->display->atom_sm_client_id, + window->display->atom_SM_CLIENT_ID, &str)) { if (window->sm_client_id == NULL) /* first time through */ @@ -5691,7 +5691,7 @@ update_role (MetaWindow *window) window->role = NULL; if (meta_prop_get_latin1_string (window->display, window->xwindow, - window->display->atom_wm_window_role, + window->display->atom_WM_WINDOW_ROLE, &str)) { window->role = g_strdup (str); @@ -5714,7 +5714,7 @@ update_net_wm_type (MetaWindow *window) atoms = NULL; meta_prop_get_atom_list (window->display, window->xwindow, - window->display->atom_net_wm_window_type, + window->display->atom__NET_WM_WINDOW_TYPE, &atoms, &n_atoms); i = 0; @@ -5723,14 +5723,14 @@ update_net_wm_type (MetaWindow *window) /* We break as soon as we find one we recognize, * supposed to prefer those near the front of the list */ - if (atoms[i] == window->display->atom_net_wm_window_type_desktop || - atoms[i] == window->display->atom_net_wm_window_type_dock || - atoms[i] == window->display->atom_net_wm_window_type_toolbar || - atoms[i] == window->display->atom_net_wm_window_type_menu || - atoms[i] == window->display->atom_net_wm_window_type_dialog || - atoms[i] == window->display->atom_net_wm_window_type_normal || - atoms[i] == window->display->atom_net_wm_window_type_utility || - atoms[i] == window->display->atom_net_wm_window_type_splash) + if (atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP || + atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_DOCK || + atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_TOOLBAR || + atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_MENU || + atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_DIALOG || + atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL || + atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_UTILITY || + atoms[i] == window->display->atom__NET_WM_WINDOW_TYPE_SPLASH) { window->type_atom = atoms[i]; break; @@ -5889,7 +5889,7 @@ meta_window_update_struts (MetaWindow *window) if (meta_prop_get_cardinal_list (window->display, window->xwindow, - window->display->atom_net_wm_strut_partial, + window->display->atom__NET_WM_STRUT_PARTIAL, &struts, &nitems)) { if (nitems != 12) @@ -5955,7 +5955,7 @@ meta_window_update_struts (MetaWindow *window) if (!new_struts && meta_prop_get_cardinal_list (window->display, window->xwindow, - window->display->atom_net_wm_strut, + window->display->atom__NET_WM_STRUT, &struts, &nitems)) { if (nitems != 4) @@ -6059,21 +6059,21 @@ recalc_window_type (MetaWindow *window) if (window->type_atom != None) { - if (window->type_atom == window->display->atom_net_wm_window_type_desktop) + if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP) window->type = META_WINDOW_DESKTOP; - else if (window->type_atom == window->display->atom_net_wm_window_type_dock) + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DOCK) window->type = META_WINDOW_DOCK; - else if (window->type_atom == window->display->atom_net_wm_window_type_toolbar) + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLBAR) window->type = META_WINDOW_TOOLBAR; - else if (window->type_atom == window->display->atom_net_wm_window_type_menu) + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_MENU) window->type = META_WINDOW_MENU; - else if (window->type_atom == window->display->atom_net_wm_window_type_dialog) + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DIALOG) window->type = META_WINDOW_DIALOG; - else if (window->type_atom == window->display->atom_net_wm_window_type_normal) + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL) window->type = META_WINDOW_NORMAL; - else if (window->type_atom == window->display->atom_net_wm_window_type_utility) + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_UTILITY) window->type = META_WINDOW_UTILITY; - else if (window->type_atom == window->display->atom_net_wm_window_type_splash) + else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_SPLASH) window->type = META_WINDOW_SPLASHSCREEN; else meta_bug ("Set a type atom for %s that wasn't handled in recalc_window_type\n", @@ -6124,27 +6124,27 @@ set_allowed_actions_hint (MetaWindow *window) i = 0; if (window->has_move_func) { - data[i] = window->display->atom_net_wm_action_move; + data[i] = window->display->atom__NET_WM_ACTION_MOVE; ++i; } if (window->has_resize_func) { - data[i] = window->display->atom_net_wm_action_resize; + data[i] = window->display->atom__NET_WM_ACTION_RESIZE; ++i; } if (window->has_fullscreen_func) { - data[i] = window->display->atom_net_wm_action_fullscreen; + data[i] = window->display->atom__NET_WM_ACTION_FULLSCREEN; ++i; } if (window->has_minimize_func) { - data[i] = window->display->atom_net_wm_action_minimize; + data[i] = window->display->atom__NET_WM_ACTION_MINIMIZE; ++i; } if (window->has_shade_func) { - data[i] = window->display->atom_net_wm_action_shade; + data[i] = window->display->atom__NET_WM_ACTION_SHADE; ++i; } /* sticky according to EWMH is different from metacity's sticky; @@ -6152,24 +6152,24 @@ set_allowed_actions_hint (MetaWindow *window) */ if (window->has_maximize_func) { - data[i] = window->display->atom_net_wm_action_maximize_horz; + data[i] = window->display->atom__NET_WM_ACTION_MAXIMIZE_HORZ; ++i; - data[i] = window->display->atom_net_wm_action_maximize_vert; + data[i] = window->display->atom__NET_WM_ACTION_MAXIMIZE_VERT; ++i; } /* We always allow this */ - data[i] = window->display->atom_net_wm_action_change_desktop; + data[i] = window->display->atom__NET_WM_ACTION_CHANGE_DESKTOP; ++i; if (window->has_close_func) { - data[i] = window->display->atom_net_wm_action_close; + data[i] = window->display->atom__NET_WM_ACTION_CLOSE; ++i; } /* I guess we always allow above/below operations */ - data[i] = window->display->atom_net_wm_action_above; + data[i] = window->display->atom__NET_WM_ACTION_ABOVE; ++i; - data[i] = window->display->atom_net_wm_action_below; + data[i] = window->display->atom__NET_WM_ACTION_BELOW; ++i; g_assert (i <= MAX_N_ACTIONS); @@ -6178,7 +6178,7 @@ set_allowed_actions_hint (MetaWindow *window) meta_error_trap_push (window->display); XChangeProperty (window->display->xdisplay, window->xwindow, - window->display->atom_net_wm_allowed_actions, + window->display->atom__NET_WM_ALLOWED_ACTIONS, XA_ATOM, 32, PropModeReplace, (guchar*) data, i); meta_error_trap_pop (window->display, FALSE); diff --git a/src/core/workspace.c b/src/core/workspace.c index c2282c212..d7985d5fe 100644 --- a/src/core/workspace.c +++ b/src/core/workspace.c @@ -419,7 +419,7 @@ set_active_space_hint (MetaScreen *screen) meta_error_trap_push (screen->display); XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_current_desktop, + screen->display->atom__NET_CURRENT_DESKTOP, XA_CARDINAL, 32, PropModeReplace, (guchar*) data, 1); meta_error_trap_pop (screen->display, FALSE); diff --git a/src/core/xprops.c b/src/core/xprops.c index 1905ccaaf..55332d307 100644 --- a/src/core/xprops.c +++ b/src/core/xprops.c @@ -389,7 +389,7 @@ utf8_string_from_results (GetPropertyResults *results, *str_p = NULL; if (!validate_or_free_results (results, 8, - results->display->atom_utf8_string, FALSE)) + results->display->atom_UTF8_STRING, FALSE)) return FALSE; if (results->n_items > 0 && @@ -424,7 +424,7 @@ meta_prop_get_utf8_string (MetaDisplay *display, *str_p = NULL; if (!get_property (display, xwindow, xatom, - display->atom_utf8_string, + display->atom_UTF8_STRING, &results)) return FALSE; @@ -446,7 +446,7 @@ utf8_list_from_results (GetPropertyResults *results, *n_str_p = 0; if (!validate_or_free_results (results, 8, - results->display->atom_utf8_string, FALSE)) + results->display->atom_UTF8_STRING, FALSE)) return FALSE; /* I'm not sure this is right, but I'm guessing the @@ -519,7 +519,7 @@ meta_prop_get_utf8_list (MetaDisplay *display, *str_p = NULL; if (!get_property (display, xwindow, xatom, - display->atom_utf8_string, + display->atom_UTF8_STRING, &results)) return FALSE; @@ -535,7 +535,7 @@ meta_prop_set_utf8_string_hint (MetaDisplay *display, meta_error_trap_push (display); XChangeProperty (display->xdisplay, xwindow, atom, - display->atom_utf8_string, + display->atom_UTF8_STRING, 8, PropModeReplace, (guchar*) val, strlen (val)); meta_error_trap_pop (display, FALSE); } @@ -969,7 +969,7 @@ meta_prop_get_values (MetaDisplay *display, break; case META_PROP_VALUE_UTF8_LIST: case META_PROP_VALUE_UTF8: - values[i].required_type = display->atom_utf8_string; + values[i].required_type = display->atom_UTF8_STRING; break; case META_PROP_VALUE_STRING: case META_PROP_VALUE_STRING_AS_UTF8: