This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
RE: question about multiwindow mode and application icons
- From: "Earle F. Philhower III" <earle at ziplabel dot com>
- To: cygwin-xfree at cygwin dot com
- Date: Fri, 16 May 2003 09:22:10 -0700
- Subject: RE: question about multiwindow mode and application icons
- Reply-to: cygwin-xfree at cygwin dot com
Howdy...
From: "Ralf Habacker" <Ralf.Habacker@freenet.de>
At 02:02 PM 5/16/2003 +0200, you wrote:
I've tried it and got one problem described below:
1. start xterm
setting window title works
2. start another application
3. switch to xterm -> setting window title does not works
4. kill another application
5. switch to xterm -> setting window title does still not works
6. kill xterm
7. start xterm -> setting window title does not works
Thanks, I didn't catch that. There was a missing WM_WM_HINTS_EVENT case
statement and a check for a NULL return value in the UpdateName() function.
I'll do more testing before u/ling a patch, but you can do the following to
get things into shape:
- In UpdateName() in the if(XGetWindowProp()){ } block, change
hWnd = *retHwnd;
XFree(retHwnd);
into
if(retHwnd) {
hWnd = *retHwnd;
XFree(retHwnd);
}
- In winMultiWindowXMsgProc() comment out the last winSendMessageToWM call:
} else if (event.type == PropertyNotify
&& event.xproperty.atom == atmWmHints) {
memset( &msg, 0, sizeof(msg) );
msg.msg = WM_WM_HINTS_EVENT;
msg.iWindow = event.xproperty.window;
/* Other fields ignored */
winSendMessageToWM (pInfo->pWMInfo, &msg);
}
into
} else if (event.type == PropertyNotify
&& event.xproperty.atom == atmWmHints) {
memset( &msg, 0, sizeof(msg) );
msg.msg = WM_WM_HINTS_EVENT;
msg.iWindow = event.xproperty.window;
/* Other fields ignored */
// winSendMessageToWM (pInfo->pWMInfo, &msg);
}
...
Because of the WM_HINTS problem I have simplified the icon strategy a little:
The easiest solution at now seems to me using *.ico files for any application
identified by the application name (using WM_CLASS). This makes it very
easy to
support additional applications.
Implementing the WM_HINTS stuff could be done in a second step, which will
come
later.
Implementation:
1. Setting the icon is only necessary in winCreateWindowsWindow() through a
LoadImage() call (see the function GetIcon() below) which loads the icon file
from the disk. To archieve the same icon for all windows of an
application, each
application uses a uniq window class for its windows.
For that I need to retrieve the application executable name through WM_CLASS,
which works already on another place. Unfortunally in winCreateWindowsWindow()
there is only a WindowPtr available.
My question is now, how do i get some parameters from a WindowPtr ?
Display *pDisplay,
Window iWin,
WMInfoPtr pWMInfo
s_pScreenPriv->pWMInfo
From that you can get the display ptr. The Window will be harder, if you
have a HWND you can do a (Window)GetProp (hwnd, WIN_WID_PROP);, otherwise
you'll have to find some other way. I looked at this myself and couldn't
figure it out, but I didn't really try too hard.
-Earle F. Philhower, III
earle@ziplabel.com
cdrlabel - ZipLabel - FlpLabel
http://www.cdrlabel.com