This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Custom icons per window class/name patch


Hi Earle,

> Good to hear, but how to compute in detail ? Additional what about the
> performance ?
> Using the xclient means to transfer the image data every time icon
> setting will
> be performed from the server to the client, which is the server, although the
> data is directly asseccable on the server, isn't it ?
> I assume based on the things I have learned from you, that all the image data
> will be in some property on the server, which has only to be retrieved in some
> mysteric way.
>
I've got a little success.
Now I'm able to retrieve the pixmap pointer from the WM_HINTS structure and the
bitmap data, the CreateIcon returns an icon handle, but unfortunally the icon
isn't displayed.

Any hints ?

Cheers
Ralf


winCreateWindowsWindow (WindowPtr pWin)
<snip>

add the stuff below after the following two lines in winmultiwindowwindow.c:
winCreateWindowsWindow()
  hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
  strcpy(classStr, WINDOW_CLASS_X);

------------------------------------------------------------------
  {
  xPropWMHints *hints;
  GetWMHints(pWin, &hints);

  if (hints->iconPixmap) {
    PixmapPtr iconPtr;
    PixmapPtr maskPtr;
    char *iconData = 0;
    char *maskData = 0;

    iconPtr= LookupIDByType (hints->iconPixmap, RT_PIXMAP);
    ErrorF("icon Pixmap found %x\n",iconPtr);
    if (iconPtr) {
      iconData = malloc(iconPtr->drawable.width * iconPtr->drawable.height *
(iconPtr->drawable.bitsPerPixel/8));
      miGetImage((DrawablePtr)&iconPtr->drawable, 0, 0, iconPtr->drawable.width,
iconPtr->drawable.height, ZPixmap, 0xffff, iconData);
      ErrorF("buffer %x\n",iconData);

      maskPtr = LookupIDByType (hints->iconMask, RT_PIXMAP);
      ErrorF("mask Pixmap found %x\n",maskPtr);
      if (maskPtr) {
        // FIXME: calc correct size
        maskData = malloc((maskPtr->drawable.width * maskPtr->drawable.height) /
8 );
        miGetImage((DrawablePtr)&maskPtr->drawable, 0, 0,
maskPtr->drawable.width, maskPtr->drawable.height, ZPixmap, 0xffff, maskData);
      }

      hIcon = CreateIcon(NULL,
                  iconPtr->drawable.width,
                  iconPtr->drawable.height,
                  1,
                  iconPtr->drawable.bitsPerPixel,
                  maskData,     // lpbANDbits
                  iconData      // lpbXORbits
              );
      free(iconData);
      free(maskData);
      }
    }
  }

------------------------------------------------------------------



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]