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.
This commit is contained in:
Simon Ser 2020-03-06 12:29:20 +01:00 committed by Drew DeVault
parent 52c67284e2
commit 68a69ee079
2 changed files with 63 additions and 63 deletions

View File

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

View File

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