From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Dec 24 17:40:01 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD4501065676 for ; Wed, 24 Dec 2008 17:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8C27C8FC18 for ; Wed, 24 Dec 2008 17:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id mBOHe0E0074990 for ; Wed, 24 Dec 2008 17:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id mBOHe0th074989; Wed, 24 Dec 2008 17:40:00 GMT (envelope-from gnats) Resent-Date: Wed, 24 Dec 2008 17:40:00 GMT Resent-Message-Id: <200812241740.mBOHe0th074989@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Lars Engels Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40B3E106567B for ; Wed, 24 Dec 2008 17:36:17 +0000 (UTC) (envelope-from lars@e.0x20.net) Received: from mail.0x20.net (mail.0x20.net [IPv6:2001:aa8:fffb::3]) by mx1.freebsd.org (Postfix) with ESMTP id 8F2B18FC21 for ; Wed, 24 Dec 2008 17:36:16 +0000 (UTC) (envelope-from lars@e.0x20.net) Received: by mail.0x20.net (Postfix, from userid 1002) id 04A7E3A6A4; Wed, 24 Dec 2008 18:36:14 +0100 (CET) Message-Id: <20081224173615.04A7E3A6A4@mail.0x20.net> Date: Wed, 24 Dec 2008 18:36:14 +0100 (CET) From: Lars Engels To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/129914: [patch] net-im/amsn: fix tray icon issues with fluxbox / stalonetray X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Lars Engels List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Dec 2008 17:40:01 -0000 >Number: 129914 >Category: ports >Synopsis: [patch] net-im/amsn: fix tray icon issues with fluxbox / stalonetray >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Dec 24 17:40:00 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Lars Engels >Release: FreeBSD 5.5-RELEASE-p19 i386 >Organization: >Environment: System: FreeBSD e.0x20.net 5.5-RELEASE-p19 FreeBSD 5.5-RELEASE-p19 #6: Fri Feb 15 15:16:05 CET 2008 root@e.0x20.net:/data/sysstuff/obj/data/sysstuff/5.5/src/sys/NADE_55_b0 i386 >Description: The attached patch is taken from upstream's SVN repo. It fixes the issue that the tray icon is not displayed in stalonetray / fluxbox tray from time to time. See http://amsn.svn.sourceforge.net/viewvc/amsn/trunk/amsn/utils/linux/traydock/libtray.c?view=log for more information. >How-To-Repeat: >Fix: --- amsn-0.9.7.2_2.patch begins here --- Index: Makefile =================================================================== RCS file: /home/pcvs/ports/net-im/amsn/Makefile,v retrieving revision 1.35 diff -u -r1.35 Makefile --- Makefile 10 Aug 2008 21:58:42 -0000 1.35 +++ Makefile 24 Dec 2008 10:38:17 -0000 @@ -7,7 +7,7 @@ PORTNAME= amsn PORTVERSION= 0.97.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net-im MASTER_SITES= SF Index: files/patch-utils-linux-traydock-libtray.c =================================================================== RCS file: files/patch-utils-linux-traydock-libtray.c diff -N files/patch-utils-linux-traydock-libtray.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-utils-linux-traydock-libtray.c 24 Dec 2008 10:38:17 -0000 @@ -0,0 +1,191 @@ +--- utils/linux/traydock/libtray.c.orig 2008-12-24 11:30:51.000000000 +0100 ++++ utils/linux/traydock/libtray.c 2008-12-24 11:32:00.000000000 +0100 +@@ -128,70 +128,25 @@ + //} + } + +-static char +-*get_wm_name (void) +-{ +- int screen = DefaultScreen(display); +- Atom type; +- int format; +- unsigned long bytes_returned, n_returned; +- unsigned char *buffer; +- +- Window root = RootWindow(display, screen); +- Window *child; +- Atom supwmcheck = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False); +- Atom wmname = XInternAtom(display, "_NET_WM_NAME", False); +- +- XGetWindowProperty(display, root, supwmcheck, 0, 8, False, AnyPropertyType, &type, &format, &n_returned, +- &bytes_returned, (unsigned char **)&child); +- +- if (n_returned != 1) return NULL; +- +- XGetWindowProperty(display, *child, wmname, 0, 128, False, AnyPropertyType, &type, &format, &n_returned, +- &bytes_returned, &buffer); +- +- if (n_returned == 0) return NULL; +- +- XFree(child); +- return (char *) buffer; +-} +- + /* Procedure that Docks the icon */ + static void + DockIcon(ClientData clientData) + { + +- Window root, parent, *children; +- unsigned int n, ret, atom; ++ Window parent; ++ unsigned int ret, atom; + TrayIcon *icon= clientData; + char* wm_name; + +- Tk_MapWindow(icon->win); +- +- XQueryTree(display, Tk_WindowId(icon->win), &root, &parent, &children, &n); +- XFree(children); ++ Tk_MakeWindowExist(icon->win); + + Tk_SetWindowBackgroundPixmap(icon->win, ParentRelative); +- XSetWindowBackgroundPixmap(display, parent, ParentRelative); + + xembed_set_info(icon->win,XEMBED_MAPPED); + +- Tk_UnmapWindow(icon->win); +- +- if ( (atom = XInternAtom(display, "_NET_SYSTEM_TRAY_OPCODE", True )) == None ) { +- wm_name = get_wm_name(); +- if (wm_name != NULL && !strcmp(wm_name, "KWin")) { +- atom = XInternAtom(display, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False); +- ret = XChangeProperty(display, parent, atom, +- XA_WINDOW, 32, PropModeReplace, (unsigned char *)&parent, 1); +- Tk_MapWindow(icon->win); +- } +- XFree(wm_name); +- } else { +- send_message(display,systemtray, atom, +- SYSTEM_TRAY_REQUEST_DOCK,Tk_WindowId(icon->win),0,0); +- } +- ++ atom = XInternAtom(display, "_NET_SYSTEM_TRAY_OPCODE", False ); ++ send_message(display,systemtray, atom, ++ SYSTEM_TRAY_REQUEST_DOCK,Tk_WindowId(icon->win),0,0); + } + + /* Draw the icon */ +@@ -204,10 +159,32 @@ + int widthImg, heightImg; + Window r; + char cmdBuffer[1024]; ++ XSizeHints *hints = NULL; ++ long supplied = 0; + + XGetGeometry(display, Tk_WindowId(icon->win), &r, &x, &y, &w, &h, &b, &d); + XClearWindow(display, Tk_WindowId(icon->win)); + ++ /* ++ * Here we get the window hints because in some cases the XGetGeometry ++ * function returns the wrong width/height. We only check that ++ * min_width <= width <= max_width and min_height <= height <= max_height ++ */ ++ hints = XAllocSizeHints(); ++ XGetWMNormalHints(display, Tk_WindowId(icon->win), hints, &supplied); ++ if( supplied & PMaxSize ) { ++ w = (hints->max_width < w) ? hints->max_width : w; ++ h = (hints->max_height < h) ? hints->max_height : h; ++ } ++ if( supplied & PMinSize ) { ++ w = (hints->min_width > w) ? hints->min_width : w; ++ h = (hints->min_height > h) ? hints->min_height : h; ++ } ++ if(hints) { ++ XFree(hints); ++ hints = NULL; ++ } ++ + if (((icon->width != w) || (icon->height != h) || (icon->mustUpdate)) && (icon->cmdCallback[0] != '\0')) { + snprintf(cmdBuffer,sizeof(cmdBuffer),"%s %u %u",icon->cmdCallback,w,h); + Tcl_EvalEx(globalinterp,cmdBuffer,-1,TCL_EVAL_GLOBAL); +@@ -222,6 +199,8 @@ + if (heightImg > h) + heightImg = h; + ++ if( !Tk_IsMapped(icon->win) ) ++ Tk_MapWindow(icon->win); + Tk_RedrawImage(icon->pixmap, 0, 0, widthImg, heightImg, Tk_WindowId(icon->win), (w-widthImg)/2 , (h-heightImg)/2 ); + + } +@@ -328,6 +307,12 @@ + XSizeHints *hint; + char cmdBuffer[1024]; + ++ /* systemtray was not available in Init */ ++ if (systemtray==0) { ++ Tcl_AppendResult (interp, "cannot create a tray icon without a system tray", (char *) NULL); ++ return TCL_ERROR; ++ } ++ + /* Get memory for trayicon data and zero it*/ + icon = (TrayIcon *) malloc(sizeof(TrayIcon)); + memset((void *) icon, 0, (sizeof(TrayIcon))); +@@ -335,18 +320,11 @@ + + mainw=Tk_MainWindow(interp); + +- /* systemtray was not available in Init */ +- if (systemtray==0) { +- Tcl_AppendResult (interp, "cannot create a tray icon without a system tray", (char *) NULL); +- return TCL_ERROR; +- } +- + /* Get the first argument string (object name) and check it */ + arg=Tcl_GetStringFromObj(objv[1],(int *) &length); + //printf("Arg: %s\n",arg); +- if (strncmp(arg,".",1)) { +- Tcl_AppendResult (interp, "bad path name: ", +- Tcl_GetStringFromObj(objv[1],(int *) &length) , (char *) NULL); ++ if (arg == NULL || length < 1 || strncmp(arg, ".", 1)) { ++ Tcl_AppendResult (interp, "bad path name: ", arg , (char *) NULL); + return TCL_ERROR; + } + +@@ -391,7 +369,7 @@ + n++; + strcpy (icon->tooltip,Tcl_GetStringFromObj(objv[n],(int *) &length)); + } else if (!strncmp(arg,"-command",length)) { +- /* Copy tooltip string */ ++ /* Copy command string */ + n++; + strcpy (icon->cmdCallback,Tcl_GetStringFromObj(objv[n],(int *) &length)); + } else { +@@ -408,10 +386,12 @@ + if (pixmap != NULL) { + /* Create the window */ + icon->win=Tk_CreateWindowFromPath(interp,mainw, +- Tcl_GetStringFromObj(objv[1],(int *) &length),""); ++ Tcl_GetStringFromObj(objv[1],(int *) &length),NULL); + + DockIcon((ClientData)icon); + ++ Tk_GeometryRequest( icon->win, 24, 24); ++ + icon->pixmap=Tk_GetImage(interp,icon->win,pixmap,ImageChangedProc, (ClientData)icon); + + /* Create callback function for event handling */ +@@ -421,9 +401,11 @@ + + /* Set default icon size hint */ + hint = XAllocSizeHints(); +- hint->flags |=PMinSize; ++ hint->flags |=PMinSize|PMaxSize; + hint->min_width=24; ++ hint->max_width=64; + hint->min_height=24; ++ hint->max_height=64; + + XSetWMNormalHints(display,Tk_WindowId(icon->win),hint); + XFree(hint); --- amsn-0.9.7.2_2.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: