Ver código fonte

Correctly setting WM_CLASS.

master
phillbush 4 anos atrás
pai
commit
d2435fcd5f
1 arquivos alterados com 15 adições e 2 exclusões
  1. +15
    -2
      xmenu.c

+ 15
- 2
xmenu.c Ver arquivo

@@ -9,6 +9,7 @@
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>


#define PROGNAME "xmenu"
#define ITEMPREV 0 #define ITEMPREV 0
#define ITEMNEXT 1 #define ITEMNEXT 1


@@ -101,6 +102,8 @@ static struct DC dc;
/* menu variables */ /* menu variables */
static struct Menu *rootmenu = NULL; static struct Menu *rootmenu = NULL;
static struct Menu *currmenu = NULL; static struct Menu *currmenu = NULL;
static char **menutitle;
static int menutitlecount;


/* geometry variables */ /* geometry variables */
static struct Geometry geom; static struct Geometry geom;
@@ -129,6 +132,9 @@ main(int argc, char *argv[])
argc -= optind; argc -= optind;
argv += optind; argv += optind;


menutitle = argv;
menutitlecount = argc;

/* open connection to server and set X variables */ /* open connection to server and set X variables */
if ((dpy = XOpenDisplay(NULL)) == NULL) if ((dpy = XOpenDisplay(NULL)) == NULL)
errx(1, "cannot open display"); errx(1, "cannot open display");
@@ -434,7 +440,9 @@ calcscreengeom(void)
static void static void
calcmenu(struct Menu *menu) calcmenu(struct Menu *menu)
{ {
static XClassHint classh = {PROGNAME, PROGNAME};
XWindowChanges changes; XWindowChanges changes;
XTextProperty textprop;
XSizeHints sizeh; XSizeHints sizeh;
XGlyphInfo ext; XGlyphInfo ext;
struct Item *item; struct Item *item;
@@ -466,6 +474,8 @@ calcmenu(struct Menu *menu)
menu->y = screengeom.cursy; menu->y = screengeom.cursy;
else if (screengeom.screenh > menu->h) else if (screengeom.screenh > menu->h)
menu->y = screengeom.screenh - menu->h; menu->y = screengeom.screenh - menu->h;

XStringListToTextProperty(menutitle, menutitlecount, &textprop);
} else { /* else, calculate in respect to parent menu */ } else { /* else, calculate in respect to parent menu */


/* search for the item in parent menu that generates this menu */ /* search for the item in parent menu that generates this menu */
@@ -483,6 +493,8 @@ calcmenu(struct Menu *menu)
menu->y = menu->parent->y; menu->y = menu->parent->y;
else if (screengeom.screenh > menu->h) else if (screengeom.screenh > menu->h)
menu->y = screengeom.screenh - menu->h; menu->y = screengeom.screenh - menu->h;

XStringListToTextProperty(&(menu->caller->output), 1, &textprop);
} }


/* update menu geometry */ /* update menu geometry */
@@ -492,11 +504,12 @@ calcmenu(struct Menu *menu)
changes.y = menu->y; changes.y = menu->y;
XConfigureWindow(dpy, menu->win, CWWidth | CWHeight | CWX | CWY, &changes); XConfigureWindow(dpy, menu->win, CWWidth | CWHeight | CWX | CWY, &changes);


/* set window manager size hints */
/* set window manager hints */
sizeh.flags = PMaxSize | PMinSize; sizeh.flags = PMaxSize | PMinSize;
sizeh.min_width = sizeh.max_width = menu->w; sizeh.min_width = sizeh.max_width = menu->w;
sizeh.min_height = sizeh.max_height = menu->h; sizeh.min_height = sizeh.max_height = menu->h;
XSetWMNormalHints(dpy, menu->win, &sizeh);
XSetWMProperties(dpy, menu->win, &textprop, NULL, NULL, 0, &sizeh,
NULL, &classh);


/* create pixmap and XftDraw */ /* create pixmap and XftDraw */
menu->pixmap = XCreatePixmap(dpy, menu->win, menu->w, menu->h, menu->pixmap = XCreatePixmap(dpy, menu->win, menu->w, menu->h,


Carregando…
Cancelar
Salvar