[EGIT] [e16/e16] master 04/09: Shuffle some property stuff around
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=204999090e25aa25a0c430f3f9fe3bd7038594ca commit 204999090e25aa25a0c430f3f9fe3bd7038594ca Author: Kim Woelders Date: Sat Aug 21 15:18:15 2021 +0200 Shuffle some property stuff around Just somewhat cleaner. --- src/desktops.c | 1 + src/hints.c| 25 + src/hints.h| 22 +- src/xprop.c| 56 src/xprop.h| 31 ++- 5 files changed, 69 insertions(+), 66 deletions(-) diff --git a/src/desktops.c b/src/desktops.c index effd0823..ea36f13e 100644 --- a/src/desktops.c +++ b/src/desktops.c @@ -50,6 +50,7 @@ #include "slide.h" #include "timers.h" #include "tooltips.h" +#include "xprop.h" #include "xwin.h" #define DESK_EVENT_MASK1 \ diff --git a/src/hints.c b/src/hints.c index d350b5e8..3315c5cc 100644 --- a/src/hints.c +++ b/src/hints.c @@ -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 diff --git a/src/hints.h b/src/hints.h index 79e6f8c4..0c5b5b24 100644 --- a/src/hints.h +++ b/src/hints.h @@ -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_DATAatoms_misc[6] -#define E16_ATOM_INTERNAL_DESK_DATAatoms_misc[7] -#define E16_ATOM_WIN_DATA atoms_misc[8] -#define E16_ATOM_WIN_BORDERatoms_misc[9] - /* ewmh.c */ voidEWMH_Init(EX_Window win_wm_check); voidEWMH_SetDesktopCount(void); diff --git a/src/xprop.c b/src/xprop.c index cc754ac6..6fdb86b0 100644 --- a/src/xprop.c +++ b/src/xprop.c @@ -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, 0x7fff, False, - EX_ATOM_UTF8_STRING, _ret, + E_XA_UTF8_STRING, _ret, _ret, _ret, _after, _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[] = { -/*
[EGIT] [e16/e16] master 02/09: libhack: Add XGetWindowProperty interception
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=d3bb5e171f6331b1cd9163406f453ff54fdf910b commit d3bb5e171f6331b1cd9163406f453ff54fdf910b Author: Kim Woelders Date: Thu Aug 19 10:15:38 2021 +0200 libhack: Add XGetWindowProperty interception --- lib/e16_hack.c | 36 1 file changed, 36 insertions(+) diff --git a/lib/e16_hack.c b/lib/e16_hack.c index 7c63736c..4809d41e 100644 --- a/lib/e16_hack.c +++ b/lib/e16_hack.c @@ -173,3 +173,39 @@ XSendEvent(Display * display, Window window, Bool propagate, return (*func) (display, window, propagate, event_mask, event_send); } + +/* + * XGetWindowProperty interception + */ + +typedef int (GWPF) (Display * display, Window w, + Atom property, + long long_offset, long long_length, + Bool delete, Atom req_type, + Atom * actual_type_return, + int *actual_format_return, + unsigned long *nitems_return, + unsigned long *bytes_after_return, + unsigned char **prop_return); + +__EXPORT__ int +XGetWindowProperty(Display * display, Window w, Atom property, + long long_offset, long long_length, Bool delete, + Atom req_type, Atom * actual_type_return, + int *actual_format_return, + unsigned long *nitems_return, + unsigned long *bytes_after_return, + unsigned char **prop_return) +{ + static GWPF*func = NULL; + + if (!func) + func = (GWPF *) GetFunc("XGetWindowProperty"); + + if (w == DefaultRootWindow(display)) + w = MyRoot(display); + + return func(display, w, property, long_offset, long_length, delete, + req_type, actual_type_return, actual_format_return, + nitems_return, bytes_after_return, prop_return); +} --
[EGIT] [e16/e16] master 05/09: xprop.c: Do some sanity checks using static asserts if possible
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=206839b33b4c9760c4336adf62ce9924be042de5 commit 206839b33b4c9760c4336adf62ce9924be042de5 Author: Kim Woelders Date: Sat Aug 21 16:57:40 2021 +0200 xprop.c: Do some sanity checks using static asserts if possible --- src/xprop.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/xprop.c b/src/xprop.c index 6fdb86b0..801ecf28 100644 --- a/src/xprop.c +++ b/src/xprop.c @@ -34,13 +34,15 @@ #define EX_PROP_LIST_ADD 1 #define EX_PROP_LIST_TOGGLE2 -#define DEBUG_CHECK 0 -#if DEBUG_CHECK -#include -#endif #include "xprop.h" #include "xwin.h" +#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201112L +#define E_STATIC_ASSERT(...) _Static_assert(__VA_ARGS__) +#else +#define E_STATIC_ASSERT(...) +#endif + #define _ex_disp disp /* @@ -593,12 +595,11 @@ static const char *const atoms_misc_names[] = { }; EX_Atom atoms_misc[E_ARRAY_SIZE(atoms_misc_names)]; +E_STATIC_ASSERT(CHECK_COUNT_MISC == E_ARRAY_SIZE(atoms_misc)); + 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); } @@ -622,12 +623,11 @@ static const char *const atoms_icccm_names[] = { }; EX_Atom atoms_icccm[E_ARRAY_SIZE(atoms_icccm_names)]; +E_STATIC_ASSERT(CHECK_COUNT_ICCCM == E_ARRAY_SIZE(atoms_icccm)); + void ex_icccm_init(void) { -#if DEBUG_CHECK - assert(CHECK_COUNT_ICCCM == E_ARRAY_SIZE(atoms_icccm)); -#endif ex_atoms_get(atoms_icccm_names, E_ARRAY_SIZE(atoms_icccm), atoms_icccm); } @@ -840,12 +840,11 @@ static const char *const atoms_netwm_names[] = { }; EX_Atom atoms_netwm[E_ARRAY_SIZE(atoms_netwm_names)]; +E_STATIC_ASSERT(CHECK_COUNT_NETWM == E_ARRAY_SIZE(atoms_netwm)); + void ex_netwm_init(void) { -#if DEBUG_CHECK - assert(CHECK_COUNT_NETWM == E_ARRAY_SIZE(atoms_netwm)); -#endif ex_atoms_get(atoms_netwm_names, E_ARRAY_SIZE(atoms_netwm), atoms_netwm); } --
[EGIT] [e16/e16] master 08/09: Support _NET_WM_STATE_FOCUSED
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=0d6bdb4272fb5be6abb54e7b45d6303ddecc9a85 commit 0d6bdb4272fb5be6abb54e7b45d6303ddecc9a85 Author: Kim Woelders Date: Thu Aug 19 08:28:41 2021 +0200 Support _NET_WM_STATE_FOCUSED GTK apps apparently use this. --- src/ewmh.c | 2 ++ src/focus.c | 7 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ewmh.c b/src/ewmh.c index 37aeb335..01a2dcef 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -131,6 +131,7 @@ EWMH_Init(EX_Window win_wm_check) atom_list[atom_count++] = EX_ATOM_NET_WM_STATE_ABOVE; atom_list[atom_count++] = EX_ATOM_NET_WM_STATE_BELOW; atom_list[atom_count++] = EX_ATOM_NET_WM_STATE_DEMANDS_ATTENTION; + atom_list[atom_count++] = EX_ATOM_NET_WM_STATE_FOCUSED; atom_list[atom_count++] = EX_ATOM_NET_WM_ALLOWED_ACTIONS; atom_list[atom_count++] = EX_ATOM_NET_WM_ACTION_MOVE; @@ -383,6 +384,7 @@ EWMH_SetWindowState(const EWin * ewin) ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_ABOVE, EoGetLayer(ewin) >= 6); ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_BELOW, EoGetLayer(ewin) <= 2); ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_DEMANDS_ATTENTION, ewin->state.attention); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_FOCUSED, ewin->state.active); if (ewin->ewmh.current_state == atom_mask) return; diff --git a/src/focus.c b/src/focus.c index d270af10..7dff4c03 100644 --- a/src/focus.c +++ b/src/focus.c @@ -329,10 +329,9 @@ FocusEwinSetActive(EWin * ewin, int active) EwinUpdateOpacity(ewin); if (active && ewin->state.attention) - { - ewin->state.attention = 0; - HintsSetWindowState(ewin); - } + ewin->state.attention = 0; + + HintsSetWindowState(ewin); } static void --
[EGIT] [e16/e16] master 07/09: Add _NET_WM_STATE_FOCUSED to the EWHM atoms
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=8f9a57fb10f684b85807bdfe71ee37e00fb6a914 commit 8f9a57fb10f684b85807bdfe71ee37e00fb6a914 Author: Kim Woelders Date: Thu Aug 19 08:28:41 2021 +0200 Add _NET_WM_STATE_FOCUSED to the EWHM atoms --- src/xprop.c | 1 + src/xprop.h | 61 +++-- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/xprop.c b/src/xprop.c index 801ecf28..e39539e4 100644 --- a/src/xprop.c +++ b/src/xprop.c @@ -786,6 +786,7 @@ static const char *const atoms_netwm_names[] = { "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_BELOW", "_NET_WM_STATE_DEMANDS_ATTENTION", + "_NET_WM_STATE_FOCUSED", "_NET_WM_ALLOWED_ACTIONS", "_NET_WM_ACTION_MOVE", diff --git a/src/xprop.h b/src/xprop.h index 8fbd5d63..0fd94a88 100644 --- a/src/xprop.h +++ b/src/xprop.h @@ -190,30 +190,31 @@ extern EX_Atom atoms_netwm[]; #define EX_ATOM_NET_WM_STATE_ABOVE atoms_netwm[37] #define EX_ATOM_NET_WM_STATE_BELOW atoms_netwm[38] #define EX_ATOM_NET_WM_STATE_DEMANDS_ATTENTION atoms_netwm[39] +#define EX_ATOM_NET_WM_STATE_FOCUSED atoms_netwm[40] -#define EX_ATOM_NET_WM_ALLOWED_ACTIONS atoms_netwm[40] -#define EX_ATOM_NET_WM_ACTION_MOVE atoms_netwm[41] -#define EX_ATOM_NET_WM_ACTION_RESIZE atoms_netwm[42] -#define EX_ATOM_NET_WM_ACTION_MINIMIZE atoms_netwm[43] -#define EX_ATOM_NET_WM_ACTION_SHADEatoms_netwm[44] -#define EX_ATOM_NET_WM_ACTION_STICKatoms_netwm[45] -#define EX_ATOM_NET_WM_ACTION_MAXIMIZE_HORZatoms_netwm[46] -#define EX_ATOM_NET_WM_ACTION_MAXIMIZE_VERTatoms_netwm[47] -#define EX_ATOM_NET_WM_ACTION_FULLSCREEN atoms_netwm[48] -#define EX_ATOM_NET_WM_ACTION_CHANGE_DESKTOP atoms_netwm[49] -#define EX_ATOM_NET_WM_ACTION_CLOSEatoms_netwm[50] -#define EX_ATOM_NET_WM_ACTION_ABOVEatoms_netwm[51] -#define EX_ATOM_NET_WM_ACTION_BELOWatoms_netwm[52] +#define EX_ATOM_NET_WM_ALLOWED_ACTIONS atoms_netwm[41] +#define EX_ATOM_NET_WM_ACTION_MOVE atoms_netwm[42] +#define EX_ATOM_NET_WM_ACTION_RESIZE atoms_netwm[43] +#define EX_ATOM_NET_WM_ACTION_MINIMIZE atoms_netwm[44] +#define EX_ATOM_NET_WM_ACTION_SHADEatoms_netwm[45] +#define EX_ATOM_NET_WM_ACTION_STICKatoms_netwm[46] +#define EX_ATOM_NET_WM_ACTION_MAXIMIZE_HORZatoms_netwm[47] +#define EX_ATOM_NET_WM_ACTION_MAXIMIZE_VERTatoms_netwm[48] +#define EX_ATOM_NET_WM_ACTION_FULLSCREEN atoms_netwm[49] +#define EX_ATOM_NET_WM_ACTION_CHANGE_DESKTOP atoms_netwm[50] +#define EX_ATOM_NET_WM_ACTION_CLOSEatoms_netwm[51] +#define EX_ATOM_NET_WM_ACTION_ABOVEatoms_netwm[52] +#define EX_ATOM_NET_WM_ACTION_BELOWatoms_netwm[53] -#define EX_ATOM_NET_WM_STRUT atoms_netwm[53] -#define EX_ATOM_NET_WM_STRUT_PARTIAL atoms_netwm[54] +#define EX_ATOM_NET_WM_STRUT atoms_netwm[54] +#define EX_ATOM_NET_WM_STRUT_PARTIAL atoms_netwm[55] -#define EX_ATOM_NET_FRAME_EXTENTS atoms_netwm[55] +#define EX_ATOM_NET_FRAME_EXTENTS atoms_netwm[56] -#define EX_ATOM_NET_WM_ICONatoms_netwm[56] +#define EX_ATOM_NET_WM_ICONatoms_netwm[57] -#define EX_ATOM_NET_WM_USER_TIME atoms_netwm[57] -#define EX_ATOM_NET_WM_USER_TIME_WINDOWatoms_netwm[58] +#define EX_ATOM_NET_WM_USER_TIME atoms_netwm[58] +#define EX_ATOM_NET_WM_USER_TIME_WINDOWatoms_netwm[59] #if 0 /* Not used */ #define EX_ATOM_NET_WM_ICON_GEOMETRY atoms_netwm[0] @@ -222,27 +223,27 @@ extern EX_Atom atoms_netwm[]; #define EX_ATOM_NET_WM_PINGatoms_netwm[0] #endif -#define EX_ATOM_NET_WM_SYNC_REQUESTatoms_netwm[59] -#define EX_ATOM_NET_WM_SYNC_REQUEST_COUNTERatoms_netwm[60] +#define EX_ATOM_NET_WM_SYNC_REQUESTatoms_netwm[60] +#define EX_ATOM_NET_WM_SYNC_REQUEST_COUNTERatoms_netwm[61] -#define EX_ATOM_NET_WM_WINDOW_OPACITY atoms_netwm[61] +#define EX_ATOM_NET_WM_WINDOW_OPACITY atoms_netwm[62] /* Misc window ops */ -#define EX_ATOM_NET_CLOSE_WINDOW atoms_netwm[62] -#define EX_ATOM_NET_MOVERESIZE_WINDOW atoms_netwm[63] -#define EX_ATOM_NET_WM_MOVERESIZE atoms_netwm[64] -#define EX_ATOM_NET_RESTACK_WINDOW atoms_netwm[65] +#define EX_ATOM_NET_CLOSE_WINDOW atoms_netwm[63] +#define EX_ATOM_NET_MOVERESIZE_WINDOW atoms_netwm[64] +#define EX_ATOM_NET_WM_MOVERESIZE atoms_netwm[65] +#define EX_ATOM_NET_RESTACK_WINDOW atoms_netwm[66] #if 0 /* Not yet implemented */ #define EX_ATOM_NET_REQUEST_FRAME_EXTENTS atoms_netwm[0] #endif /* Startup
[EGIT] [e16/e16] master 01/09: libhack: Cosmetics
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=a2463cfdf3195cbdbfc7655bed56e23e1feb6ac6 commit a2463cfdf3195cbdbfc7655bed56e23e1feb6ac6 Author: Kim Woelders Date: Thu Aug 19 10:18:49 2021 +0200 libhack: Cosmetics --- lib/e16_hack.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/e16_hack.c b/lib/e16_hack.c index b7cc5523..7c63736c 100644 --- a/lib/e16_hack.c +++ b/lib/e16_hack.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2005-2007 Carsten Haitzler - * Copyright (C) 2006-2020 Kim Woelders + * Copyright (C) 2006-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 @@ -71,6 +71,10 @@ GetFunc(const char *name) return func; } +/* + * XCreateWindow interception + */ + typedef Window(CWF) (Display * _display, Window _parent, int _x, int _y, unsigned int _width, unsigned int _height, @@ -79,7 +83,6 @@ typedef Window(CWF) (Display * _display, Window _parent, int _x, unsigned long _valuemask, XSetWindowAttributes * _attributes); -/* XCreateWindow intercept hack */ __EXPORT__ Window XCreateWindow(Display * display, Window parent, int x, int y, unsigned int width, unsigned int height, @@ -99,6 +102,10 @@ XCreateWindow(Display * display, Window parent, int x, int y, clss, visual, valuemask, attributes); } +/* + * XCreateSimpleWindow interception + */ + typedef Window(CSWF) (Display * _display, Window _parent, int _x, int _y, unsigned int _width, unsigned int _height, @@ -106,7 +113,6 @@ typedef Window(CSWF) (Display * _display, Window _parent, int _x, unsigned long _border, unsigned long _background); -/* XCreateSimpleWindow intercept hack */ __EXPORT__ Window XCreateSimpleWindow(Display * display, Window parent, int x, int y, unsigned int width, unsigned int height, @@ -125,10 +131,13 @@ XCreateSimpleWindow(Display * display, Window parent, int x, int y, border_width, border, background); } +/* + * XReparentWindow interception + */ + typedef int (RWF) (Display * _display, Window _window, Window _parent, int x, int y); -/* XReparentWindow intercept hack */ __EXPORT__ int XReparentWindow(Display * display, Window window, Window parent, int x, int y) { @@ -143,10 +152,13 @@ XReparentWindow(Display * display, Window window, Window parent, int x, int y) return (*func) (display, window, parent, x, y); } +/* + * XSendEvent interception + */ + typedef int (SEF) (Display * display, Window window, Bool propagate, long event_mask, XEvent * event_send); -/* XSendEvent intercept hack */ __EXPORT__ int XSendEvent(Display * display, Window window, Bool propagate, long event_mask, XEvent * event_send) --
[EGIT] [e16/e16] master 03/09: session.c: Remove unused headers
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=6c173cc65e2148ad543c2f6386f9a841402b6b32 commit 6c173cc65e2148ad543c2f6386f9a841402b6b32 Author: Kim Woelders Date: Sat Aug 21 14:04:06 2021 +0200 session.c: Remove unused headers --- src/session.c | 4 1 file changed, 4 deletions(-) diff --git a/src/session.c b/src/session.c index 3e911433..e6844451 100644 --- a/src/session.c +++ b/src/session.c @@ -26,14 +26,10 @@ #include "emodule.h" #include "events.h" #include "ewins.h" -#include "hints.h" #include "session.h" #include "settings.h" #include "snaps.h" #include "user.h" -#if 0 /* Unused */ -#include "xprop.h" -#endif #include "xwin.h" #ifdef USE_EXT_INIT_WIN --
[EGIT] [e16/e16] master 06/09: Only update _NET_WM_STATE and _NET_WM_ALLOWED_ACTIONS when changed
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=2c01d2e1a4ed0b5739c45fde7d96bd5681dbc59b commit 2c01d2e1a4ed0b5739c45fde7d96bd5681dbc59b Author: Kim Woelders Date: Thu Aug 19 14:21:16 2021 +0200 Only update _NET_WM_STATE and _NET_WM_ALLOWED_ACTIONS when changed Avoids some hint noise. --- src/ewins.h | 2 + src/ewmh.c | 145 2 files changed, 60 insertions(+), 87 deletions(-) diff --git a/src/ewins.h b/src/ewins.h index e96258a4..8ec49d61 100644 --- a/src/ewins.h +++ b/src/ewins.h @@ -232,6 +232,8 @@ struct _ewin { unsignednormal:1; } b; } type; + unsigned intcurrent_state; + unsigned intcurrent_actions; } ewmh; struct { signed char gravity; diff --git a/src/ewmh.c b/src/ewmh.c index f407d283..37aeb335 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -34,6 +34,15 @@ #include "hints.h" #include "xprop.h" +#define ATOM_ADD_IF(atom, cond) \ +do { \ +if (cond) { \ +atom_list[atom_count++] = atom; \ + atom_mask |= 1U << atom_bit; \ +} \ +atom_bit++; \ +} while(0) + /* * _NET_WM_MOVERESIZE client message actions */ @@ -62,37 +71,6 @@ #define OPSRC(src) (((src) == _NET_WM_SOURCE_USER) ? _NET_WM_SOURCE_USER : _NET_WM_SOURCE_APP) -/* - * Set/clear Atom in list - */ -static void -atom_list_set(EX_Atom * atoms, int size, int *count, EX_Atom atom, int set) -{ - int i, n, in_list; - - n = *count; - - /* Check if atom is in list or not (+get index) */ - for (i = 0; i < n; i++) - if (atoms[i] == atom) -break; - in_list = i < n; - - if (set && !in_list) - { - /* Add it (if space left) */ - if (n < size) - atoms[n++] = atom; - *count = n; - } - else if (!set && in_list) - { - /* Remove it */ - atoms[i] = atoms[--n]; - *count = n; - } -} - /* * Initialize EWMH stuff */ @@ -385,37 +363,30 @@ EWMH_SetWindowDesktop(const EWin * ewin) void EWMH_SetWindowState(const EWin * ewin) { - EX_Atom atom_list[64]; - int len = E_ARRAY_SIZE(atom_list); + EX_Atom atom_list[16]; int atom_count; + unsigned intatom_mask, atom_bit; atom_count = 0; - atom_list_set(atom_list, len, _count, EX_ATOM_NET_WM_STATE_MODAL, -ewin->state.modal); - atom_list_set(atom_list, len, _count, EX_ATOM_NET_WM_STATE_STICKY, -EoIsSticky(ewin)); - atom_list_set(atom_list, len, _count, EX_ATOM_NET_WM_STATE_SHADED, -ewin->state.shaded); - atom_list_set(atom_list, len, _count, -EX_ATOM_NET_WM_STATE_SKIP_TASKBAR, ewin->props.skip_ext_task); - atom_list_set(atom_list, len, _count, EX_ATOM_NET_WM_STATE_HIDDEN, -ewin->state.iconified || ewin->state.shaded); - atom_list_set(atom_list, len, _count, -EX_ATOM_NET_WM_STATE_MAXIMIZED_VERT, -ewin->state.maximized_vert); - atom_list_set(atom_list, len, _count, -EX_ATOM_NET_WM_STATE_MAXIMIZED_HORZ, -ewin->state.maximized_horz); - atom_list_set(atom_list, len, _count, -EX_ATOM_NET_WM_STATE_FULLSCREEN, ewin->state.fullscreen); - atom_list_set(atom_list, len, _count, -EX_ATOM_NET_WM_STATE_SKIP_PAGER, ewin->props.skip_ext_pager); - atom_list_set(atom_list, len, _count, EX_ATOM_NET_WM_STATE_ABOVE, -EoGetLayer(ewin) >= 6); - atom_list_set(atom_list, len, _count, EX_ATOM_NET_WM_STATE_BELOW, -EoGetLayer(ewin) <= 2); - atom_list_set(atom_list, len, _count, -EX_ATOM_NET_WM_STATE_DEMANDS_ATTENTION, ewin->state.attention); + atom_mask = atom_bit = 0; + + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_MODAL, ewin->state.modal); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_STICKY, EoIsSticky(ewin)); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_SHADED, ewin->state.shaded); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_SKIP_TASKBAR, ewin->props.skip_ext_task); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_HIDDEN, + ewin->state.iconified || ewin->state.shaded); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_MAXIMIZED_VERT, ewin->state.maximized_vert); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_MAXIMIZED_HORZ, ewin->state.maximized_horz); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_FULLSCREEN, ewin->state.fullscreen); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_SKIP_PAGER, ewin->props.skip_ext_pager); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_ABOVE, EoGetLayer(ewin) >= 6); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_BELOW, EoGetLayer(ewin) <= 2); + ATOM_ADD_IF(EX_ATOM_NET_WM_STATE_DEMANDS_ATTENTION, ewin->state.attention); + + if (ewin->ewmh.current_state == atom_mask) + return; + ((EWin *) ewin)->ewmh.current_state = atom_mask; ex_window_prop_atom_set(EwinGetClientXwin(ewin),
[EGIT] [e16/e16] master 09/09: COMPLIANCE: Update
kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=721656447c3ab4c4159cccf8622d8cc891a7f5ec commit 721656447c3ab4c4159cccf8622d8cc891a7f5ec Author: Kim Woelders Date: Sat Aug 21 13:44:57 2021 +0200 COMPLIANCE: Update --- COMPLIANCE | 13 + 1 file changed, 13 insertions(+) diff --git a/COMPLIANCE b/COMPLIANCE index 5c3a3a8e..729c94a6 100644 --- a/COMPLIANCE +++ b/COMPLIANCE @@ -69,6 +69,14 @@ Application Window Properties [/] _NET_WM_WINDOW_TYPE_SPLASH [/] _NET_WM_WINDOW_TYPE_DIALOG [/] _NET_WM_WINDOW_TYPE_NORMAL +New window types to be used on override-redirect windows + +[ ] _NET_WM_WINDOW_TYPE_DROPDOWN_MENU +[ ] _NET_WM_WINDOW_TYPE_POPUP_MENU +[ ] _NET_WM_WINDOW_TYPE_TOOLTIP +[ ] _NET_WM_WINDOW_TYPE_NOTIFICATION +[ ] _NET_WM_WINDOW_TYPE_COMBO +[ ] _NET_WM_WINDOW_TYPE_DND [/] _NET_WM_STATE [ ] _NET_WM_STATE_MODAL [+] _NET_WM_STATE_STICKY @@ -82,6 +90,7 @@ Application Window Properties [+] _NET_WM_STATE_ABOVE [+] _NET_WM_STATE_BELOW [+] _NET_WM_STATE_DEMANDS_ATTENTION +[+] _NET_WM_STATE_FOCUSED [+] _NET_WM_ALLOWED_ACTIONS [+] _NET_WM_ACTION_MOVE [+] _NET_WM_ACTION_RESIZE @@ -105,12 +114,15 @@ Application Window Properties [/] _NET_WM_USER_TIME [/] _NET_WM_USER_TIME_WINDOW [+] _NET_FRAME_EXTENTS +[ ] _NET_WM_OPAQUE_REGION +[ ] _NET_WM_BYPASS_COMPOSITOR Window Manager Protocols [ ] _NET_WM_PING [+] _NET_WM_SYNC_REQUEST [+] _NET_WM_SYNC_REQUEST_COUNTER +[ ] _NET_WM_FULLSCREEN_MONITORS Other Properties @@ -119,6 +131,7 @@ Other Properties Compositing Managers [+] _NET_WM_CM_Sn +[ ] WM_TRANSIENT_FOR for override-redirect windows GNOME Compliance (_WIN_... hints) --
[EGIT] [legacy/imlib2] master 01/01: imlib2_view: Fix issue with new default scaling
kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=3a4d6d4590f4543267273136999bfb29cb551abe commit 3a4d6d4590f4543267273136999bfb29cb551abe Author: Kim Woelders Date: Sat Aug 21 11:56:43 2021 +0200 imlib2_view: Fix issue with new default scaling Need to distinguish between scaling option value and applied scaling when viewing multiple images. --- src/bin/imlib2_view.c | 37 + 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c index 51319ad..333faa7 100644 --- a/src/bin/imlib2_view.c +++ b/src/bin/imlib2_view.c @@ -18,13 +18,14 @@ static Pixmap pm = 0; static int depth; static int image_width = 0, image_height = 0; static int window_width = 0, window_height = 0; -static char scale = 0; -static double scale_x = 1.; -static double scale_y = 1.; static Imlib_Image bg_im = NULL; -static char progress_granularity = 10; -static char progress_print = 0; -static int progress_delay = 0; + +static char opt_scale = 0; +static double opt_scale_x = 1.; +static double opt_scale_y = 1.; +static char opt_progress_granularity = 10; +static char opt_progress_print = 0; +static int opt_progress_delay = 0; #define Dprintf if (debug) printf #define Vprintf if (verbose) printf @@ -55,9 +56,10 @@ static int progress(Imlib_Image im, char percent, int update_x, int update_y, int update_w, int update_h) { + static double scale_x = 0., scale_y = 0.; int up_wx, up_wy, up_ww, up_wh; - if (progress_print) + if (opt_progress_print) printf("%s: %3d%% %4d,%4d %4dx%4d\n", __func__, percent, update_x, update_y, update_w, update_h); @@ -70,6 +72,9 @@ progress(Imlib_Image im, char percent, int update_x, int update_y, { int x, y, onoff; +scale_x = opt_scale_x; +scale_y = opt_scale_y; + window_width = DisplayWidth(disp, DefaultScreen(disp)); window_height = DisplayHeight(disp, DefaultScreen(disp)); window_width -= 32; /* Allow for decorations */ @@ -81,7 +86,7 @@ progress(Imlib_Image im, char percent, int update_x, int update_y, image_height = imlib_image_get_height(); Dprintf("Image WxH=%dx%d\n", image_width, image_height); -if (!scale && +if (!opt_scale && (image_width > window_width || image_height > window_height)) { scale_x = scale_y = 1.; @@ -163,8 +168,8 @@ progress(Imlib_Image im, char percent, int update_x, int update_y, XClearArea(disp, win, up_wx, up_wy, up_ww, up_wh, False); XFlush(disp); - if (progress_delay > 0) - usleep(progress_delay); + if (opt_progress_delay > 0) + usleep(opt_progress_delay); return 1; } @@ -188,17 +193,17 @@ main(int argc, char **argv) debug += 1; break; case 'g': - progress_granularity = atoi(optarg); + opt_progress_granularity = atoi(optarg); break; case 'l': - progress_delay = 1000 * atoi(optarg); + opt_progress_delay = 1000 * atoi(optarg); break; case 'p': - progress_print = 1; + opt_progress_print = 1; break; case 's':/* Scale (window size wrt. image size) */ - scale = 1; - scale_x = scale_y = atof(optarg); + opt_scale = 1; + opt_scale_x = opt_scale_y = atof(optarg); break; case 'v': verbose += 1; @@ -238,7 +243,7 @@ main(int argc, char **argv) imlib_context_set_visual(DefaultVisual(disp, DefaultScreen(disp))); imlib_context_set_colormap(DefaultColormap(disp, DefaultScreen(disp))); imlib_context_set_progress_function(progress); - imlib_context_set_progress_granularity(progress_granularity); + imlib_context_set_progress_granularity(opt_progress_granularity); imlib_context_set_drawable(win); no = -1; --
[EGIT] [legacy/imlib2] master 04/04: imlib2_view: Add some debug
kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=ecc7a342ff11c6d5e559d712de6a319023a8ae95 commit ecc7a342ff11c6d5e559d712de6a319023a8ae95 Author: Kim Woelders Date: Fri Aug 20 06:37:38 2021 +0200 imlib2_view: Add some debug --- src/bin/imlib2_view.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c index c1228d7..51319ad 100644 --- a/src/bin/imlib2_view.c +++ b/src/bin/imlib2_view.c @@ -12,6 +12,7 @@ Display*disp; +static int debug = 0; static Window win; static Pixmap pm = 0; static int depth; @@ -25,6 +26,9 @@ static char progress_granularity = 10; static char progress_print = 0; static int progress_delay = 0; +#define Dprintf if (debug) printf +#define Vprintf if (verbose) printf + #define MAX_DIM32767 #define SCALE_X(x) (int)(scale_x * (x) + .5) @@ -34,6 +38,7 @@ static int progress_delay = 0; "Usage:\n" \ " imlib2_view [OPTIONS] FILE...\n" \ "OPTIONS:\n" \ + " -d : Enable debug\n" \ " -g N: Set progress granularity to N%% (default 10(%%))\n" \ " -l N: Introduce N ms delay in progress callback (default 0)\n" \ " -p : Print info in progress callback (default no)\n" \ @@ -69,10 +74,12 @@ progress(Imlib_Image im, char percent, int update_x, int update_y, window_height = DisplayHeight(disp, DefaultScreen(disp)); window_width -= 32; /* Allow for decorations */ window_height -= 32; +Dprintf("Screen WxH=%dx%d\n", window_width, window_height); imlib_context_set_image(im); image_width = imlib_image_get_width(); image_height = imlib_image_get_height(); +Dprintf("Image WxH=%dx%d\n", image_width, image_height); if (!scale && (image_width > window_width || image_height > window_height)) @@ -83,6 +90,7 @@ progress(Imlib_Image im, char percent, int update_x, int update_y, { scale_x *= .5; scale_y = scale_x; + Dprintf(" scale WxH=%.3fx%.3f\n", scale_x, scale_y); } } @@ -98,6 +106,7 @@ progress(Imlib_Image im, char percent, int update_x, int update_y, window_height = MAX_DIM; scale_y = (double)MAX_DIM / image_height; } +Dprintf("Window WxH=%dx%d\n", window_width, window_height); if (pm) XFreePixmap(disp, pm); @@ -171,10 +180,13 @@ main(int argc, char **argv) verbose = 0; - while ((opt = getopt(argc, argv, "g:l:ps:v")) != -1) + while ((opt = getopt(argc, argv, "dg:l:ps:v")) != -1) { switch (opt) { + case 'd': + debug += 1; + break; case 'g': progress_granularity = atoi(optarg); break; @@ -239,8 +251,7 @@ main(int argc, char **argv) exit(0); } file = argv[no]; -if (verbose) - printf("Show %d: '%s'\n", no, file); +Vprintf("Show %d: '%s'\n", no, file); image_width = 0; im = imlib_load_image(file); } @@ -383,8 +394,7 @@ main(int argc, char **argv) continue; } file = argv[no2]; - if (verbose) - printf("Show %d: '%s'\n", no2, file); + Vprintf("Show %d: '%s'\n", no2, file); if (no2 == no) break; image_width = 0; --
[EGIT] [legacy/imlib2] master 01/04: imlib2_view: Move property stuff to separate file
kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=0497d2bb0cc4ee6552ae65b58e113f76af8d24d7 commit 0497d2bb0cc4ee6552ae65b58e113f76af8d24d7 Author: Kim Woelders Date: Sun Mar 11 08:51:54 2018 +0100 imlib2_view: Move property stuff to separate file May reuse it elsewhere. --- src/bin/Makefile.am | 2 +- src/bin/imlib2_view.c | 11 +++ src/bin/props.c | 25 + src/bin/props.h | 16 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 4833794..3bbb8c1 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -36,7 +36,7 @@ imlib2_poly_LDADD = $(top_builddir)/src/lib/libImlib2.la -lX11 imlib2_colorspace_SOURCES = imlib2_colorspace.c imlib2_colorspace_LDADD = $(top_builddir)/src/lib/libImlib2.la -lX11 -imlib2_view_SOURCES = imlib2_view.c +imlib2_view_SOURCES = imlib2_view.c props.c props.h imlib2_view_LDADD = $(top_builddir)/src/lib/libImlib2.la -lX11 imlib2_grab_SOURCES = imlib2_grab.c diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c index 685efde..ea0ba8e 100644 --- a/src/bin/imlib2_view.c +++ b/src/bin/imlib2_view.c @@ -8,6 +8,7 @@ #include #include "Imlib2.h" +#include "props.h" Display*disp; Window win; @@ -22,9 +23,6 @@ static char progress_granularity = 10; static char progress_print = 0; static int progress_delay = 0; -static Atom ATOM_WM_DELETE_WINDOW = None; -static Atom ATOM_WM_PROTOCOLS = None; - #define MAX_DIM32767 #define SCALE_X(x) (int)(scale_x * (x) + .5) @@ -200,9 +198,7 @@ main(int argc, char **argv) XSelectInput(disp, win, KeyPressMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | PointerMotionMask); - ATOM_WM_PROTOCOLS = XInternAtom(disp, "WM_PROTOCOLS", False); - ATOM_WM_DELETE_WINDOW = XInternAtom(disp, "WM_DELETE_WINDOW", False); - XSetWMProtocols(disp, win, _WM_DELETE_WINDOW, 1); + props_win_set_proto_quit(win); imlib_context_set_display(disp); imlib_context_set_visual(DefaultVisual(disp, DefaultScreen(disp))); @@ -250,8 +246,7 @@ main(int argc, char **argv) break; case ClientMessage: - if (ev.xclient.message_type == ATOM_WM_PROTOCOLS && - (Atom) ev.xclient.data.l[0] == ATOM_WM_DELETE_WINDOW) + if (props_clientmsg_check_quit()) goto quit; break; case KeyPress: diff --git a/src/bin/props.c b/src/bin/props.c new file mode 100644 index 000..e5e8681 --- /dev/null +++ b/src/bin/props.c @@ -0,0 +1,25 @@ +/* + * Property handling + */ +#include +#include + +#include "props.h" + +static Atom ATOM_WM_DELETE_WINDOW = None; +static Atom ATOM_WM_PROTOCOLS = None; + +void +props_win_set_proto_quit(Window win) +{ + ATOM_WM_PROTOCOLS = XInternAtom(disp, "WM_PROTOCOLS", False); + ATOM_WM_DELETE_WINDOW = XInternAtom(disp, "WM_DELETE_WINDOW", False); + XSetWMProtocols(disp, win, _WM_DELETE_WINDOW, 1); +} + +int +props_clientmsg_check_quit(const XClientMessageEvent * ev) +{ + return ev->message_type == ATOM_WM_PROTOCOLS && + (Atom) ev->data.l[0] == ATOM_WM_DELETE_WINDOW; +} diff --git a/src/bin/props.h b/src/bin/props.h new file mode 100644 index 000..aeecbf1 --- /dev/null +++ b/src/bin/props.h @@ -0,0 +1,16 @@ +/* + * Property handling + */ +#ifndef PROPS_H +#define PROPS_H + +#include +#include + +extern Display *disp; + +voidprops_win_set_proto_quit(Window win); + +int props_clientmsg_check_quit(const XClientMessageEvent * ev); + +#endif /* PROPS_H */ --
[EGIT] [legacy/imlib2] master 02/04: imlib2_view: Cleanups
kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=34afe297cd144b123c057fd80a3150326b7ce27b commit 34afe297cd144b123c057fd80a3150326b7ce27b Author: Kim Woelders Date: Fri Aug 20 06:39:11 2021 +0200 imlib2_view: Cleanups --- src/bin/imlib2_view.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c index ea0ba8e..9cf5b09 100644 --- a/src/bin/imlib2_view.c +++ b/src/bin/imlib2_view.c @@ -11,14 +11,15 @@ #include "props.h" Display*disp; -Window win; -Pixmap pm = 0; -int depth; -int image_width = 0, image_height = 0; -int window_width = 0, window_height = 0; -double scale_x = 1.; -double scale_y = 1.; -Imlib_Image bg_im = NULL; + +static Window win; +static Pixmap pm = 0; +static int depth; +static int image_width = 0, image_height = 0; +static int window_width = 0, window_height = 0; +static double scale_x = 1.; +static double scale_y = 1.; +static Imlib_Image bg_im = NULL; static char progress_granularity = 10; static char progress_print = 0; static int progress_delay = 0; --
[EGIT] [legacy/imlib2] master 03/04: imlib2_view: By default scale large images to fit on screen
kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=a748550fa456106ec7f49bfec8a915b18dabd43c commit a748550fa456106ec7f49bfec8a915b18dabd43c Author: Kim Woelders Date: Fri Aug 20 05:52:36 2021 +0200 imlib2_view: By default scale large images to fit on screen --- src/bin/imlib2_view.c | 21 + 1 file changed, 21 insertions(+) diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c index 9cf5b09..c1228d7 100644 --- a/src/bin/imlib2_view.c +++ b/src/bin/imlib2_view.c @@ -17,6 +17,7 @@ static Pixmap pm = 0; static int depth; static int image_width = 0, image_height = 0; static int window_width = 0, window_height = 0; +static char scale = 0; static double scale_x = 1.; static double scale_y = 1.; static Imlib_Image bg_im = NULL; @@ -64,9 +65,27 @@ progress(Imlib_Image im, char percent, int update_x, int update_y, { int x, y, onoff; +window_width = DisplayWidth(disp, DefaultScreen(disp)); +window_height = DisplayHeight(disp, DefaultScreen(disp)); +window_width -= 32; /* Allow for decorations */ +window_height -= 32; + imlib_context_set_image(im); image_width = imlib_image_get_width(); image_height = imlib_image_get_height(); + +if (!scale && +(image_width > window_width || image_height > window_height)) + { + scale_x = scale_y = 1.; + while (window_width < SCALE_X(image_width) || +window_height < SCALE_Y(image_height)) + { + scale_x *= .5; + scale_y = scale_x; + } + } + window_width = SCALE_X(image_width); window_height = SCALE_Y(image_height); if (window_width > MAX_DIM) @@ -79,6 +98,7 @@ progress(Imlib_Image im, char percent, int update_x, int update_y, window_height = MAX_DIM; scale_y = (double)MAX_DIM / image_height; } + if (pm) XFreePixmap(disp, pm); pm = XCreatePixmap(disp, win, window_width, window_height, depth); @@ -165,6 +185,7 @@ main(int argc, char **argv) progress_print = 1; break; case 's':/* Scale (window size wrt. image size) */ + scale = 1; scale_x = scale_y = atof(optarg); break; case 'v': --