From a8e2a88a4b56c1e3d3e49e80cc85e8a194b75603 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 28 Jul 2009 14:31:07 +0200 Subject: Set XClassHint in X11 viewer to allow window managers and other utilities like mozplugger to detect MuPDF windows. --- apps/unix/x11pdf.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'apps/unix/x11pdf.c') diff --git a/apps/unix/x11pdf.c b/apps/unix/x11pdf.c index 3ae1d930..ee9349af 100644 --- a/apps/unix/x11pdf.c +++ b/apps/unix/x11pdf.c @@ -100,7 +100,8 @@ char *winpassword(pdfapp_t *app, char *filename) static void winopen(void) { - XWMHints *hints; + XWMHints *wmhints; + XClassHint *classhint; xdpy = XOpenDisplay(nil); if (!xdpy) @@ -148,17 +149,26 @@ static void winopen(void) XDefineCursor(xdpy, xwin, xcarrow); - hints = XAllocWMHints(); - if (hints) + wmhints = XAllocWMHints(); + if (wmhints) { - hints->flags = IconPixmapHint; - hints->icon_pixmap = XCreateBitmapFromData(xdpy, xwin, + wmhints->flags = IconPixmapHint; + wmhints->icon_pixmap = XCreateBitmapFromData(xdpy, xwin, (char *) gs_l_xbm_bits, gs_l_xbm_width, gs_l_xbm_height); - if (hints->icon_pixmap) + if (wmhints->icon_pixmap) { - XSetWMHints(xdpy, xwin, hints); + XSetWMHints(xdpy, xwin, wmhints); } - XFree(hints); + XFree(wmhints); + } + + classhint = XAllocClassHint(); + if (classhint) + { + classhint->res_name = "mupdf"; + classhint->res_class = "MuPDF"; + XSetClassHint(xdpy, xwin, classhint); + XFree(classhint); } x11fd = ConnectionNumber(xdpy); -- cgit v1.2.3