cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

commit a5b741b57a9b31ba89252a1e156e9d7f4f7a8ca8
parent 933806fc806b9052110e0342ef8fc6823ee278de
Author: Tim Brooks <brooks@cern.ch>
Date:   Mon, 17 Oct 2016 17:44:25 +0200

Set WM_CLASS for window manager information

GNOME in particular uses the class field for integrated window menus.
See: https://tronche.com/gui/x/icccm/sec-4.html#WM_CLASS for reference.

Diffstat:
MXDriver.c | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/XDriver.c b/XDriver.c @@ -19,6 +19,7 @@ #include <stdlib.h> XWindowAttributes CNFGWinAtt; +XClassHint *CNFGClassHint; Display *CNFGDisplay; Window CNFGWindow; Pixmap CNFGPixmap; @@ -36,6 +37,20 @@ static void InternalLinkScreenAndGo( const char * WindowName ) { XGetWindowAttributes( CNFGDisplay, CNFGWindow, &CNFGWinAtt ); + XGetClassHint( CNFGDisplay, CNFGWindow, CNFGClassHint ); + if (!CNFGClassHint) { + CNFGClassHint = XAllocClassHint(); + if (CNFGClassHint) { + CNFGClassHint->res_name = "cnping"; + CNFGClassHint->res_class = "cnping"; + XSetClassHint( CNFGDisplay, CNFGWindow, CNFGClassHint ); + } else { + fprintf( stderr, "Failed to allocate XClassHint!\n" ); + } + } else { + fprintf( stderr, "Pre-existing XClassHint\n" ); + } + XSelectInput (CNFGDisplay, CNFGWindow, KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask ); XSetStandardProperties( CNFGDisplay, CNFGWindow, WindowName, WindowName, None, NULL, 0, NULL );