xwayland: use explicit indexes when initializing atom_map

It's very easy to break the mapping between the atom_name enum and the
atom_map array. Use explicit indexes to prevent issues.
master
Simon Ser 5 years ago committed by Drew DeVault
parent 52c67284e2
commit 68a69ee079

@ -81,7 +81,7 @@ enum atom_name {
DND_ACTION_ASK,
DND_ACTION_PRIVATE,
_NET_CLIENT_LIST,
ATOM_LAST,
ATOM_LAST // keep last
};
extern const char *atom_map[ATOM_LAST];

@ -17,68 +17,68 @@
#include "xwayland/xwm.h"
const char *atom_map[ATOM_LAST] = {
"WL_SURFACE_ID",
"WM_DELETE_WINDOW",
"WM_PROTOCOLS",
"WM_HINTS",
"WM_NORMAL_HINTS",
"WM_SIZE_HINTS",
"WM_WINDOW_ROLE",
"_MOTIF_WM_HINTS",
"UTF8_STRING",
"WM_S0",
"_NET_SUPPORTED",
"_NET_WM_CM_S0",
"_NET_WM_PID",
"_NET_WM_NAME",
"_NET_WM_STATE",
"_NET_WM_WINDOW_TYPE",
"WM_TAKE_FOCUS",
"WINDOW",
"_NET_ACTIVE_WINDOW",
"_NET_WM_MOVERESIZE",
"_NET_WM_NAME",
"_NET_SUPPORTING_WM_CHECK",
"_NET_WM_STATE_MODAL",
"_NET_WM_STATE_FULLSCREEN",
"_NET_WM_STATE_MAXIMIZED_VERT",
"_NET_WM_STATE_MAXIMIZED_HORZ",
"_NET_WM_PING",
"WM_STATE",
"CLIPBOARD",
"PRIMARY",
"_WL_SELECTION",
"TARGETS",
"CLIPBOARD_MANAGER",
"INCR",
"TEXT",
"TIMESTAMP",
"DELETE",
"_NET_WM_WINDOW_TYPE_NORMAL",
"_NET_WM_WINDOW_TYPE_UTILITY",
"_NET_WM_WINDOW_TYPE_TOOLTIP",
"_NET_WM_WINDOW_TYPE_DND",
"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
"_NET_WM_WINDOW_TYPE_POPUP_MENU",
"_NET_WM_WINDOW_TYPE_COMBO",
"_NET_WM_WINDOW_TYPE_MENU",
"_NET_WM_WINDOW_TYPE_NOTIFICATION",
"_NET_WM_WINDOW_TYPE_SPLASH",
"XdndSelection",
"XdndAware",
"XdndStatus",
"XdndPosition",
"XdndEnter",
"XdndLeave",
"XdndDrop",
"XdndFinished",
"XdndProxy",
"XdndTypeList",
"XdndActionMove",
"XdndActionCopy",
"XdndActionAsk",
"XdndActionPrivate",
"_NET_CLIENT_LIST",
[WL_SURFACE_ID] = "WL_SURFACE_ID",
[WM_DELETE_WINDOW] = "WM_DELETE_WINDOW",
[WM_PROTOCOLS] = "WM_PROTOCOLS",
[WM_HINTS] = "WM_HINTS",
[WM_NORMAL_HINTS] = "WM_NORMAL_HINTS",
[WM_SIZE_HINTS] = "WM_SIZE_HINTS",
[WM_WINDOW_ROLE] = "WM_WINDOW_ROLE",
[MOTIF_WM_HINTS] = "_MOTIF_WM_HINTS",
[UTF8_STRING] = "UTF8_STRING",
[WM_S0] = "WM_S0",
[NET_SUPPORTED] = "_NET_SUPPORTED",
[NET_WM_CM_S0] = "_NET_WM_CM_S0",
[NET_WM_PID] = "_NET_WM_PID",
[NET_WM_NAME] = "_NET_WM_NAME",
[NET_WM_STATE] = "_NET_WM_STATE",
[NET_WM_WINDOW_TYPE] = "_NET_WM_WINDOW_TYPE",
[WM_TAKE_FOCUS] = "WM_TAKE_FOCUS",
[WINDOW] = "WINDOW",
[_NET_ACTIVE_WINDOW] = "_NET_ACTIVE_WINDOW",
[_NET_WM_MOVERESIZE] = "_NET_WM_MOVERESIZE",
[_NET_WM_NAME] = "_NET_WM_NAME",
[_NET_SUPPORTING_WM_CHECK] = "_NET_SUPPORTING_WM_CHECK",
[_NET_WM_STATE_MODAL] = "_NET_WM_STATE_MODAL",
[_NET_WM_STATE_FULLSCREEN] = "_NET_WM_STATE_FULLSCREEN",
[_NET_WM_STATE_MAXIMIZED_VERT] = "_NET_WM_STATE_MAXIMIZED_VERT",
[_NET_WM_STATE_MAXIMIZED_HORZ] = "_NET_WM_STATE_MAXIMIZED_HORZ",
[_NET_WM_PING] = "_NET_WM_PING",
[WM_STATE] = "WM_STATE",
[CLIPBOARD] = "CLIPBOARD",
[PRIMARY] = "PRIMARY",
[WL_SELECTION] = "_WL_SELECTION",
[TARGETS] = "TARGETS",
[CLIPBOARD_MANAGER] = "CLIPBOARD_MANAGER",
[INCR] = "INCR",
[TEXT] = "TEXT",
[TIMESTAMP] = "TIMESTAMP",
[DELETE] = "DELETE",
[NET_WM_WINDOW_TYPE_NORMAL] = "_NET_WM_WINDOW_TYPE_NORMAL",
[NET_WM_WINDOW_TYPE_UTILITY] = "_NET_WM_WINDOW_TYPE_UTILITY",
[NET_WM_WINDOW_TYPE_TOOLTIP] = "_NET_WM_WINDOW_TYPE_TOOLTIP",
[NET_WM_WINDOW_TYPE_DND] = "_NET_WM_WINDOW_TYPE_DND",
[NET_WM_WINDOW_TYPE_DROPDOWN_MENU] = "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
[NET_WM_WINDOW_TYPE_POPUP_MENU] = "_NET_WM_WINDOW_TYPE_POPUP_MENU",
[NET_WM_WINDOW_TYPE_COMBO] = "_NET_WM_WINDOW_TYPE_COMBO",
[NET_WM_WINDOW_TYPE_MENU] = "_NET_WM_WINDOW_TYPE_MENU",
[NET_WM_WINDOW_TYPE_NOTIFICATION] = "_NET_WM_WINDOW_TYPE_NOTIFICATION",
[NET_WM_WINDOW_TYPE_SPLASH] = "_NET_WM_WINDOW_TYPE_SPLASH",
[DND_SELECTION] = "XdndSelection",
[DND_AWARE] = "XdndAware",
[DND_STATUS] = "XdndStatus",
[DND_POSITION] = "XdndPosition",
[DND_ENTER] = "XdndEnter",
[DND_LEAVE] = "XdndLeave",
[DND_DROP] = "XdndDrop",
[DND_FINISHED] = "XdndFinished",
[DND_PROXY] = "XdndProxy",
[DND_TYPE_LIST] = "XdndTypeList",
[DND_ACTION_MOVE] = "XdndActionMove",
[DND_ACTION_COPY] = "XdndActionCopy",
[DND_ACTION_ASK] = "XdndActionAsk",
[DND_ACTION_PRIVATE] = "XdndActionPrivate",
[_NET_CLIENT_LIST] = "_NET_CLIENT_LIST",
};
static const struct wlr_surface_role xwayland_surface_role;

Loading…
Cancel
Save