1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 12:58:08 +01:00
Files
wmaker/WINGs/wappresource.c
dan 36e46831e0 For libwraster:
---------------

- Added retain/release mechanism to RImage by adding RRetainImage() and
  RReleaseImage(). RDestroyImage() is an alias to RReleaseImage() now, but
  will be removed in a future release because it no longer fits with the
  semantics. Will be kept for a while to allow a smoother transition.
  More about in wrlib/NEWS


For WINGs:
----------

- Small API change:
  1. Renamed WMSetApplicationIconImage(), WMGetApplicationIconImage() and
     WMSetWindowMiniwindowImage() to respectively WMSetApplicationIconPixmap(),
     WMGetApplicationIconPixmap() and WMSetWindowMiniwindowPixmap()
     They operate on a WMPixmap which is practically an X Pixmap with no alpha
     channel information and the new name is more suggestive and also leaves
     room for the new functions added for operating on images with alpha info.
  2. Added WMSetApplicationIconImage() and WMGetApplicationIconImage() which
     operate on an RImage and store alpha information too.
  3. Added WMGetApplicationIconBlendedPixmap() which will take the image with
     alpha set by WMSetApplicationIconImage() and will blend it with a color.
     If color is NULL it will blend using the default panel color (#aeaaae)
  All these changes will allow WINGs to handle images with alpha blending
  correctly in panels and wherever else needed. More about in WINGs/NEWS.
- updated panels to use the newly available RImages if present and fallback
  to old WMPixmaps if not, to properly show alpha blended images.
- replaced some still left malloc's with wmalloc's.


For Window Maker:
-----------------
- Fixed wrong mapping position of the "Docked Applications Panel" for some
  icons.
- Smoother animation for the smiley =)
- Made images with alpha blending be shown correctly in the panels and the
  icon chooser.
- The icon image set to be shown in panels ("Logo.WMPanel") will be
  automatically updated if its entry in WMWindowAttributes changes (without
  a need to restart as until now).


*** Note!!! ***

If you are developing applications with one of libwraster or libWINGs
then you should look to wrlib/NEWS and WINGs/NEWS to see what changed
and how should you update your code.
2001-04-21 07:12:21 +00:00

186 lines
3.8 KiB
C

#include <unistd.h>
#include "WINGsP.h"
#include <X11/Xutil.h>
/* Xmd.h which is indirectly included by GNUstep.h defines BOOL,
* but libPropList also defines it. So we do this kluge to get rid of BOOL
* temporarily */
#ifdef BOOL
# define WINGS_BOOL
# undef BOOL
#endif
#include "GNUstep.h"
#ifdef WINGS_BOOL
# define BOOL
# undef WINGS_BOOL
#endif
extern struct W_Application WMApplication;
void
WMSetApplicationIconWindow(WMScreen *scr, Window window)
{
scr->applicationIconWindow = window;
if (scr->groupLeader) {
XWMHints *hints;
hints = XGetWMHints(scr->display, scr->groupLeader);
hints->flags |= IconWindowHint;
hints->icon_window = window;
XSetWMHints(scr->display, scr->groupLeader, hints);
XFree(hints);
}
}
void
WMSetApplicationIconImage(WMScreen *scr, RImage *image)
{
WMPixmap *icon;
if (scr->applicationIconImage == image)
return;
if (scr->applicationIconImage)
RReleaseImage(scr->applicationIconImage);
scr->applicationIconImage = RRetainImage(image);
/* TODO: check whether we should set the pixmap only if there's none yet */
if (image!=NULL && (icon=WMCreatePixmapFromRImage(scr, image, 128))!=NULL) {
WMSetApplicationIconPixmap(scr, icon);
WMReleasePixmap(icon);
}
}
RImage*
WMGetApplicationIconImage(WMScreen *scr)
{
return scr->applicationIconImage;
}
void
WMSetApplicationIconPixmap(WMScreen *scr, WMPixmap *icon)
{
if (scr->applicationIconPixmap == icon)
return;
if (scr->applicationIconPixmap)
WMReleasePixmap(scr->applicationIconPixmap);
scr->applicationIconPixmap = WMRetainPixmap(icon);
if (scr->groupLeader) {
XWMHints *hints;
hints = XGetWMHints(scr->display, scr->groupLeader);
hints->flags |= IconPixmapHint|IconMaskHint;
hints->icon_pixmap = (icon!=NULL ? icon->pixmap : None);
hints->icon_mask = (icon!=NULL ? icon->mask : None);
XSetWMHints(scr->display, scr->groupLeader, hints);
XFree(hints);
}
}
WMPixmap*
WMGetApplicationIconPixmap(WMScreen *scr)
{
return scr->applicationIconPixmap;
}
WMPixmap*
WMGetApplicationIconBlendedPixmap(WMScreen *scr, RColor *color)
{
WMPixmap *pix;
if (scr->applicationIconImage) {
RColor gray;
gray.red = 0xae;
gray.green = 0xaa;
gray.blue = 0xae;
gray.alpha = 0;
if (!color)
color = &gray;
pix = WMCreateBlendedPixmapFromRImage(scr, scr->applicationIconImage,
color);
} else {
pix = NULL;
}
return pix;
}
void
WMSetApplicationHasAppIcon(WMScreen *scr, Bool flag)
{
scr->aflags.hasAppIcon = flag;
}
void
W_InitApplication(WMScreen *scr)
{
Window leader;
XClassHint *classHint;
XWMHints *hints;
leader = XCreateSimpleWindow(scr->display, scr->rootWin, -1, -1,
1, 1, 0, 0, 0);
if (!scr->aflags.simpleApplication) {
classHint = XAllocClassHint();
classHint->res_name = "groupLeader";
classHint->res_class = WMApplication.applicationName;
XSetClassHint(scr->display, leader, classHint);
XFree(classHint);
XSetCommand(scr->display, leader, WMApplication.argv,
WMApplication.argc);
hints = XAllocWMHints();
hints->flags = WindowGroupHint;
hints->window_group = leader;
/* This code will never actually be reached, because to have
* scr->applicationIconPixmap set we need to have a screen first,
* but this function is called in the screen creation process.
* -Dan
*/
if (scr->applicationIconPixmap) {
hints->flags |= IconPixmapHint;
hints->icon_pixmap = scr->applicationIconPixmap->pixmap;
if (scr->applicationIconPixmap->mask) {
hints->flags |= IconMaskHint;
hints->icon_mask = scr->applicationIconPixmap->mask;
}
}
XSetWMHints(scr->display, leader, hints);
XFree(hints);
}
scr->groupLeader = leader;
}