Shuffle some property stuff around

Just somewhat cleaner.
This commit is contained in:
Kim Woelders 2021-08-21 15:18:15 +02:00
parent 6c173cc65e
commit 204999090e
5 changed files with 69 additions and 66 deletions

View File

@ -50,6 +50,7 @@
#include "slide.h"
#include "timers.h"
#include "tooltips.h"
#include "xprop.h"
#include "xwin.h"
#define DESK_EVENT_MASK1 \

View File

@ -40,28 +40,6 @@
static void EHintsSetDeskInfo(void);
static void EHintsSetAreaInfo(void);
static const char *const atoms_misc_names[] = {
/* Misc atoms */
"MANAGER",
/* Root background atoms */
"_XROOTPMAP_ID",
"_XROOTCOLOR_PIXEL",
/* E16 atoms */
"ENLIGHTENMENT_VERSION",
"ENLIGHTENMENT_COMMS",
"ENL_MSG",
"ENL_INTERNAL_AREA_DATA",
"ENL_INTERNAL_DESK_DATA",
"ENL_WIN_DATA",
"ENL_WIN_BORDER"
};
EX_Atom atoms_misc[10];
static unsigned int desk_info = 0;
void
@ -69,11 +47,10 @@ HintsInit(void)
{
EX_Window win;
ex_atoms_get(atoms_misc_names, E_ARRAY_SIZE(atoms_misc_names), atoms_misc);
win = XCreateSimpleWindow(disp, WinGetXwin(VROOT), -200, -200, 5, 5,
0, 0, 0);
ex_atoms_init();
ICCCM_Init();
MWM_SetInfo();
#if ENABLE_GNOME

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2020 Kim Woelders
* Copyright (C) 2004-2021 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -25,28 +25,8 @@
#define _HINTS_H_
#include "etypes.h"
#include "xprop.h"
#include "xwin.h"
/* Misc atoms */
extern EX_Atom atoms_misc[];
#define E_XA_MANAGER atoms_misc[0]
#define E_XROOTPMAP_ID atoms_misc[1]
#define E_XROOTCOLOR_PIXEL atoms_misc[2]
#define E16_ATOM_VERSION atoms_misc[3]
#define E16_ATOM_COMMS_WIN atoms_misc[4]
#define E16_ATOM_COMMS_MSG atoms_misc[5]
#define E16_ATOM_INTERNAL_AREA_DATA atoms_misc[6]
#define E16_ATOM_INTERNAL_DESK_DATA atoms_misc[7]
#define E16_ATOM_WIN_DATA atoms_misc[8]
#define E16_ATOM_WIN_BORDER atoms_misc[9]
/* ewmh.c */
void EWMH_Init(EX_Window win_wm_check);
void EWMH_SetDesktopCount(void);

View File

@ -350,7 +350,7 @@ ex_window_prop_string_get(EX_Window win, EX_Atom atom)
static void
_ex_window_prop_string_utf8_set(EX_Window win, EX_Atom atom, const char *str)
{
XChangeProperty(_ex_disp, win, atom, EX_ATOM_UTF8_STRING, 8,
XChangeProperty(_ex_disp, win, atom, E_XA_UTF8_STRING, 8,
PropModeReplace, (unsigned char *)str, strlen(str));
}
@ -369,7 +369,7 @@ _ex_window_prop_string_utf8_get(EX_Window win, EX_Atom atom)
str = NULL;
prop_ret = NULL;
XGetWindowProperty(_ex_disp, win, atom, 0, 0x7fffffff, False,
EX_ATOM_UTF8_STRING, &type_ret,
E_XA_UTF8_STRING, &type_ret,
&format_ret, &num_ret, &bytes_after, &prop_ret);
if (prop_ret && num_ret > 0 && format_ret == 8)
{
@ -567,13 +567,46 @@ ex_window_prop_window_list_get(EX_Window win, EX_Atom atom, EX_Window ** plst)
return ex_window_prop_xid_list_get(win, atom, XA_WINDOW, plst);
}
/*
* Misc atom stuff
*/
static const char *const atoms_misc_names[] = {
/* Misc atoms */
"UTF8_STRING",
"MANAGER",
/* Root background atoms */
"_XROOTPMAP_ID",
"_XROOTCOLOR_PIXEL",
/* E16 atoms */
"ENLIGHTENMENT_VERSION",
"ENLIGHTENMENT_COMMS",
"ENL_MSG",
"ENL_INTERNAL_AREA_DATA",
"ENL_INTERNAL_DESK_DATA",
"ENL_WIN_DATA",
"ENL_WIN_BORDER",
};
EX_Atom atoms_misc[E_ARRAY_SIZE(atoms_misc_names)];
void
ex_atoms_init(void)
{
#if DEBUG_CHECK
assert(CHECK_COUNT_MISC == E_ARRAY_SIZE(atoms_misc));
#endif
ex_atoms_get(atoms_misc_names, E_ARRAY_SIZE(atoms_misc), atoms_misc);
}
/*
* ICCCM stuff
*/
static const char *const atoms_icccm_names[] = {
/* *INDENT-OFF* */
/* ICCCM */
"WM_STATE",
"WM_WINDOW_ROLE",
@ -586,13 +619,8 @@ static const char *const atoms_icccm_names[] = {
#if 0
"WM_SAVE_YOURSELF",
#endif
/* Misc. */
"UTF8_STRING",
/* *INDENT-ON* */
};
EX_Atom atoms_icccm[CHECK_COUNT_ICCCM];
EX_Atom atoms_icccm[E_ARRAY_SIZE(atoms_icccm_names)];
void
ex_icccm_init(void)
@ -709,8 +737,6 @@ ex_icccm_name_class_get(EX_Window win, char **name, char **clss)
*/
static const char *const atoms_netwm_names[] = {
/* *INDENT-OFF* */
/* Window manager info */
"_NET_SUPPORTED",
"_NET_SUPPORTING_WM_CHECK",
@ -811,10 +837,8 @@ static const char *const atoms_netwm_names[] = {
"_NET_STARTUP_ID",
"_NET_STARTUP_INFO_BEGIN",
"_NET_STARTUP_INFO",
/* *INDENT-ON* */
};
EX_Atom atoms_netwm[CHECK_COUNT_NETWM];
EX_Atom atoms_netwm[E_ARRAY_SIZE(atoms_netwm_names)];
void
ex_netwm_init(void)
@ -888,7 +912,7 @@ ex_netwm_desk_names_set(EX_Window root, const char **names,
}
XChangeProperty(_ex_disp, root, EX_ATOM_NET_DESKTOP_NAMES,
EX_ATOM_UTF8_STRING, 8, PropModeReplace,
E_XA_UTF8_STRING, 8, PropModeReplace,
(unsigned char *)buf, len);
done:

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2014 Kim Woelders
* Copyright (C) 2004-2021 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -78,12 +78,33 @@ void ex_window_prop_string_set(EX_Window win, EX_Atom atom,
const char *str);
char *ex_window_prop_string_get(EX_Window win, EX_Atom atom);
/* Misc. */
/* Misc atoms */
extern EX_Atom atoms_misc[];
#define E_XA_UTF8_STRING atoms_misc[0]
#define E_XA_MANAGER atoms_misc[1]
#define E_XROOTPMAP_ID atoms_misc[2]
#define E_XROOTCOLOR_PIXEL atoms_misc[3]
#define E16_ATOM_VERSION atoms_misc[4]
#define E16_ATOM_COMMS_WIN atoms_misc[5]
#define E16_ATOM_COMMS_MSG atoms_misc[6]
#define E16_ATOM_INTERNAL_AREA_DATA atoms_misc[7]
#define E16_ATOM_INTERNAL_DESK_DATA atoms_misc[8]
#define E16_ATOM_WIN_DATA atoms_misc[9]
#define E16_ATOM_WIN_BORDER atoms_misc[10]
#define CHECK_COUNT_MISC 11
void ex_atoms_init(void);
/* ICCCM */
#include <X11/Xatom.h>
extern EX_Atom atoms_icccm[];
#define EX_ATOM_UTF8_STRING atoms_icccm[8]
/* ICCCM */
#define EX_ATOM_WM_STATE atoms_icccm[0]
#define EX_ATOM_WM_WINDOW_ROLE atoms_icccm[1]
@ -94,7 +115,7 @@ extern EX_Atom atoms_icccm[];
#define EX_ATOM_WM_DELETE_WINDOW atoms_icccm[6]
#define EX_ATOM_WM_TAKE_FOCUS atoms_icccm[7]
#define CHECK_COUNT_ICCCM 9
#define CHECK_COUNT_ICCCM 8
#define EX_ATOM_WM_CLASS XA_WM_CLASS
#define EX_ATOM_WM_NAME XA_WM_NAME