1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-04-20 23:31:26 +02:00

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.
This commit is contained in:
dan
2001-04-21 07:12:21 +00:00
parent eb11184ef0
commit 36e46831e0
52 changed files with 782 additions and 466 deletions
+13
View File
@@ -32,6 +32,19 @@ Changes since version 0.64.0:
- Added a hint that Window Maker crashed, to allow windows to be placed
in their correct previous positions after a crash situation and also to
preserve their state before the crash (minimized, shaded, hidden, ...)
- Fixed wrong mapping position of the "Docked Applications Panel" for some
icons.
- Smoother animation for the smiley =)
- Added retain/release mechanism for RImages. RDestroyImage() has become
obsolete. More about this can be found in wrlib/Changelog and wrlib/NEWS.
- Small API change in WINGs to allow images with alpha blending set as the
application icons be shown correctly. More about this in WINGs/Changelog
and WINGs/NEWS.
- 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).
Changes since version 0.63.1:
+4 -2
View File
@@ -4,12 +4,14 @@ NEWS for veteran Window Maker users
--- 0.65.0
Single AppIcon
--------------
Removed --single-appicon patch and replaced it with a application
specific collapsing option. Check inspector panel and appicon menu.
--- 0.63.2
--- 0.64.0
No Polling of Configuration Files
---------------------------------
+17
View File
@@ -29,6 +29,23 @@ Changes since wmaker 0.64.0:
performance a bit.
- replaced some recursive code with iterative code in selection.c
- added WMCreateBlendedPixmapFromRImage()
- 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 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.
changes since wmaker 0.63.1:
+77
View File
@@ -0,0 +1,77 @@
*** Sat Apr 21 09:12:09 EEST 2001 -Dan
API change
----------
To allow a correct display of icon images with alpha blending in panels and
other places where a WINGs based application may use them the following
changes took place:
1. The following functions were renamed:
- WMSetApplicationIconImage() --> WMSetApplicationIconPixmap()
- WMGetApplicationIconImage() --> WMGetApplicationIconPixmap()
- WMSetWindowMiniwindowImage() --> WMSetWindowMiniwindowPixmap()
2. The following functions were added:
- WMSetApplicationIconImage(WMScreen *scr, RImage *image)
- RImage* WMGetApplicationIconImage(WMScreen *scr)
- WMPixmap* WMGetApplicationIconBlendedPixmap(WMScreen *scr, RColor *color)
As you can see the old functions that operated on WMPixmap images (which are
basically X Pixmaps that lack alpha information) were renamed to ...Pixmap()
to make them more suggestive about what they do and to make room for the
new functions that operate on RImages (that hold alpha information).
Since the corresponding WMGet... functions only retrieve the stored
image/pixmap from the application, I'll outline how the WMSet...
functions operate:
All WM...IconPixmap() functions operate on WMPixmaps
All WM...IconImage() functions operate on RImages
- WMSetApplicationIconImage() will set the RImage to be used in panels
and will also convert the RImage to a WMPixmap with a threshold of 128
and will use that pixmap for the appicon image. If that doesn't satisfy
you, you can make a call to WMSetApplicationIconPixmap() on your own to
set whatever WMPixmap you see fit for the appicon.
- WMSetApplicationIconPixmap() will set the WMPixmap to be used for the
appicon and for the panels
If you use only one of the above functions, the corresponding image/pixmap
will be used everywhere where needed (panels and appicon), but the pixmap
version will not be able to handle alpha blending correctly.
If you use both WMSetApplicationIconImage() and WMSetApplicationIconPixmap()
then the RImage will have priority in panels, and the WMPixmap will only be
used for the appicon. This allows you to better control what icon is
displayed in the appicon, in case the default conversion of the RImage to a
pixmap with a threshold of 128 is not good enough, or in case you want a
different icon to be shown in the appicon than in panels.
Also this new function was added:
- WMGetApplicationIconBlendedPixmap() will use the RImage set with
WMSetApplicationIconImage() if available and will blend it with the color
you passed. This will make the image show well on a background of that
color. If the RImage was not set it will return NULL. You need to call
WMReleasePixmap() on it after you finish with it. Passing a NULL pointer
instead of a color will make the RImage be blended with the default color
of the WINGs widgets: '#aeaaae' making it suitable to be assigned to any
WINGs widget.
To make your existing code work as before all you need to do is to rename
the following functions:
- WMSetApplicationIconImage() --> WMSetApplicationIconPixmap()
- WMGetApplicationIconImage() --> WMGetApplicationIconPixmap()
- WMSetWindowMiniwindowImage() --> WMSetWindowMiniwindowPixmap()
But if you want to take advantage of the new abilities to show alpha
blended images you need to start using the new functions.
+1 -1
View File
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
WMSetApplicationIconImage(scr, pixmap);
WMSetApplicationIconPixmap(scr, pixmap);
WMReleasePixmap(pixmap);
if (panelType == SAVE_PANEL_TYPE) {
sPanel = WMGetSavePanel(scr);
+1 -1
View File
@@ -89,7 +89,7 @@ int main(int argc, char **argv)
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
WMSetApplicationIconImage(scr, pixmap); WMReleasePixmap(pixmap);
WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
if ((result = WMRunInputPanel(scr, NULL, title, prompt, initial, "OK", "Cancel")) != NULL)
printf("%s\n", result);
+3 -3
View File
@@ -357,12 +357,12 @@ testGradientButtons(WMScreen *scr)
back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL);
RBevelImage(back, RBEV_RAISED2);
pix1 = WMCreatePixmapFromRImage(scr, back, 0);
RDestroyImage(back);
RReleaseImage(back);
back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL);
RBevelImage(back, RBEV_SUNKEN);
pix2 = WMCreatePixmapFromRImage(scr, back, 0);
RDestroyImage(back);
RReleaseImage(back);
color = WMWhiteColor(scr);
altColor = WMCreateNamedColor(scr, "red", True);
@@ -1283,7 +1283,7 @@ main(int argc, char **argv)
/*
* Makes the logo be used in standard dialog panels.
*/
WMSetApplicationIconImage(scr, pixmap); WMReleasePixmap(pixmap);
WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
/*
* Do some test stuff.
+151 -140
View File
@@ -467,7 +467,7 @@ typedef void WMSplitViewResizeSubviewsProc(WMSplitView *sPtr,
typedef void WMSplitViewConstrainProc(WMSplitView *sPtr, int dividerIndex,
int *minSize, int *maxSize);
typedef WMWidget *WMMatrixCreateCellProc(WMMatrix *mPtr);
typedef WMWidget* WMMatrixCreateCellProc(WMMatrix *mPtr);
@@ -595,20 +595,20 @@ void WMInitializeApplication(char *applicationName, int *argc, char **argv);
void WMSetResourcePath(char *path);
/* don't free the returned string */
char *WMGetApplicationName();
char* WMGetApplicationName();
/* Try to locate resource file. ext may be NULL */
char *WMPathForResourceOfType(char *resource, char *ext);
char* WMPathForResourceOfType(char *resource, char *ext);
WMScreen *WMOpenScreen(const char *display);
WMScreen* WMOpenScreen(const char *display);
WMScreen *WMCreateScreenWithRContext(Display *display, int screen,
WMScreen* WMCreateScreenWithRContext(Display *display, int screen,
RContext *context);
WMScreen *WMCreateScreen(Display *display, int screen);
WMScreen* WMCreateScreen(Display *display, int screen);
WMScreen *WMCreateSimpleApplicationScreen(Display *display);
WMScreen* WMCreateSimpleApplicationScreen(Display *display);
void WMScreenMainLoop(WMScreen *scr);
@@ -616,23 +616,30 @@ void WMBreakModalLoop(WMScreen *scr);
void WMRunModalLoop(WMScreen *scr, WMView *view);
RContext *WMScreenRContext(WMScreen *scr);
RContext* WMScreenRContext(WMScreen *scr);
Display *WMScreenDisplay(WMScreen *scr);
Display* WMScreenDisplay(WMScreen *scr);
int WMScreenDepth(WMScreen *scr);
void WMSetApplicationIconImage(WMScreen *app, WMPixmap *icon);
void WMSetApplicationIconImage(WMScreen *app, RImage *image);
WMPixmap *WMGetApplicationIconImage(WMScreen *app);
RImage* WMGetApplicationIconImage(WMScreen *app);
void WMSetApplicationIconPixmap(WMScreen *app, WMPixmap *icon);
WMPixmap* WMGetApplicationIconPixmap(WMScreen *app);
/* If color==NULL it will use the default color for panels: ae/aa/ae */
WMPixmap* WMGetApplicationIconBlendedPixmap(WMScreen *scr, RColor *color);
void WMSetApplicationIconWindow(WMScreen *scr, Window window);
void WMSetFocusToWidget(WMWidget *widget);
WMEventHook *WMHookEventHandler(WMEventHook *handler);
WMEventHook* WMHookEventHandler(WMEventHook *handler);
int WMHandleEvent(XEvent *event);
@@ -682,22 +689,22 @@ WMPoint WMGetDraggingInfoImageLocation(WMDraggingInfo *info);
/* ....................................................................... */
WMFont *WMCreateFontSet(WMScreen *scrPtr, char *fontName);
WMFont* WMCreateFontSet(WMScreen *scrPtr, char *fontName);
WMFont *WMCreateNormalFont(WMScreen *scrPtr, char *fontName);
WMFont* WMCreateNormalFont(WMScreen *scrPtr, char *fontName);
WMFont *WMCreateFont(WMScreen *scrPtr, char *fontName);
WMFont* WMCreateFont(WMScreen *scrPtr, char *fontName);
WMFont *WMRetainFont(WMFont *font);
WMFont* WMRetainFont(WMFont *font);
void WMReleaseFont(WMFont *font);
unsigned int WMFontHeight(WMFont *font);
/*
WMFont *WMUserFontOfSize(WMScreen *scrPtr, int size);
WMFont* WMUserFontOfSize(WMScreen *scrPtr, int size);
WMFont *WMUserFixedPitchFontOfSize(WMScreen *scrPtr, int size);
WMFont* WMUserFixedPitchFontOfSize(WMScreen *scrPtr, int size);
*/
@@ -705,50 +712,50 @@ void WMSetWidgetDefaultFont(WMScreen *scr, WMFont *font);
void WMSetWidgetDefaultBoldFont(WMScreen *scr, WMFont *font);
WMFont *WMSystemFontOfSize(WMScreen *scrPtr, int size);
WMFont* WMSystemFontOfSize(WMScreen *scrPtr, int size);
WMFont *WMBoldSystemFontOfSize(WMScreen *scrPtr, int size);
WMFont* WMBoldSystemFontOfSize(WMScreen *scrPtr, int size);
XFontSet WMGetFontFontSet(WMFont *font);
WMFont *WMNormalizeFont(WMScreen *scr, WMFont *font);
WMFont* WMNormalizeFont(WMScreen *scr, WMFont *font);
WMFont *WMStrengthenFont(WMScreen *scr, WMFont *font);
WMFont* WMStrengthenFont(WMScreen *scr, WMFont *font);
WMFont *WMUnstrengthenFont(WMScreen *scr, WMFont *font);
WMFont* WMUnstrengthenFont(WMScreen *scr, WMFont *font);
WMFont *WMEmphasizeFont(WMScreen *scr, WMFont *font);
WMFont* WMEmphasizeFont(WMScreen *scr, WMFont *font);
WMFont *WMUnemphasizeFont(WMScreen *scr, WMFont *font);
WMFont* WMUnemphasizeFont(WMScreen *scr, WMFont *font);
WMFont *WMGetFontOfSize(WMScreen *scr, WMFont *font, int size);
WMFont* WMGetFontOfSize(WMScreen *scr, WMFont *font, int size);
/* ....................................................................... */
WMPixmap *WMRetainPixmap(WMPixmap *pixmap);
WMPixmap* WMRetainPixmap(WMPixmap *pixmap);
void WMReleasePixmap(WMPixmap *pixmap);
WMPixmap *WMCreatePixmap(WMScreen *scrPtr, int width, int height, int depth,
WMPixmap* WMCreatePixmap(WMScreen *scrPtr, int width, int height, int depth,
Bool masked);
WMPixmap *WMCreatePixmapFromXPixmaps(WMScreen *scrPtr, Pixmap pixmap,
WMPixmap* WMCreatePixmapFromXPixmaps(WMScreen *scrPtr, Pixmap pixmap,
Pixmap mask, int width, int height,
int depth);
WMPixmap *WMCreatePixmapFromRImage(WMScreen *scrPtr, RImage *image,
WMPixmap* WMCreatePixmapFromRImage(WMScreen *scrPtr, RImage *image,
int threshold);
WMPixmap *WMCreatePixmapFromXPMData(WMScreen *scrPtr, char **data);
WMPixmap* WMCreatePixmapFromXPMData(WMScreen *scrPtr, char **data);
WMSize WMGetPixmapSize(WMPixmap *pixmap);
WMPixmap *WMCreatePixmapFromFile(WMScreen *scrPtr, char *fileName);
WMPixmap* WMCreatePixmapFromFile(WMScreen *scrPtr, char *fileName);
WMPixmap* WMCreateBlendedPixmapFromRImage(WMScreen *scrPtr, RImage *image,
RColor *color);
WMPixmap *WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, char *fileName,
WMPixmap* WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, char *fileName,
RColor *color);
void WMDrawPixmap(WMPixmap *pixmap, Drawable d, int x, int y);
@@ -757,18 +764,18 @@ Pixmap WMGetPixmapXID(WMPixmap *pixmap);
Pixmap WMGetPixmapMaskXID(WMPixmap *pixmap);
WMPixmap *WMGetSystemPixmap(WMScreen *scr, int image);
WMPixmap* WMGetSystemPixmap(WMScreen *scr, int image);
/* ....................................................................... */
WMColor *WMDarkGrayColor(WMScreen *scr);
WMColor* WMDarkGrayColor(WMScreen *scr);
WMColor *WMGrayColor(WMScreen *scr);
WMColor* WMGrayColor(WMScreen *scr);
WMColor *WMBlackColor(WMScreen *scr);
WMColor* WMBlackColor(WMScreen *scr);
WMColor *WMWhiteColor(WMScreen *scr);
WMColor* WMWhiteColor(WMScreen *scr);
void WMSetColorInGC(WMColor *color, GC gc);
@@ -781,13 +788,13 @@ void WMPaintColorSwatch(WMColor *color, Drawable d, int x, int y,
void WMReleaseColor(WMColor *color);
WMColor *WMRetainColor(WMColor *color);
WMColor* WMRetainColor(WMColor *color);
WMColor *WMCreateRGBColor(WMScreen *scr, unsigned short red,
WMColor* WMCreateRGBColor(WMScreen *scr, unsigned short red,
unsigned short green, unsigned short blue,
Bool exact);
WMColor *WMCreateNamedColor(WMScreen *scr, char *name, Bool exact);
WMColor* WMCreateNamedColor(WMScreen *scr, char *name, Bool exact);
unsigned short WMRedComponentOfColor(WMColor *color);
@@ -795,7 +802,7 @@ unsigned short WMGreenComponentOfColor(WMColor *color);
unsigned short WMBlueComponentOfColor(WMColor *color);
char *WMGetColorRGBDescription(WMColor *color);
char* WMGetColorRGBDescription(WMColor *color);
/* ....................................................................... */
@@ -812,7 +819,7 @@ int WMWidthOfString(WMFont *font, char *text, int length);
/* ....................................................................... */
WMScreen *WMWidgetScreen(WMWidget *w);
WMScreen* WMWidgetScreen(WMWidget *w);
unsigned int WMScreenWidth(WMScreen *scr);
@@ -844,7 +851,7 @@ void WMDestroyWidget(WMWidget *widget);
void WMHangData(WMWidget *widget, void *data);
void *WMGetHangedData(WMWidget *widget);
void* WMGetHangedData(WMWidget *widget);
unsigned int WMWidgetWidth(WMWidget *w);
@@ -867,7 +874,7 @@ WMPoint WMGetViewPosition(WMView *view);
WMPoint WMGetViewScreenPosition(WMView *view);
WMWidget *WMWidgetOfView(WMView *view);
WMWidget* WMWidgetOfView(WMView *view);
void WMSetViewNextResponder(WMView *view, WMView *responder);
@@ -898,14 +905,14 @@ void WMSetBalloonEnabled(WMScreen *scr, Bool flag);
/* ....................................................................... */
WMWindow *WMCreateWindow(WMScreen *screen, char *name);
WMWindow* WMCreateWindow(WMScreen *screen, char *name);
WMWindow *WMCreateWindowWithStyle(WMScreen *screen, char *name, int style);
WMWindow* WMCreateWindowWithStyle(WMScreen *screen, char *name, int style);
WMWindow *WMCreatePanelWithStyleForWindow(WMWindow *owner, char *name,
WMWindow* WMCreatePanelWithStyleForWindow(WMWindow *owner, char *name,
int style);
WMWindow *WMCreatePanelForWindow(WMWindow *owner, char *name);
WMWindow* WMCreatePanelForWindow(WMWindow *owner, char *name);
void WMChangePanelOwner(WMWindow *win, WMWindow *newOwner);
@@ -913,7 +920,7 @@ void WMSetWindowTitle(WMWindow *wPtr, char *title);
void WMSetWindowMiniwindowTitle(WMWindow *win, char *title);
void WMSetWindowMiniwindowImage(WMWindow *win, WMPixmap *pixmap);
void WMSetWindowMiniwindowPixmap(WMWindow *win, WMPixmap *pixmap);
void WMSetWindowCloseAction(WMWindow *win, WMAction *action, void *clientData);
@@ -954,9 +961,9 @@ void WMSetButtonAction(WMButton *bPtr, WMAction *action, void *clientData);
#define WMCreateSwitchButton(parent) \
WMCreateButton((parent), WBTSwitch)
WMButton *WMCreateButton(WMWidget *parent, WMButtonType type);
WMButton* WMCreateButton(WMWidget *parent, WMButtonType type);
WMButton *WMCreateCustomButton(WMWidget *parent, int behaviourMask);
WMButton* WMCreateCustomButton(WMWidget *parent, int behaviourMask);
void WMSetButtonImageDefault(WMButton *bPtr);
@@ -1002,15 +1009,15 @@ void WMSetButtonPeriodicDelay(WMButton *bPtr, float delay, float interval);
/* ....................................................................... */
WMLabel *WMCreateLabel(WMWidget *parent);
WMLabel* WMCreateLabel(WMWidget *parent);
void WMSetLabelWraps(WMLabel *lPtr, Bool flag);
void WMSetLabelImage(WMLabel *lPtr, WMPixmap *image);
WMPixmap *WMGetLabelImage(WMLabel *lPtr);
WMPixmap* WMGetLabelImage(WMLabel *lPtr);
char *WMGetLabelText(WMLabel *lPtr);
char* WMGetLabelText(WMLabel *lPtr);
void WMSetLabelImagePosition(WMLabel *lPtr, WMImagePosition position);
@@ -1028,7 +1035,7 @@ void WMSetLabelTextColor(WMLabel *lPtr, WMColor *color);
/* ....................................................................... */
WMFrame *WMCreateFrame(WMWidget *parent);
WMFrame* WMCreateFrame(WMWidget *parent);
void WMSetFrameTitlePosition(WMFrame *fPtr, WMTitlePosition position);
@@ -1038,14 +1045,14 @@ void WMSetFrameTitle(WMFrame *fPtr, char *title);
/* ....................................................................... */
WMTextField *WMCreateTextField(WMWidget *parent);
WMTextField* WMCreateTextField(WMWidget *parent);
void WMInsertTextFieldText(WMTextField *tPtr, char *text, int position);
void WMDeleteTextFieldRange(WMTextField *tPtr, WMRange range);
/* you can free the returned string */
char *WMGetTextFieldText(WMTextField *tPtr);
char* WMGetTextFieldText(WMTextField *tPtr);
void WMSetTextFieldText(WMTextField *tPtr, char *text);
@@ -1053,7 +1060,7 @@ void WMSetTextFieldAlignment(WMTextField *tPtr, WMAlignment alignment);
void WMSetTextFieldFont(WMTextField *tPtr, WMFont *font);
WMFont *WMGetTextFieldFont(WMTextField *tPtr);
WMFont* WMGetTextFieldFont(WMTextField *tPtr);
void WMSetTextFieldBordered(WMTextField *tPtr, Bool bordered);
@@ -1082,7 +1089,7 @@ extern char *WMTextDidEndEditingNotification;
/* ....................................................................... */
WMScroller *WMCreateScroller(WMWidget *parent);
WMScroller* WMCreateScroller(WMWidget *parent);
void WMSetScrollerParameters(WMScroller *sPtr, float floatValue,
float knobProportion);
@@ -1102,7 +1109,7 @@ extern char *WMScrollerDidScrollNotification;
/* ....................................................................... */
WMList *WMCreateList(WMWidget *parent);
WMList* WMCreateList(WMWidget *parent);
void WMSetListAllowMultipleSelection(WMList *lPtr, Bool flag);
@@ -1110,7 +1117,7 @@ void WMSetListAllowEmptySelection(WMList *lPtr, Bool flag);
#define WMAddListItem(lPtr, text) WMInsertListItem((lPtr), -1, (text))
WMListItem *WMInsertListItem(WMList *lPtr, int row, char *text);
WMListItem* WMInsertListItem(WMList *lPtr, int row, char *text);
void WMSortListItems(WMList *lPtr);
@@ -1118,9 +1125,9 @@ void WMSortListItemsWithComparer(WMList *lPtr, WMCompareDataProc *func);
int WMFindRowOfListItemWithTitle(WMList *lPtr, char *title);
WMListItem *WMGetListItem(WMList *lPtr, int row);
WMListItem* WMGetListItem(WMList *lPtr, int row);
WMArray *WMGetListItems(WMList *lPtr);
WMArray* WMGetListItems(WMList *lPtr);
void WMRemoveListItem(WMList *lPtr, int row);
@@ -1182,7 +1189,7 @@ extern char *WMListSelectionDidChangeNotification;
/* ....................................................................... */
WMBrowser *WMCreateBrowser(WMWidget *parent);
WMBrowser* WMCreateBrowser(WMWidget *parent);
void WMSetBrowserAllowMultipleSelection(WMBrowser *bPtr, Bool flag);
@@ -1202,7 +1209,7 @@ void WMSetBrowserMaxVisibleColumns(WMBrowser *bPtr, int columns);
void WMSetBrowserColumnTitle(WMBrowser *bPtr, int column, char *title);
WMListItem *WMInsertBrowserItem(WMBrowser *bPtr, int column, int row, char *text, Bool isBranch);
WMListItem* WMInsertBrowserItem(WMBrowser *bPtr, int column, int row, char *text, Bool isBranch);
void WMSortBrowserColumn(WMBrowser *bPtr, int column);
@@ -1213,10 +1220,10 @@ void WMSortBrowserColumnWithComparer(WMBrowser *bPtr, int column,
char* WMSetBrowserPath(WMBrowser *bPtr, char *path);
/* free the returned string */
char *WMGetBrowserPath(WMBrowser *bPtr);
char* WMGetBrowserPath(WMBrowser *bPtr);
/* free the returned string */
char *WMGetBrowserPathToColumn(WMBrowser *bPtr, int column);
char* WMGetBrowserPathToColumn(WMBrowser *bPtr, int column);
/* free the returned array */
WMArray* WMGetBrowserPaths(WMBrowser *bPtr);
@@ -1226,7 +1233,7 @@ void WMSetBrowserAction(WMBrowser *bPtr, WMAction *action, void *clientData);
void WMSetBrowserDoubleAction(WMBrowser *bPtr, WMAction *action,
void *clientData);
WMListItem *WMGetBrowserSelectedItemInColumn(WMBrowser *bPtr, int column);
WMListItem* WMGetBrowserSelectedItemInColumn(WMBrowser *bPtr, int column);
int WMGetBrowserFirstVisibleColumn(WMBrowser *bPtr);
@@ -1238,7 +1245,7 @@ int WMGetBrowserNumberOfColumns(WMBrowser *bPtr);
int WMGetBrowserMaxVisibleColumns(WMBrowser *bPtr);
WMList *WMGetBrowserListInColumn(WMBrowser *bPtr, int column);
WMList* WMGetBrowserListInColumn(WMBrowser *bPtr, int column);
void WMSetBrowserDelegate(WMBrowser *bPtr, WMBrowserDelegate *delegate);
@@ -1253,7 +1260,7 @@ void WMSetBrowserHasScroller(WMBrowser *bPtr, int hasScroller);
Bool WMMenuItemIsSeparator(WMMenuItem *item);
WMMenuItem *WMCreateMenuItem(void);
WMMenuItem* WMCreateMenuItem(void);
void WMDestroyMenuItem(WMMenuItem *item);
@@ -1261,7 +1268,7 @@ Bool WMGetMenuItemEnabled(WMMenuItem *item);
void WMSetMenuItemEnabled(WMMenuItem *item, Bool flag);
char *WMGetMenuItemShortcut(WMMenuItem *item);
char* WMGetMenuItemShortcut(WMMenuItem *item);
unsigned WMGetMenuItemShortcutModifierMask(WMMenuItem *item);
@@ -1269,19 +1276,19 @@ void WMSetMenuItemShortcut(WMMenuItem *item, char *shortcut);
void WMSetMenuItemShortcutModifierMask(WMMenuItem *item, unsigned mask);
void *WMGetMenuItemRepresentedObject(WMMenuItem *item);
void* WMGetMenuItemRepresentedObject(WMMenuItem *item);
void WMSetMenuItemRepresentedObject(WMMenuItem *item, void *object);
void WMSetMenuItemAction(WMMenuItem *item, WMAction *action, void *data);
WMAction *WMGetMenuItemAction(WMMenuItem *item);
WMAction* WMGetMenuItemAction(WMMenuItem *item);
void *WMGetMenuItemData(WMMenuItem *item);
void* WMGetMenuItemData(WMMenuItem *item);
void WMSetMenuItemTitle(WMMenuItem *item, char *title);
char *WMGetMenuItemTitle(WMMenuItem *item);
char* WMGetMenuItemTitle(WMMenuItem *item);
void WMSetMenuItemState(WMMenuItem *item, int state);
@@ -1289,40 +1296,40 @@ int WMGetMenuItemState(WMMenuItem *item);
void WMSetMenuItemPixmap(WMMenuItem *item, WMPixmap *pixmap);
WMPixmap *WMGetMenuItemPixmap(WMMenuItem *item);
WMPixmap* WMGetMenuItemPixmap(WMMenuItem *item);
void WMSetMenuItemOnStatePixmap(WMMenuItem *item, WMPixmap *pixmap);
WMPixmap *WMGetMenuItemOnStatePixmap(WMMenuItem *item);
WMPixmap* WMGetMenuItemOnStatePixmap(WMMenuItem *item);
void WMSetMenuItemOffStatePixmap(WMMenuItem *item, WMPixmap *pixmap);
WMPixmap *WMGetMenuItemOffStatePixmap(WMMenuItem *item);
WMPixmap* WMGetMenuItemOffStatePixmap(WMMenuItem *item);
void WMSetMenuItemMixedStatePixmap(WMMenuItem *item, WMPixmap *pixmap);
WMPixmap *WMGetMenuItemMixedStatePixmap(WMMenuItem *item);
WMPixmap* WMGetMenuItemMixedStatePixmap(WMMenuItem *item);
/*void WMSetMenuItemSubmenu(WMMenuItem *item, WMMenu *submenu);
WMMenu *WMGetMenuItemSubmenu(WMMenuItem *item);
WMMenu* WMGetMenuItemSubmenu(WMMenuItem *item);
Bool WMGetMenuItemHasSubmenu(WMMenuItem *item);
*/
/* ....................................................................... */
WMPopUpButton *WMCreatePopUpButton(WMWidget *parent);
WMPopUpButton* WMCreatePopUpButton(WMWidget *parent);
void WMSetPopUpButtonAction(WMPopUpButton *sPtr, WMAction *action,
void *clientData);
void WMSetPopUpButtonPullsDown(WMPopUpButton *bPtr, Bool flag);
WMMenuItem *WMAddPopUpButtonItem(WMPopUpButton *bPtr, char *title);
WMMenuItem* WMAddPopUpButtonItem(WMPopUpButton *bPtr, char *title);
WMMenuItem *WMInsertPopUpButtonItem(WMPopUpButton *bPtr, int index,
WMMenuItem* WMInsertPopUpButtonItem(WMPopUpButton *bPtr, int index,
char *title);
void WMRemovePopUpButtonItem(WMPopUpButton *bPtr, int index);
@@ -1338,9 +1345,9 @@ int WMGetPopUpButtonSelectedItem(WMPopUpButton *bPtr);
void WMSetPopUpButtonText(WMPopUpButton *bPtr, char *text);
/* don't free the returned data */
char *WMGetPopUpButtonItem(WMPopUpButton *bPtr, int index);
char* WMGetPopUpButtonItem(WMPopUpButton *bPtr, int index);
WMMenuItem *WMGetPopUpButtonMenuItem(WMPopUpButton *bPtr, int index);
WMMenuItem* WMGetPopUpButtonMenuItem(WMPopUpButton *bPtr, int index);
int WMGetPopUpButtonNumberOfItems(WMPopUpButton *bPtr);
@@ -1351,7 +1358,7 @@ Bool WMGetPopUpButtonEnabled(WMPopUpButton *bPtr);
/* ....................................................................... */
WMProgressIndicator *WMCreateProgressIndicator(WMWidget *parent);
WMProgressIndicator* WMCreateProgressIndicator(WMWidget *parent);
void WMSetProgressIndicatorMinValue(WMProgressIndicator *progressindicator, int value);
@@ -1368,7 +1375,7 @@ int WMGetProgressIndicatorValue(WMProgressIndicator *progressindicator);
/* ....................................................................... */
WMColorPanel *WMGetColorPanel(WMScreen *scrPtr);
WMColorPanel* WMGetColorPanel(WMScreen *scrPtr);
void WMFreeColorPanel(WMColorPanel *panel);
@@ -1378,7 +1385,7 @@ void WMCloseColorPanel(WMColorPanel *panel);
void WMSetColorPanelColor(WMColorPanel *panel, WMColor *color);
WMColor *WMGetColorPanelColor(WMColorPanel *panel);
WMColor* WMGetColorPanelColor(WMColorPanel *panel);
void WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode);
@@ -1388,11 +1395,11 @@ extern char *WMColorPanelColorChangedNotification;
/* ....................................................................... */
WMColorWell *WMCreateColorWell(WMWidget *parent);
WMColorWell* WMCreateColorWell(WMWidget *parent);
void WMSetColorWellColor(WMColorWell *cPtr, WMColor *color);
WMColor *WMGetColorWellColor(WMColorWell *cPtr);
WMColor* WMGetColorWellColor(WMColorWell *cPtr);
void WSetColorWellBordered(WMColorWell *cPtr, Bool flag);
@@ -1402,7 +1409,7 @@ extern char *WMColorWellDidChangeNotification;
/* ...................................................................... */
WMScrollView *WMCreateScrollView(WMWidget *parent);
WMScrollView* WMCreateScrollView(WMWidget *parent);
void WMResizeScrollViewContent(WMScrollView *sPtr, unsigned int width,
unsigned int height);
@@ -1419,9 +1426,9 @@ void WMSetScrollViewContentView(WMScrollView *sPtr, WMView *view);
WMRect WMGetScrollViewVisibleRect(WMScrollView *sPtr);
WMScroller *WMGetScrollViewHorizontalScroller(WMScrollView *sPtr);
WMScroller* WMGetScrollViewHorizontalScroller(WMScrollView *sPtr);
WMScroller *WMGetScrollViewVerticalScroller(WMScrollView *sPtr);
WMScroller* WMGetScrollViewVerticalScroller(WMScrollView *sPtr);
void WMSetScrollViewLineScroll(WMScrollView *sPtr, int amount);
@@ -1429,7 +1436,7 @@ void WMSetScrollViewPageScroll(WMScrollView *sPtr, int amount);
/* ....................................................................... */
WMSlider *WMCreateSlider(WMWidget *parent);
WMSlider* WMCreateSlider(WMWidget *parent);
int WMGetSliderMinValue(WMSlider *slider);
@@ -1454,13 +1461,15 @@ void WMSetSliderImage(WMSlider *sPtr, WMPixmap *pixmap);
/* ....................................................................... */
WMSplitView *WMCreateSplitView(WMWidget *parent);
WMSplitView* WMCreateSplitView(WMWidget *parent);
Bool WMGetSplitViewVertical(WMSplitView *sPtr);
void WMSetSplitViewVertical(WMSplitView *sPtr, Bool flag);
int WMGetSplitViewSubviewsCount(WMSplitView *sPtr); /* ??? remove ??? */
WMView *WMGetSplitViewSubviewAt(WMSplitView *sPtr, int index);
WMView* WMGetSplitViewSubviewAt(WMSplitView *sPtr, int index);
/* remove the first subview == view */
void WMRemoveSplitViewSubview(WMSplitView *sPtr, WMView *view);
@@ -1484,14 +1493,13 @@ int WMGetSplitViewDividerThickness(WMSplitView *sPtr);
/* ...................................................................... */
WMRuler *WMCreateRuler (WMWidget *parent);
WMRuler* WMCreateRuler (WMWidget *parent);
WMRulerMargins *WMGetRulerMargins(WMRuler *rPtr);
WMRulerMargins* WMGetRulerMargins(WMRuler *rPtr);
void WMSetRulerMargins(WMRuler *rPtr, WMRulerMargins margins);
Bool WMIsMarginEqualToMargin(WMRulerMargins *aMargin,
WMRulerMargins *anotherMargin);
Bool WMIsMarginEqualToMargin(WMRulerMargins *aMargin, WMRulerMargins *anotherMargin);
int WMGetGrabbedRulerMargin(WMRuler *rPtr);
@@ -1511,8 +1519,8 @@ void WMSetRulerReleaseAction(WMRuler *rPtr, WMAction *action, void *clientData);
#define WMCreateText(parent) WMCreateTextForDocumentType \
((parent), (NULL), (NULL))
WMText *WMCreateTextForDocumentType(WMWidget *parent,
WMAction *parser, WMAction *writer);
WMText* WMCreateTextForDocumentType(WMWidget *parent, WMAction *parser,
WMAction *writer);
void WMSetTextDelegate(WMText *tPtr, WMTextDelegate *delegate);
@@ -1552,11 +1560,11 @@ int WMGetTextIgnoresNewline(WMText *tPtr);
void WMSetTextDefaultFont(WMText *tPtr, WMFont *font);
WMFont * WMGetTextDefaultFont(WMText *tPtr);
WMFont* WMGetTextDefaultFont(WMText *tPtr);
void WMSetTextDefaultColor(WMText *tPtr, WMColor *color);
WMColor * WMGetTextDefaultColor(WMText *tPtr);
WMColor* WMGetTextDefaultColor(WMText *tPtr);
void WMSetTextRelief(WMText *tPtr, WMReliefType relief);
@@ -1574,24 +1582,24 @@ void WMAppendTextStream(WMText *tPtr, char *text);
((tPtr), (NULL))
/* free the text */
char * WMGetTextStream(WMText *tPtr);
char* WMGetTextStream(WMText *tPtr);
/* free the text */
char * WMGetTextSelectedStream(WMText *tPtr);
char* WMGetTextSelectedStream(WMText *tPtr);
/* destroy the array */
WMArray * WMGetTextObjects(WMText *tPtr);
WMArray* WMGetTextObjects(WMText *tPtr);
/* destroy the array */
WMArray* WMGetTextSelectedObjects(WMText *tPtr);
void WMSetTextSelectionColor(WMText *tPtr, WMColor *color);
WMColor *WMGetTextSelectionColor(WMText *tPtr);
WMColor* WMGetTextSelectionColor(WMText *tPtr);
void WMSetTextSelectionFont(WMText *tPtr, WMFont *font);
WMFont *WMGetTextSelectionFont(WMText *tPtr);
WMFont* WMGetTextSelectionFont(WMText *tPtr);
void WMSetTextSelectionUnderlined(WMText *tPtr, int underlined);
@@ -1607,23 +1615,26 @@ Bool WMReplaceTextSelection(WMText *tPtr, char *replacement);
/* parser related stuff... use only if implementing a new parser */
void *WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w, char *description,
WMColor *color, unsigned short first, unsigned short extraInfo);
void* WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w, char *description,
WMColor *color, unsigned short first,
unsigned short extraInfo);
void *WMCreateTextBlockWithPixmap(WMText *tPtr, WMPixmap *p, char *description,
WMColor *color, unsigned short first, unsigned short extraInfo);
void* WMCreateTextBlockWithPixmap(WMText *tPtr, WMPixmap *p, char *description,
WMColor *color, unsigned short first,
unsigned short extraInfo);
void *WMCreateTextBlockWithText(WMText *tPtr, char *text, WMFont *font,
WMColor *color, unsigned short first, unsigned short length);
void* WMCreateTextBlockWithText(WMText *tPtr, char *text, WMFont *font,
WMColor *color, unsigned short first,
unsigned short length);
void WMSetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int first,
unsigned int kanji, unsigned int underlined, int script,
WMRulerMargins *margins);
unsigned int kanji, unsigned int underlined,
int script, WMRulerMargins *margins);
/* do NOT free the margins */
void WMGetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int *first,
unsigned int *kanji, unsigned int *underlined, int *script,
WMRulerMargins *margins);
unsigned int *kanji, unsigned int *underlined,
int *script, WMRulerMargins *margins);
int WMGetTextInsertType(WMText *tPtr);
@@ -1637,14 +1648,14 @@ void WMPrependTextBlock(WMText *tPtr, void *vtb);
void WMAppendTextBlock(WMText *tPtr, void *vtb);
void *WMRemoveTextBlock(WMText *tPtr);
void* WMRemoveTextBlock(WMText *tPtr);
void WMDestroyTextBlock(WMText *tPtr, void *vtb);
/* ....................................................................... */
WMTabView *WMCreateTabView(WMWidget *parent);
WMTabView* WMCreateTabView(WMWidget *parent);
void WMSetTabViewType(WMTabView *tPtr, WMTabViewType type);
@@ -1658,10 +1669,10 @@ void WMInsertItemInTabView(WMTabView *tPtr, int index, WMTabViewItem *item);
void WMRemoveTabViewItem(WMTabView *tPtr, WMTabViewItem *item);
WMTabViewItem *WMAddTabViewItemWithView(WMTabView *tPtr, WMView *view,
WMTabViewItem* WMAddTabViewItemWithView(WMTabView *tPtr, WMView *view,
int identifier, char *label);
WMTabViewItem *WMTabViewItemAtPoint(WMTabView *tPtr, int x, int y);
WMTabViewItem* WMTabViewItemAtPoint(WMTabView *tPtr, int x, int y);
void WMSelectFirstTabViewItem(WMTabView *tPtr);
@@ -1671,7 +1682,7 @@ void WMSelectNextTabViewItem(WMTabView *tPtr);
void WMSelectPreviousTabViewItem(WMTabView *tPtr);
WMTabViewItem *WMGetSelectedTabViewItem(WMTabView *tPtr);
WMTabViewItem* WMGetSelectedTabViewItem(WMTabView *tPtr);
void WMSelectTabViewItem(WMTabView *tPtr, WMTabViewItem *item);
@@ -1680,24 +1691,24 @@ void WMSelectTabViewItemAtIndex(WMTabView *tPtr, int index);
void WMSetTabViewDelegate(WMTabView *tPtr, WMTabViewDelegate *delegate);
WMTabViewItem *WMCreateTabViewItemWithIdentifier(int identifier);
WMTabViewItem* WMCreateTabViewItemWithIdentifier(int identifier);
int WMGetTabViewItemIdentifier(WMTabViewItem *item);
void WMSetTabViewItemLabel(WMTabViewItem *item, char *label);
char *WMGetTabViewItemLabel(WMTabViewItem *item);
char* WMGetTabViewItemLabel(WMTabViewItem *item);
void WMSetTabViewItemView(WMTabViewItem *item, WMView *view);
WMView *WMGetTabViewItemView(WMTabViewItem *item);
WMView* WMGetTabViewItemView(WMTabViewItem *item);
void WMDestroyTabViewItem(WMTabViewItem *item);
/* ....................................................................... */
WMBox *WMCreateBox(WMWidget *parent);
WMBox* WMCreateBox(WMWidget *parent);
void WMSetBoxBorderWidth(WMBox *box, unsigned width);
@@ -1718,19 +1729,19 @@ int WMRunAlertPanel(WMScreen *app, WMWindow *owner, char *title, char *msg,
char *otherButton);
/* you can free the returned string */
char *WMRunInputPanel(WMScreen *app, WMWindow *owner, char *title, char *msg,
char* WMRunInputPanel(WMScreen *app, WMWindow *owner, char *title, char *msg,
char *defaultText, char *okButton, char *cancelButton);
WMAlertPanel *WMCreateAlertPanel(WMScreen *app, WMWindow *owner, char *title,
WMAlertPanel* WMCreateAlertPanel(WMScreen *app, WMWindow *owner, char *title,
char *msg, char *defaultButton,
char *alternateButton, char *otherButton);
WMInputPanel *WMCreateInputPanel(WMScreen *app, WMWindow *owner, char *title,
WMInputPanel* WMCreateInputPanel(WMScreen *app, WMWindow *owner, char *title,
char *msg, char *defaultText, char *okButton,
char *cancelButton);
WMGenericPanel *WMCreateGenericPanel(WMScreen *scrPtr, WMWindow *owner,
WMGenericPanel* WMCreateGenericPanel(WMScreen *scrPtr, WMWindow *owner,
char *title, char *defaultButton,
char *alternateButton);
@@ -1743,9 +1754,9 @@ void WMDestroyGenericPanel(WMGenericPanel *panel);
/* ....................................................................... */
/* only 1 instance per WMScreen */
WMOpenPanel *WMGetOpenPanel(WMScreen *scrPtr);
WMOpenPanel* WMGetOpenPanel(WMScreen *scrPtr);
WMSavePanel *WMGetSavePanel(WMScreen *scrPtr);
WMSavePanel* WMGetSavePanel(WMScreen *scrPtr);
void WMSetFilePanelCanChooseDirectories(WMFilePanel *panel, Bool flag);
@@ -1756,7 +1767,7 @@ void WMSetFilePanelAutoCompletion(WMFilePanel *panel, Bool flag);
void WMSetFilePanelDirectory(WMFilePanel *panel, char *path);
/* you can free the returned string */
char *WMGetFilePanelFileName(WMFilePanel *panel);
char* WMGetFilePanelFileName(WMFilePanel *panel);
void WMFreeFilePanel(WMFilePanel *panel);
@@ -1765,13 +1776,13 @@ int WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner,
void WMSetFilePanelAccessoryView(WMFilePanel *panel, WMView *view);
WMView *WMGetFilePanelAccessoryView(WMFilePanel *panel);
WMView* WMGetFilePanelAccessoryView(WMFilePanel *panel);
/* ...................................................................... */
/* only 1 instance per WMScreen */
WMFontPanel *WMGetFontPanel(WMScreen *scr);
WMFontPanel* WMGetFontPanel(WMScreen *scr);
void WMShowFontPanel(WMFontPanel *panel);
@@ -1780,9 +1791,9 @@ void WMHideFontPanel(WMFontPanel *panel);
void WMSetFontPanelFont(WMFontPanel *panel, WMFont *font);
/* you can free the returned string */
char *WMGetFontPanelFontName(WMFontPanel *panel);
char* WMGetFontPanelFontName(WMFontPanel *panel);
WMFont *WMGetFontPanelFont(WMFontPanel *panel);
WMFont* WMGetFontPanelFont(WMFontPanel *panel);
#ifdef __cplusplus
}
+2 -1
View File
@@ -136,7 +136,8 @@ typedef struct W_Screen {
W_FocusInfo *focusInfo;
struct W_Pixmap *applicationIcon;
RImage *applicationIconImage; /* image (can have alpha channel) */
struct W_Pixmap *applicationIconPixmap; /* pixmap - no alpha channel */
Window applicationIconWindow;
struct W_Window *windowList; /* list of windows in the app */
+74 -12
View File
@@ -44,20 +44,51 @@ WMSetApplicationIconWindow(WMScreen *scr, Window window)
void
WMSetApplicationIconImage(WMScreen *scr, WMPixmap *icon)
WMSetApplicationIconImage(WMScreen *scr, RImage *image)
{
if (scr->applicationIcon)
WMReleasePixmap(scr->applicationIcon);
WMPixmap *icon;
scr->applicationIcon = WMRetainPixmap(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->pixmap;
hints->icon_mask = icon->mask;
hints->icon_pixmap = (icon!=NULL ? icon->pixmap : None);
hints->icon_mask = (icon!=NULL ? icon->mask : None);
XSetWMHints(scr->display, scr->groupLeader, hints);
XFree(hints);
@@ -66,9 +97,35 @@ WMSetApplicationIconImage(WMScreen *scr, WMPixmap *icon)
WMPixmap*
WMGetApplicationIconImage(WMScreen *scr)
WMGetApplicationIconPixmap(WMScreen *scr)
{
return scr->applicationIcon;
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;
}
@@ -104,12 +161,17 @@ W_InitApplication(WMScreen *scr)
hints->flags = WindowGroupHint;
hints->window_group = leader;
if (scr->applicationIcon) {
/* 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->applicationIcon->pixmap;
if (scr->applicationIcon->mask) {
hints->icon_pixmap = scr->applicationIconPixmap->pixmap;
if (scr->applicationIconPixmap->mask) {
hints->flags |= IconMaskHint;
hints->icon_mask = scr->applicationIcon->mask;
hints->icon_mask = scr->applicationIconPixmap->mask;
}
}
+18 -18
View File
@@ -604,7 +604,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
RDestroyImage(image);
RReleaseImage(image);
if (pixmap)
W_PaintText(W_VIEW(panel->grayBrightnessS), pixmap->pixmap,
@@ -680,7 +680,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
RDestroyImage(image);
RReleaseImage(image);
if (pixmap)
W_PaintText(W_VIEW(panel->rgbRedS), pixmap->pixmap, panel->font12,
@@ -713,7 +713,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
RDestroyImage(image);
RReleaseImage(image);
if (pixmap)
W_PaintText(W_VIEW(panel->rgbGreenS), pixmap->pixmap, panel->font12,
@@ -747,7 +747,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
RDestroyImage(image);
RReleaseImage(image);
if (pixmap)
W_PaintText(W_VIEW(panel->rgbBlueS), pixmap->pixmap, panel->font12,
@@ -807,7 +807,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
RDestroyImage(image);
RReleaseImage(image);
if (pixmap)
W_PaintText(W_VIEW(panel->cmykCyanS), pixmap->pixmap, panel->font12,
@@ -841,7 +841,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
RDestroyImage(image);
RReleaseImage(image);
if (pixmap)
W_PaintText(W_VIEW(panel->cmykMagentaS), pixmap->pixmap, panel->font12,
@@ -875,7 +875,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
RDestroyImage(image);
RReleaseImage(image);
if (pixmap)
W_PaintText(W_VIEW(panel->cmykYellowS), pixmap->pixmap, panel->font12,
@@ -910,7 +910,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
RDestroyImage(image);
RReleaseImage(image);
if (pixmap)
W_PaintText(W_VIEW(panel->cmykBlackS), pixmap->pixmap, panel->font12,
@@ -1175,7 +1175,7 @@ WMFreeColorPanel(WMColorPanel *panel)
XFreePixmap(scr->display, panel->selectionImg);
if (panel->selectionBackImg)
XFreePixmap(scr->display, panel->selectionBackImg);
RDestroyImage(panel->customPaletteImg);
RReleaseImage(panel->customPaletteImg);
/* structs */
if (panel->lastBrowseDir)
@@ -2202,7 +2202,7 @@ wheelRender(W_ColorPanel *panel)
XFreePixmap(scr->display, panel->wheelImg);
RConvertImage(scr->rcontext, image, &panel->wheelImg);
RDestroyImage(image);
RReleaseImage(image);
/* Check if backimage exists. If it doesn't, allocate and fill it */
if (!panel->selectionBackImg) {
@@ -2477,7 +2477,7 @@ wheelUpdateBrightnessGradient(W_ColorPanel *panel, CPColor topColor)
sliderImg = RRenderGradient(16, 153, &(topColor.rgb), &to, RGRD_VERTICAL);
sliderPxmp = WMCreatePixmapFromRImage(WMWidgetScreen(panel->win),
sliderImg, 0);
RDestroyImage(sliderImg);
RReleaseImage(sliderImg);
WMSetSliderImage(panel->wheelBrightnessS, sliderPxmp);
WMReleasePixmap(sliderPxmp);
}
@@ -2823,7 +2823,7 @@ hsbUpdateBrightnessGradient(W_ColorPanel *panel)
sliderImg = RRenderGradient(141, 16, &from, &(to.rgb), RGRD_HORIZONTAL);
sliderPxmp = WMCreatePixmapFromRImage(scr, sliderImg, 0);
RDestroyImage(sliderImg);
RReleaseImage(sliderImg);
if (sliderPxmp)
W_PaintText(W_VIEW(panel->hsbBrightnessS), sliderPxmp->pixmap,
@@ -2858,7 +2858,7 @@ hsbUpdateSaturationGradient(W_ColorPanel *panel)
sliderImg = RRenderGradient(141, 16, &(from.rgb), &(to.rgb),
RGRD_HORIZONTAL);
sliderPxmp = WMCreatePixmapFromRImage(scr, sliderImg, 0);
RDestroyImage(sliderImg);
RReleaseImage(sliderImg);
if (sliderPxmp)
W_PaintText(W_VIEW(panel->hsbSaturationS), sliderPxmp->pixmap,
@@ -2894,7 +2894,7 @@ hsbUpdateHueGradient(W_ColorPanel *panel)
sliderImg = RRenderMultiGradient(141, 16, colors, RGRD_HORIZONTAL);
sliderPxmp = WMCreatePixmapFromRImage(scr, sliderImg, 0);
RDestroyImage(sliderImg);
RReleaseImage(sliderImg);
if (sliderPxmp)
W_PaintText(W_VIEW(panel->hsbHueS), sliderPxmp->pixmap,
@@ -2948,7 +2948,7 @@ customRenderSpectrum(W_ColorPanel *panel)
}
}
if (panel->customPaletteImg) {
RDestroyImage(panel->customPaletteImg);
RReleaseImage(panel->customPaletteImg);
panel->customPaletteImg = NULL;
}
panel->customPaletteImg = spectrum;
@@ -2969,7 +2969,7 @@ customSetPalette(W_ColorPanel *panel)
scaledImg = RScaleImage(panel->customPaletteImg, customPaletteWidth,
customPaletteHeight);
RConvertImage(scr->rcontext, scaledImg, &image);
RDestroyImage(scaledImg);
RReleaseImage(scaledImg);
XCopyArea(scr->display, image, panel->customPaletteContentView->window,
scr->copyGC, 0, 0, customPaletteWidth, customPaletteHeight, 0, 0);
@@ -3195,7 +3195,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
tmpImg = RLoadImage(scr->rcontext, filepath, 0);
if (tmpImg) {
if (panel->customPaletteImg)
RDestroyImage(panel->customPaletteImg);
RReleaseImage(panel->customPaletteImg);
panel->customPaletteImg = tmpImg;
customSetPalette(panel);
@@ -3399,7 +3399,7 @@ customPaletteHistoryCallback(WMWidget *w, void *data)
tmp = RLoadImage(scr->rcontext, filename, 0);
if (tmp) {
if (panel->customPaletteImg) {
RDestroyImage(panel->customPaletteImg);
RReleaseImage(panel->customPaletteImg);
panel->customPaletteImg = NULL;
}
panel->customPaletteImg = tmp;
+8 -1
View File
@@ -179,6 +179,7 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title)
{
WMFilePanel *fPtr;
WMFont *largeFont;
WMPixmap *icon;
fPtr = wmalloc(sizeof(WMFilePanel));
memset(fPtr, 0, sizeof(WMFilePanel));
@@ -197,7 +198,13 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title)
WMResizeWidget(fPtr->iconLabel, 64, 64);
WMMoveWidget(fPtr->iconLabel, 0, 0);
WMSetLabelImagePosition(fPtr->iconLabel, WIPImageOnly);
WMSetLabelImage(fPtr->iconLabel, scrPtr->applicationIcon);
icon = WMGetApplicationIconBlendedPixmap(scrPtr, (RColor*)NULL);
if (icon) {
WMSetLabelImage(fPtr->iconLabel, icon);
WMReleasePixmap(icon);
} else {
WMSetLabelImage(fPtr->iconLabel, scrPtr->applicationIconPixmap);
}
fPtr->titleLabel = WMCreateLabel(fPtr->win);
WMResizeWidget(fPtr->titleLabel, PWIDTH-64, 64);
+19 -19
View File
@@ -419,85 +419,85 @@ loadPixmaps(WMScreen *scr)
tmp = RGetSubImage(image, 0, 0, 24, 24);
RCombineImageWithColor(tmp, &gray);
scr->homeIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* make it have a white background */
tmp = RGetSubImage(image, 0, 0, 24, 24);
RCombineImageWithColor(tmp, &white);
scr->altHomeIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* trash can */
tmp = RGetSubImage(image, 104, 0, 24, 24);
RCombineImageWithColor(tmp, &white);
scr->trashcanIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
tmp = RGetSubImage(image, 104, 0, 24, 24);
RCombineImageWithColor(tmp, &white);
scr->altTrashcanIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* create dir */
tmp = RGetSubImage(image, 104, 24, 24, 24);
RCombineImageWithColor(tmp, &white);
scr->createDirIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
tmp = RGetSubImage(image, 104, 24, 24, 24);
RCombineImageWithColor(tmp, &white);
scr->altCreateDirIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* diskettes */
tmp = RGetSubImage(image, 24, 80, 24, 24);
RCombineImageWithColor(tmp, &white);
scr->disketteIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
tmp = RGetSubImage(image, 24, 80, 24, 24);
RCombineImageWithColor(tmp, &white);
scr->altDisketteIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* unmount */
tmp = RGetSubImage(image, 0, 80, 24, 24);
RCombineImageWithColor(tmp, &white);
scr->unmountIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
tmp = RGetSubImage(image, 0, 80, 24, 24);
RCombineImageWithColor(tmp, &white);
scr->altUnmountIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* Magnifying Glass Icon for ColorPanel */
tmp = RGetSubImage(image, 24, 0, 40, 32);
RCombineImageWithColor(tmp, &gray);
scr->magnifyIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* ColorWheel Icon for ColorPanel */
tmp = RGetSubImage(image, 0, 25, 24, 24);
scr->wheelIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* GrayScale Icon for ColorPanel */
tmp = RGetSubImage(image, 65, 0, 40, 24);
scr->grayIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* RGB Icon for ColorPanel */
tmp = RGetSubImage(image, 25, 33, 40, 24);
scr->rgbIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* CMYK Icon for ColorPanel */
tmp = RGetSubImage(image, 65, 25, 40, 24);
scr->cmykIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* HSB Icon for ColorPanel */
tmp = RGetSubImage(image, 0, 57, 40, 24);
scr->hsbIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* CustomColorPalette Icon for ColorPanel */
tmp = RGetSubImage(image, 81, 57, 40, 24);
scr->customPaletteIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
/* ColorList Icon for ColorPanel */
tmp = RGetSubImage(image, 41, 57, 40, 24);
scr->colorListIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
RDestroyImage(tmp);
RReleaseImage(tmp);
RDestroyImage(image);
RReleaseImage(image);
#if 0
scr->defaultObjectIcon =
+14 -6
View File
@@ -103,6 +103,7 @@ WMCreateAlertPanel(WMScreen *scrPtr, WMWindow *owner,
WMAlertPanel *panel;
int dw=0, aw=0, ow=0, w;
WMBox *hbox;
WMPixmap *icon;
panel = wmalloc(sizeof(WMAlertPanel));
@@ -137,9 +138,12 @@ WMCreateAlertPanel(WMScreen *scrPtr, WMWindow *owner,
WMSetLabelImagePosition(panel->iLbl, WIPImageOnly);
WMMapWidget(panel->iLbl);
WMAddBoxSubview(hbox, WMWidgetView(panel->iLbl), False, True, 64, 0, 10);
if (scrPtr->applicationIcon) {
WMSetLabelImage(panel->iLbl, scrPtr->applicationIcon);
icon = WMGetApplicationIconBlendedPixmap(scrPtr, (RColor*)NULL);
if (icon) {
WMSetLabelImage(panel->iLbl, icon);
WMReleasePixmap(icon);
} else {
WMSetLabelImage(panel->iLbl, scrPtr->applicationIconPixmap);
}
if (title) {
@@ -521,6 +525,7 @@ WMCreateGenericPanel(WMScreen *scrPtr, WMWindow *owner,
WMGenericPanel *panel;
int dw=0, aw=0, w;
WMBox *hbox;
WMPixmap *icon;
panel = wmalloc(sizeof(WMGenericPanel));
@@ -555,9 +560,12 @@ WMCreateGenericPanel(WMScreen *scrPtr, WMWindow *owner,
WMSetLabelImagePosition(panel->iLbl, WIPImageOnly);
WMMapWidget(panel->iLbl);
WMAddBoxSubview(hbox, WMWidgetView(panel->iLbl), False, True, 64, 0, 10);
if (scrPtr->applicationIcon) {
WMSetLabelImage(panel->iLbl, scrPtr->applicationIcon);
icon = WMGetApplicationIconBlendedPixmap(scrPtr, (RColor*)NULL);
if (icon) {
WMSetLabelImage(panel->iLbl, icon);
WMReleasePixmap(icon);
} else {
WMSetLabelImage(panel->iLbl, scrPtr->applicationIconPixmap);
}
if (title) {
+10 -18
View File
@@ -36,10 +36,7 @@ WMCreatePixmap(WMScreen *scrPtr, int width, int height, int depth, Bool masked)
{
WMPixmap *pixPtr;
pixPtr = malloc(sizeof(WMPixmap));
if (!pixPtr) {
return NULL;
}
pixPtr = wmalloc(sizeof(WMPixmap));
pixPtr->screen = scrPtr;
pixPtr->width = width;
pixPtr->height = height;
@@ -65,10 +62,7 @@ WMCreatePixmapFromXPixmaps(WMScreen *scrPtr, Pixmap pixmap, Pixmap mask,
{
WMPixmap *pixPtr;
pixPtr = malloc(sizeof(WMPixmap));
if (!pixPtr) {
return NULL;
}
pixPtr = wmalloc(sizeof(WMPixmap));
pixPtr->screen = scrPtr;
pixPtr->pixmap = pixmap;
pixPtr->mask = mask;
@@ -81,8 +75,6 @@ WMCreatePixmapFromXPixmaps(WMScreen *scrPtr, Pixmap pixmap, Pixmap mask,
}
WMPixmap*
WMCreatePixmapFromFile(WMScreen *scrPtr, char *fileName)
{
@@ -95,7 +87,7 @@ WMCreatePixmapFromFile(WMScreen *scrPtr, char *fileName)
pixPtr = WMCreatePixmapFromRImage(scrPtr, image, 127);
RDestroyImage(image);
RReleaseImage(image);
return pixPtr;
}
@@ -112,10 +104,7 @@ WMCreatePixmapFromRImage(WMScreen *scrPtr, RImage *image, int threshold)
return NULL;
}
pixPtr = malloc(sizeof(WMPixmap));
if (!pixPtr) {
return NULL;
}
pixPtr = wmalloc(sizeof(WMPixmap));
pixPtr->screen = scrPtr;
pixPtr->pixmap = pixmap;
pixPtr->mask = mask;
@@ -135,9 +124,12 @@ WMCreateBlendedPixmapFromRImage(WMScreen *scrPtr, RImage *image, RColor *color)
RImage *copy;
copy = RCloneImage(image);
if (!copy)
return NULL;
RCombineImageWithColor(copy, color);
pixPtr = WMCreatePixmapFromRImage(scrPtr, copy, 0);
RDestroyImage(copy);
RReleaseImage(copy);
return pixPtr;
}
@@ -158,7 +150,7 @@ WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, char *fileName, RColor *color)
pixPtr = WMCreatePixmapFromRImage(scrPtr, image, 0);
RDestroyImage(image);
RReleaseImage(image);
return pixPtr;
}
@@ -176,7 +168,7 @@ WMCreatePixmapFromXPMData(WMScreen *scrPtr, char **data)
pixPtr = WMCreatePixmapFromRImage(scrPtr, image, 127);
RDestroyImage(image);
RReleaseImage(image);
return pixPtr;
}
+1 -1
View File
@@ -563,7 +563,7 @@ WMSetWindowDocumentEdited(WMWindow *win, Bool flag)
void
WMSetWindowMiniwindowImage(WMWindow *win, WMPixmap *pixmap)
WMSetWindowMiniwindowPixmap(WMWindow *win, WMPixmap *pixmap)
{
if ((win->miniImage && !pixmap) || (!win->miniImage && pixmap)) {
if (win->miniImage)
+7 -7
View File
@@ -618,12 +618,12 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
grad = RRenderGradient(width, height, &rcolor, &rcolor2, style);
image = RMakeTiledImage(timage, width, height);
RDestroyImage(timage);
RReleaseImage(timage);
i = atoi(PLGetString(PLGetArrayElement(texture, 2)));
RCombineImagesWithOpaqueness(image, grad, i);
RDestroyImage(grad);
RReleaseImage(grad);
}
} else if (strcasecmp(&type[2], "gradient")==0 && toupper(type[0])=='M') {
int style;
@@ -681,18 +681,18 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
switch (toupper(type[0])) {
case 'T':
image = RMakeTiledImage(timage, width, height);
RDestroyImage(timage);
RReleaseImage(timage);
timage = image;
break;
case 'C':
image = RMakeCenteredImage(timage, width, height, &color);
RDestroyImage(timage);
RReleaseImage(timage);
timage = image;
break;
case 'S':
case 'M':
image = RScaleImage(timage, width, height);
RDestroyImage(timage);
RReleaseImage(timage);
timage = image;
break;
}
@@ -720,7 +720,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
}
RConvertImage(rc, image, &pixmap);
RDestroyImage(image);
RReleaseImage(image);
return pixmap;
}
@@ -1363,7 +1363,7 @@ loadRImage(WMScreen *scr, char *path)
fclose(f);
RConvertImage(WMScreenRContext(scr), image, &pixmap);
RDestroyImage(image);
RReleaseImage(image);
return pixmap;
}
+5 -5
View File
@@ -163,7 +163,7 @@ createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127)))
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
}
RDestroyImage(icon);
RReleaseImage(icon);
wfree(path);
}
@@ -287,7 +287,7 @@ createPanel(Panel *p)
scaled = RScaleImage(image, 61, 61);
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
RDestroyImage(scaled);
RReleaseImage(scaled);
if (icon) {
WMSetButtonImage(panel->smoB, icon);
WMReleasePixmap(icon);
@@ -295,13 +295,13 @@ createPanel(Panel *p)
scaled = RSmoothScaleImage(image, 61, 61);
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
RDestroyImage(scaled);
RReleaseImage(scaled);
if (icon) {
WMSetButtonAltImage(panel->smoB, icon);
WMReleasePixmap(icon);
}
RDestroyImage(image);
RReleaseImage(image);
}
WMMapSubwidgets(panel->smoF);
@@ -471,7 +471,7 @@ createPanel(Panel *p)
WMMapSubwidgets(panel->box);
if (xis)
RDestroyImage(xis);
RReleaseImage(xis);
WMReleaseFont(font);
showData(panel);
+12 -12
View File
@@ -173,21 +173,21 @@ updateGradButtons(TexturePanel *panel)
image = RRenderMultiGradient(80, 30, colors, RHorizontalGradient);
pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL),
image, 128);
RDestroyImage(image);
RReleaseImage(image);
WMSetButtonImage(panel->dirhB, pixmap);
WMReleasePixmap(pixmap);
image = RRenderMultiGradient(80, 30, colors, RVerticalGradient);
pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL),
image, 128);
RDestroyImage(image);
RReleaseImage(image);
WMSetButtonImage(panel->dirvB, pixmap);
WMReleasePixmap(pixmap);
image = RRenderMultiGradient(80, 30, colors, RDiagonalGradient);
pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL),
image, 128);
RDestroyImage(image);
RReleaseImage(image);
WMSetButtonImage(panel->dirdB, pixmap);
WMReleasePixmap(pixmap);
@@ -238,14 +238,14 @@ updateTGradImage(TexturePanel *panel)
RCombineImagesWithOpaqueness(image, gradient,
WMGetSliderValue(panel->topaS));
RDestroyImage(gradient);
RReleaseImage(gradient);
pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->win),
image, 128);
WMSetLabelImage(panel->imageL, pixmap);
WMReleasePixmap(pixmap);
WMResizeWidget(panel->imageL, image->width, image->height);
RDestroyImage(image);
RReleaseImage(image);
}
@@ -271,21 +271,21 @@ updateSGradButtons(TexturePanel *panel)
image = RRenderGradient(80, 30, &from, &to, RHorizontalGradient);
pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL),
image, 128);
RDestroyImage(image);
RReleaseImage(image);
WMSetButtonImage(panel->dirhB, pixmap);
WMReleasePixmap(pixmap);
image = RRenderGradient(80, 30, &from, &to, RVerticalGradient);
pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL),
image, 128);
RDestroyImage(image);
RReleaseImage(image);
WMSetButtonImage(panel->dirvB, pixmap);
WMReleasePixmap(pixmap);
image = RRenderGradient(80, 30, &from, &to, RDiagonalGradient);
pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->gcolL),
image, 128);
RDestroyImage(image);
RReleaseImage(image);
WMSetButtonImage(panel->dirdB, pixmap);
WMReleasePixmap(pixmap);
}
@@ -316,7 +316,7 @@ updateSVSlider(WMSlider *sPtr, Bool saturation, WMFont *font, RHSVColor *hsv)
}
image = RRenderGradient(130, 16, &from, &to, RHorizontalGradient);
pixmap = WMCreatePixmapFromRImage(scr, image, 128);
RDestroyImage(image);
RReleaseImage(image);
if (hsv->value < 128 || !saturation) {
WMColor *col = WMWhiteColor(scr);
@@ -358,7 +358,7 @@ updateHueSlider(WMSlider *sPtr, WMFont *font, RHSVColor *hsv)
image = RRenderMultiGradient(130, 16, colors, RGRD_HORIZONTAL);
pixmap = WMCreatePixmapFromRImage(scr, image, 128);
RDestroyImage(image);
RReleaseImage(image);
if (hsv->value < 128) {
WMColor *col = WMWhiteColor(scr);
@@ -442,7 +442,7 @@ sliderChangeCallback(WMWidget *w, void *data)
image = RRenderMultiGradient(30, i*WMGetListItemHeight(panel->gcolL),
colors, RVerticalGradient);
RConvertImage(WMScreenRContext(scr), image, &panel->gimage);
RDestroyImage(image);
RReleaseImage(image);
wfree(colors);
@@ -616,7 +616,7 @@ updateImage(TexturePanel *panel, char *path)
WMSetButtonEnabled(panel->okB, True);
if (panel->image)
RDestroyImage(panel->image);
RReleaseImage(panel->image);
panel->image = image;
} else {
image = panel->image;
+3 -3
View File
@@ -261,7 +261,7 @@ createMainWindow(WMScreen *scr)
WMSetWindowMaxSize(WPrefs.win, 520, 390);
WMSetWindowMinSize(WPrefs.win, 520, 390);
WMSetWindowMiniwindowTitle(WPrefs.win, "Preferences");
WMSetWindowMiniwindowImage(WPrefs.win, WMGetApplicationIconImage(scr));
WMSetWindowMiniwindowPixmap(WPrefs.win, WMGetApplicationIconPixmap(scr));
WPrefs.scrollV = WMCreateScrollView(WPrefs.win);
WMResizeWidget(WPrefs.scrollV, 500, 87);
@@ -670,9 +670,9 @@ Initialize(WMScreen *scr)
RMessageForError(RErrorCode));
} else {
icon = WMCreatePixmapFromRImage(scr, tmp, 0);
RDestroyImage(tmp);
RReleaseImage(tmp);
if (icon) {
WMSetApplicationIconImage(scr, icon);
WMSetApplicationIconPixmap(scr, icon);
WMReleasePixmap(icon);
}
}
+2 -2
View File
@@ -110,7 +110,7 @@ createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
*icon2 = NULL;
}
}
RDestroyImage(icon);
RReleaseImage(icon);
}
@@ -328,7 +328,7 @@ createPanel(Panel *p)
WMMapSubwidgets(panel->dockF);
if (xis)
RDestroyImage(xis);
RReleaseImage(xis);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
+52 -1
View File
@@ -22,6 +22,57 @@
* $Id$
*
* $Log$
* Revision 1.2 2001/04/21 07:12:30 dan
* 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.
*
* Revision 1.1 2000/12/03 18:58:41 id
* initiate plugins branch
*
@@ -92,7 +143,7 @@ RImage *fade (int argc, char **argv, int width, int height, int relief) {
this = (int *) malloc (width * sizeof (int));
last = (int *) malloc (width * sizeof (int));
if (!this || !last) {
RDestroyImage (image);
RReleaseImage (image);
free (this);
free (last);
return (RImage *)0;
+21 -5
View File
@@ -1122,8 +1122,24 @@ wDefaultsCheckDomains(void *foo)
WDWindowAttributes->dictionary = dict;
for (i=0; i<wScreenCount; i++) {
scr = wScreenWithNumber(i);
if (scr)
if (scr) {
RImage *image;
wDefaultUpdateIcons(scr);
/* Update the panel image if changed */
/* Don't worry. If the image is the same these
* functions will have no performance impact. */
image = wDefaultGetImage(scr, "Logo", "WMPanel");
if (!image) {
wwarning(_("could not load logo image for panels: %s"),
RMessageForError(RErrorCode));
} else {
WMSetApplicationIconImage(scr->wmscreen, image);
RReleaseImage(image);
}
}
}
}
} else {
@@ -2431,7 +2447,7 @@ getRImages(WScreen *scr, WDefaultEntry *entry, proplist_t value,
}
if (*(RImage**)addr) {
RDestroyImage(*(RImage**)addr);
RReleaseImage(*(RImage**)addr);
}
if (addr)
*(RImage**)addr = image;
@@ -2787,7 +2803,7 @@ setIconTile(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
if (scr->icon_tile) {
reset = 1;
RDestroyImage(scr->icon_tile);
RReleaseImage(scr->icon_tile);
XFreePixmap(dpy, scr->icon_tile_pixmap);
}
@@ -2800,7 +2816,7 @@ setIconTile(WScreen *scr, WDefaultEntry *entry, WTexture **texture, void *foo)
if (!wPreferences.flags.noclip) {
if (scr->clip_tile) {
RDestroyImage(scr->clip_tile);
RReleaseImage(scr->clip_tile);
}
scr->clip_tile = wClipMakeTile(scr, img);
}
@@ -2969,7 +2985,7 @@ setClipTitleColor(WScreen *scr, WDefaultEntry *entry, XColor *color, long index)
image = RRenderGradient(as+1, as+1, &color1, &color2, RDiagonalGradient);
RConvertImage(scr->rcontext, image, &scr->clip_arrow_gradient);
RDestroyImage(image);
RReleaseImage(image);
}
#endif /* GRADIENT_CLIP_ARROW */
+38 -48
View File
@@ -364,12 +364,13 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text,
IconPanel *panel = WMGetHangedData(lPtr);
GC gc = panel->scr->draw_gc;
GC copygc = panel->scr->copy_gc;
char *buffer, *dirfile;
char *file, *dirfile;
WMPixmap *pixmap;
WMColor *blackcolor;
WMColor *whitecolor;
WMSize size;
WMScreen *wmscr=WMWidgetScreen(panel->win);
WMScreen *wmscr = WMWidgetScreen(panel->win);
RColor gray;
int width;
if(!panel->preview) return;
@@ -380,12 +381,15 @@ drawIconProc(WMList *lPtr, int index, Drawable d, char *text,
whitecolor = WMWhiteColor(wmscr);
dirfile = wexpandpath(WMGetListSelectedItem(panel->dirList)->text);
buffer = wmalloc(strlen(dirfile)+strlen(text)+4);
sprintf(buffer, "%s/%s", dirfile, text);
file = wmalloc(strlen(dirfile)+strlen(text)+4);
sprintf(file, "%s/%s", dirfile, text);
wfree(dirfile);
pixmap = WMCreatePixmapFromFile(WMWidgetScreen(panel->win), buffer);
wfree(buffer);
gray.red = 0xae; gray.green = 0xaa;
gray.blue = 0xae; gray.alpha = 0;
pixmap = WMCreateBlendedPixmapFromFile(wmscr, file, &gray);
wfree(file);
if (!pixmap) {
WMRemoveListItem(lPtr, index);
return;
@@ -812,10 +816,10 @@ destroyInfoPanel(WCoreWindow *foo, void *data, XEvent *event)
WMReleaseFont(thePanel->oldFont);
}
if (thePanel->icon) {
RDestroyImage(thePanel->icon);
RReleaseImage(thePanel->icon);
}
if (thePanel->pic) {
RDestroyImage(thePanel->pic);
RReleaseImage(thePanel->pic);
}
#endif /* SILLYNESS */
WMUnmapWidget(thePanel);
@@ -916,11 +920,15 @@ XChangeKeyboardControl(dpy,KBBellPitch|KBBellDuration|KBBellPercent,&kc);
} else if (panel->cycle < 30) {
RImage *image;
WMPixmap *pix;
RColor gray;
gray.red = 0xae; gray.green = 0xaa;
gray.blue = 0xae; gray.alpha = 0;
image = RScaleImage(panel->icon, panel->pic->width, panel->pic->height);
RCombineImagesWithOpaqueness(image, panel->pic, panel->cycle*255/30);
pix = WMCreatePixmapFromRImage(panel->scr->wmscreen, image, 128);
RDestroyImage(image);
pix = WMCreateBlendedPixmapFromRImage(panel->scr->wmscreen, image, &gray);
RReleaseImage(image);
WMSetLabelImage(panel->logoL, pix);
WMReleasePixmap(pix);
}
@@ -1080,53 +1088,32 @@ handleLogoPush(XEvent *event, void *data)
if (!panel->timer && !broken && clicks > 0) {
WMFont *font;
char *file;
char *path;
panel->x = 0;
clicks = 0;
if (!panel->icon) {
file = wDefaultGetIconFile(panel->scr, "Logo", "WMPanel", False);
if (!file) {
broken = 1;
return;
}
path = FindImage(wPreferences.icon_path, file);
if (!path) {
broken = 1;
return;
}
panel->icon = RLoadImage(panel->scr->rcontext, path, 0);
wfree(path);
panel->icon = WMGetApplicationIconImage(panel->scr->wmscreen);
if (!panel->icon) {
broken = 1;
return;
} else {
RColor color;
color.red = 0xae; color.green = 0xaa;
color.blue = 0xae; color.alpha = 0;
panel->icon = RCloneImage(panel->icon);
RCombineImageWithColor(panel->icon, &color);
}
}
if (!panel->pic) {
panel->pic = RGetImageFromXPMData(panel->scr->rcontext, pic_data);
if (!panel->pic) {
broken = 1;
RDestroyImage(panel->icon);
RReleaseImage(panel->icon);
panel->icon = NULL;
if (panel->pic) {
RDestroyImage(panel->pic);
panel->pic = NULL;
}
return;
}
{
RColor color;
color.red = 0xae;
color.green = 0xaa;
color.blue = 0xae;
color.alpha = 255;
RCombineImageWithColor(panel->icon, &color);
RCombineImageWithColor(panel->pic, &color);
}
}
panel->str = msgs[rand()%(sizeof(msgs)/sizeof(char*))];
@@ -1215,7 +1202,10 @@ wShowInfoPanel(WScreen *scr)
panel->win = WMCreateWindow(scr->wmscreen, "info");
WMResizeWidget(panel->win, 382, 230);
logo = WMGetApplicationIconImage(scr->wmscreen);
logo = WMGetApplicationIconBlendedPixmap(scr->wmscreen, (RColor*)NULL);
if (!logo) {
logo = WMRetainPixmap(WMGetApplicationIconPixmap(scr->wmscreen));
}
if (logo) {
size = WMGetPixmapSize(logo);
panel->logoL = WMCreateLabel(panel->win);
@@ -1227,6 +1217,7 @@ wShowInfoPanel(WScreen *scr)
WMCreateEventHandler(WMWidgetView(panel->logoL), ButtonPressMask,
handleLogoPush, panel);
#endif
WMReleasePixmap(logo);
}
panel->name1L = WMCreateLabel(panel->win);
@@ -1605,13 +1596,12 @@ getWindowMakerIconImage(WMScreen *scr)
path = FindImage(wPreferences.icon_path, PLGetString(value));
if (path) {
RImage *image;
RColor gray;
image = RLoadImage(WMScreenRContext(scr), path, 0);
if (image) {
pix = WMCreatePixmapFromRImage(scr, image, 0);
RDestroyImage(image);
}
gray.red = 0xae; gray.green = 0xaa;
gray.blue = 0xae; gray.alpha = 0;
pix = WMCreateBlendedPixmapFromFile(scr, path, &gray);
wfree(path);
}
}
+2 -2
View File
@@ -393,14 +393,14 @@ ShowDockAppSettingsPanel(WAppIcon *aicon)
y = aicon->y_pos;
if (y < 0)
y = 0;
else if (y + PWIDTH > scr->scr_height)
else if (y + PHEIGHT > scr->scr_height)
y = scr->scr_height - PHEIGHT - 30;
if (aicon->dock && aicon->dock->type == WM_DOCK) {
if (aicon->dock->on_right_side)
x = scr->scr_width/2;
else
x = scr->scr_width/2 - PWIDTH;
x = scr->scr_width/2 - PWIDTH - 2;
} else {
x = (scr->scr_width - PWIDTH)/2;
}
+6 -6
View File
@@ -673,7 +673,7 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
}
x += limg->width;
w -= limg->width;
RDestroyImage(limg);
RReleaseImage(limg);
}
#ifdef XKB_BUTTON_HINT
@@ -684,7 +684,7 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
}
x += timg->width;
w -= timg->width;
RDestroyImage(timg);
RReleaseImage(timg);
}
#endif
@@ -699,7 +699,7 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
w -= rimg->width;
RDestroyImage(rimg);
RReleaseImage(rimg);
}
if (w!=width) {
@@ -709,7 +709,7 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
if (!RConvertImage(scr->rcontext, mimg, title)) {
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
RDestroyImage(mimg);
RReleaseImage(mimg);
} else {
RBevelImage(img, RBEV_RAISED2);
@@ -725,7 +725,7 @@ renderTexture(WScreen *scr, WTexture *texture, int width, int height,
}
}
RDestroyImage(img);
RReleaseImage(img);
}
@@ -777,7 +777,7 @@ renderResizebarTexture(WScreen *scr, WTexture *texture, int width, int height,
wwarning(_("error rendering image: %s"), RMessageForError(RErrorCode));
}
RDestroyImage(img);
RReleaseImage(img);
}
+7 -7
View File
@@ -279,7 +279,7 @@ wIconDestroy(WIcon *icon)
wfree(icon->file);
if (icon->image!=NULL)
RDestroyImage(icon->image);
RReleaseImage(icon->image);
wCoreDestroy(icon->core);
wfree(icon);
@@ -349,7 +349,7 @@ makeIcon(WScreen *scr, RImage *icon, int titled, int shadowed, int tileType)
if (!RConvertImage(scr->rcontext, tile, &pixmap)) {
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
RDestroyImage(tile);
RReleaseImage(tile);
if (titled)
drawIconTitle(scr, pixmap, theight);
@@ -383,7 +383,7 @@ wIconChangeImage(WIcon *icon, RImage *new_image)
assert(icon != NULL);
if (icon->image)
RDestroyImage(icon->image);
RReleaseImage(icon->image);
icon->image = wIconValidateIconSize(icon->core->screen_ptr, new_image);
@@ -405,7 +405,7 @@ wIconValidateIconSize(WScreen *scr, RImage *icon)
h = wPreferences.icon_size * icon->height / 64;
tmp = RScaleImage(icon, w, h);
RDestroyImage(icon);
RReleaseImage(icon);
icon = tmp;
}
#endif
@@ -420,7 +420,7 @@ wIconValidateIconSize(WScreen *scr, RImage *icon)
w = h*icon->width/icon->height;
}
tmp = RScaleImage(icon, w, h);
RDestroyImage(icon);
RReleaseImage(icon);
icon = tmp;
}
#endif
@@ -547,7 +547,7 @@ wIconStore(WIcon *icon)
wfree(path);
path = NULL;
}
RDestroyImage(image);
RReleaseImage(image);
return path;
}
@@ -780,7 +780,7 @@ wIconUpdate(WIcon *icon)
scr->def_ticon_pixmap = makeIcon(scr, image, True, False,
icon->tile_type);
if (image)
RDestroyImage(image);
RReleaseImage(image);
}
if (icon->show_title) {
+1 -1
View File
@@ -484,7 +484,7 @@ renderTexture(WMenu *menu)
if (!RConvertImage(scr->rcontext, img, &pix)) {
wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode));
}
RDestroyImage(img);
RReleaseImage(img);
return pix;
}
+1 -1
View File
@@ -65,7 +65,7 @@ wPixmapCreateFromXPMData(WScreen *scr, char **data)
pix->height = image->height;
pix->depth = scr->w_depth;
RDestroyImage(image);
RReleaseImage(image);
return pix;
}
+2 -12
View File
@@ -402,9 +402,7 @@ static void
createPixmaps(WScreen *scr)
{
WPixmap *pix;
WMPixmap *wmpix;
RImage *image;
Pixmap p, m;
/* load pixmaps */
pix = wPixmapCreateFromXBMData(scr, (char*)MENU_RADIO_INDICATOR_XBM_DATA,
@@ -460,16 +458,8 @@ createPixmaps(WScreen *scr)
wwarning(_("could not load logo image for panels: %s"),
RMessageForError(RErrorCode));
} else {
if (!RConvertImageMask(scr->rcontext, image, &p, &m, 128)) {
wwarning(_("error making logo image for panel:%s"), RMessageForError(RErrorCode));
} else {
wmpix = WMCreatePixmapFromXPixmaps(scr->wmscreen, p, m,
image->width, image->height,
scr->depth);
WMSetApplicationIconImage(scr->wmscreen, wmpix);
WMReleasePixmap(wmpix);
}
RDestroyImage(image);
WMSetApplicationIconImage(scr->wmscreen, image);
RReleaseImage(image);
}
scr->dock_dots = make3Dots(scr);
+10 -10
View File
@@ -107,7 +107,7 @@ DoKaboom(WScreen *scr, Window win, int x, int y)
back = RCreateImageFromXImage(scr->rcontext, ximage, NULL);
XDestroyImage(ximage);
if (!back) {
RDestroyImage(icon);
RReleaseImage(icon);
return;
}
@@ -134,8 +134,8 @@ DoKaboom(WScreen *scr, Window win, int x, int y)
XUngrabServer(dpy);
XFreeGC(dpy, gc);
RDestroyImage(icon);
RDestroyImage(back);
RReleaseImage(icon);
RReleaseImage(back);
}
#endif /* DEMATERIALIZE_ICON */
@@ -346,7 +346,7 @@ MakeGhostDock(WDock *dock, int sx, int dx, int y)
AllPlanes, ZPixmap);
if (!img){
RDestroyImage(back);
RReleaseImage(back);
return None;
}
img->red_mask = red_mask;
@@ -356,20 +356,20 @@ MakeGhostDock(WDock *dock, int sx, int dx, int y)
dock_image = RCreateImageFromXImage(scr->rcontext, img, NULL);
XDestroyImage(img);
if (!dock_image) {
RDestroyImage(back);
RReleaseImage(back);
return None;
}
RCombineAreaWithOpaqueness(back, dock_image, 0, 0,
wPreferences.icon_size, n,
0, j, 30 * 256 / 100);
RDestroyImage(dock_image);
RReleaseImage(dock_image);
}
}
RConvertImage(scr->rcontext, back, &pixmap);
RDestroyImage(back);
RReleaseImage(back);
return pixmap;
}
@@ -398,7 +398,7 @@ MakeGhostIcon(WScreen *scr, Drawable drawable)
RClearImage(back, &color);
RConvertImage(scr->rcontext, back, &pixmap);
RDestroyImage(back);
RReleaseImage(back);
return pixmap;
}
@@ -487,7 +487,7 @@ loadData(WScreen *scr)
goto error;
}
}
RDestroyImage(image);
RReleaseImage(image);
fclose(f);
@@ -499,7 +499,7 @@ loadData(WScreen *scr)
return True;
error:
RDestroyImage(image);
RReleaseImage(image);
fclose(f);
+4 -4
View File
@@ -162,7 +162,7 @@ wTextureDestroy(WScreen *scr, WTexture *texture)
break;
case WTEX_PIXMAP:
RDestroyImage(texture->pixmap.pixmap);
RReleaseImage(texture->pixmap.pixmap);
break;
case WTEX_MHGRADIENT:
@@ -177,7 +177,7 @@ wTextureDestroy(WScreen *scr, WTexture *texture)
case WTEX_THGRADIENT:
case WTEX_TVGRADIENT:
case WTEX_TDGRADIENT:
RDestroyImage(texture->tgradient.pixmap);
RReleaseImage(texture->tgradient.pixmap);
break;
#ifdef TEXTURE_PLUGIN
@@ -556,14 +556,14 @@ wTextureRenderImage(WTexture *texture, int width, int height,
grad = RRenderGradient(width, height, &texture->tgradient.color1,
&texture->tgradient.color2, subtype);
if (!grad) {
RDestroyImage(image);
RReleaseImage(image);
image = NULL;
break;
}
RCombineImagesWithOpaqueness(image, grad,
texture->tgradient.opacity);
RDestroyImage(grad);
RReleaseImage(grad);
}
break;
+1 -1
View File
@@ -431,7 +431,7 @@ wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
#endif /* OLWM_HINTS */
/* window levels are between INT_MIN+1 and INT_MAX, so if we still
* have INT_MIN that means that no window level was requested. --Dan
* have INT_MIN that means that no window level was requested. -Dan
*/
if (tmp_level == INT_MIN) {
if (WFLAGP(wwin, floating))
+7 -7
View File
@@ -253,8 +253,8 @@ hideWorkpaceName(void *data)
XUnmapWindow(dpy, scr->workspace_name);
if (scr->workspace_name_data) {
RDestroyImage(scr->workspace_name_data->back);
RDestroyImage(scr->workspace_name_data->text);
RReleaseImage(scr->workspace_name_data->back);
RReleaseImage(scr->workspace_name_data->text);
wfree(scr->workspace_name_data);
scr->workspace_name_data = NULL;
@@ -273,7 +273,7 @@ hideWorkpaceName(void *data)
RConvertImage(scr->rcontext, img, &pix);
RDestroyImage(img);
RReleaseImage(img);
XSetWindowBackgroundPixmap(dpy, scr->workspace_name, pix);
XClearWindow(dpy, scr->workspace_name);
@@ -311,8 +311,8 @@ showWorkspaceName(WScreen *scr, int workspace)
hideWorkpaceName, scr);
if (scr->workspace_name_data) {
RDestroyImage(scr->workspace_name_data->back);
RDestroyImage(scr->workspace_name_data->text);
RReleaseImage(scr->workspace_name_data->back);
RReleaseImage(scr->workspace_name_data->text);
wfree(scr->workspace_name_data);
}
@@ -428,9 +428,9 @@ erro:
WMDeleteTimerHandler(scr->workspace_name_timer);
if (data->text)
RDestroyImage(data->text);
RReleaseImage(data->text);
if (data->back)
RDestroyImage(data->back);
RReleaseImage(data->back);
wfree(data);
scr->workspace_name_data = NULL;
+20 -20
View File
@@ -235,13 +235,13 @@ parseTexture(RContext *rc, char *text)
if (!RConvertImage(rc, image, &pixmap)) {
wwarning("could not convert texture:%s",
RMessageForError(RErrorCode));
RDestroyImage(image);
RReleaseImage(image);
goto error;
}
texture->width = image->width;
texture->height = image->height;
RDestroyImage(image);
RReleaseImage(image);
texture->pixmap = pixmap;
} else if (strcasecmp(type, "mvgradient")==0
@@ -332,13 +332,13 @@ parseTexture(RContext *rc, char *text)
if (!RConvertImage(rc, image, &pixmap)) {
wwarning("could not convert texture:%s",
RMessageForError(RErrorCode));
RDestroyImage(image);
RReleaseImage(image);
goto error;
}
texture->width = image->width;
texture->height = image->height;
RDestroyImage(image);
RReleaseImage(image);
texture->pixmap = pixmap;
} else if (strcasecmp(type, "cpixmap")==0
@@ -372,7 +372,7 @@ parseTexture(RContext *rc, char *text)
if (!XParseColor(dpy, DefaultColormap(dpy, scr), tmp, &color)) {
wwarning("could not parse color %s in texture %s\n", tmp, text);
RDestroyImage(image);
RReleaseImage(image);
goto error;
}
if (!XAllocColor(dpy, DefaultColormap(dpy, scr), &color)) {
@@ -397,11 +397,11 @@ parseTexture(RContext *rc, char *text)
if (!pixmap && !RConvertImage(rc, image, &pixmap)) {
wwarning("could not convert texture:%s",
RMessageForError(RErrorCode));
RDestroyImage(image);
RReleaseImage(image);
goto error;
}
if (image)
RDestroyImage(image);
RReleaseImage(image);
break;
case 'S':
case 'M':
@@ -427,10 +427,10 @@ parseTexture(RContext *rc, char *text)
if (!simage) {
wwarning("could not scale image:%s",
RMessageForError(RErrorCode));
RDestroyImage(image);
RReleaseImage(image);
goto error;
}
RDestroyImage(image);
RReleaseImage(image);
image = simage;
}
iwidth = image->width;
@@ -444,7 +444,7 @@ parseTexture(RContext *rc, char *text)
if (!pixmap && !RConvertImage(rc, image, &pixmap)) {
wwarning("could not convert texture:%s",
RMessageForError(RErrorCode));
RDestroyImage(image);
RReleaseImage(image);
goto error;
}
@@ -483,7 +483,7 @@ parseTexture(RContext *rc, char *text)
pixmap = cpixmap;
}
if (image)
RDestroyImage(image);
RReleaseImage(image);
texture->width = scrWidth;
texture->height = scrHeight;
@@ -564,8 +564,8 @@ parseTexture(RContext *rc, char *text)
if (!gradient) {
wwarning("could not render texture:%s",
RMessageForError(RErrorCode));
RDestroyImage(gradient);
RDestroyImage(image);
RReleaseImage(gradient);
RReleaseImage(image);
goto error;
}
@@ -573,25 +573,25 @@ parseTexture(RContext *rc, char *text)
if (!tiled) {
wwarning("could not render texture:%s",
RMessageForError(RErrorCode));
RDestroyImage(gradient);
RDestroyImage(image);
RReleaseImage(gradient);
RReleaseImage(image);
goto error;
}
RDestroyImage(image);
RReleaseImage(image);
RCombineImagesWithOpaqueness(tiled, gradient, opaq);
RDestroyImage(gradient);
RReleaseImage(gradient);
if (!RConvertImage(rc, tiled, &pixmap)) {
wwarning("could not convert texture:%s",
RMessageForError(RErrorCode));
RDestroyImage(tiled);
RReleaseImage(tiled);
goto error;
}
texture->width = tiled->width;
texture->height = tiled->height;
RDestroyImage(tiled);
RReleaseImage(tiled);
texture->pixmap = pixmap;
} else if (strcasecmp(type, "function")==0) {
@@ -665,7 +665,7 @@ function_cleanup:
dlclose(handle);
}
if (image) {
RDestroyImage(image);
RReleaseImage(image);
}
if (!success) {
goto error;
+6
View File
@@ -1,3 +1,9 @@
- 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 NEWS
- Fixed crashing for Pseudocolor visuals with BestMatchRendering
- Small speed improvement for 24 and 32 bpp, if internal converter is used
- Small speed improvement for generating gradients.
+1 -1
View File
@@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = no-dependencies
lib_LTLIBRARIES = libwraster.la
libwraster_la_LDFLAGS = -version-info 3:0:1
libwraster_la_LDFLAGS = -version-info 4:0:2
bin_SCRIPTS = get-wraster-flags
+28
View File
@@ -0,0 +1,28 @@
Sat Apr 21 09:12:09 EEST 2001 -Dan
API change
----------
To allow a retain/release mechanism to be implemented for RImages, the
following new functions were introduced:
RImage* RRetainImage(RImage* image);
void RReleaseImage(RImage* image);
RDestroyImage() is now aliased to RReleaseImage(), but because it's no
longer compatible with the new semantics, it was only kept to allow a
smoother transition and the ability to run programs that were not updated
yet.
Do _NOT_ continue to use RDestroyImage(), because it will be removed in a
future version. You should start using RReleaseImage() in your code, and
also update all your existing programs to use RReleaseImage().
Also keep in mind that its name is also misleading: RDestroyImage() no
longer destroys images, unless they are not retained in some other place.
All existing code will continue to function with the new lib, even if not
recompiled, but you are encouraged to update your code to these changes
+1 -1
View File
@@ -250,7 +250,7 @@ REdgeDetectImage(RImage *image)
image2->data[1] = g;
b = image->data[2];
image2->data[2] = b;
RDestroyImage(image2);
RReleaseImage(image2);
}
#undef MASK
+1 -1
View File
@@ -209,7 +209,7 @@ giferr:
}
bye:
if (image)
RDestroyImage(image);
RReleaseImage(image);
image = NULL;
did_not_get_any_errors:
+6 -5
View File
@@ -256,7 +256,7 @@ renderDGradient(unsigned width, unsigned height, int r0, int g0, int b0,
tmp = renderHGradient(2*width-1, 1, r0, g0, b0, rf, gf, bf);
if (!tmp) {
RDestroyImage(image);
RReleaseImage(image);
return NULL;
}
@@ -271,7 +271,7 @@ renderDGradient(unsigned width, unsigned height, int r0, int g0, int b0,
offset += a;
}
RDestroyImage(tmp);
RReleaseImage(tmp);
return image;
}
@@ -472,7 +472,7 @@ renderMDGradient(unsigned width, unsigned height, RColor **colors, int count)
colors[1]->blue<<8);
if (!tmp) {
RDestroyImage(image);
RReleaseImage(image);
return NULL;
}
ptr = tmp->data;
@@ -485,14 +485,15 @@ renderMDGradient(unsigned width, unsigned height, RColor **colors, int count)
memcpy(&(image->data[j]), &ptr[3*(int)offset], width);
offset += a;
}
RDestroyImage(tmp);
RReleaseImage(tmp);
return image;
}
RImage *RRenderInterwovenGradient(unsigned width, unsigned height,
RImage*
RRenderInterwovenGradient(unsigned width, unsigned height,
RColor colors1[2], int thickness1,
RColor colors2[2], int thickness2)
{
+2 -2
View File
@@ -184,7 +184,7 @@ RLoadImage(RContext *context, char *file, int index)
} else {
free(RImageCache[i].file);
RImageCache[i].file = NULL;
RDestroyImage(RImageCache[i].image);
RReleaseImage(RImageCache[i].image);
}
}
}
@@ -264,7 +264,7 @@ RLoadImage(RContext *context, char *file, int index)
/* if no slot available, dump least recently used one */
if (!done) {
free(RImageCache[oldest_idx].file);
RDestroyImage(RImageCache[oldest_idx].image);
RReleaseImage(RImageCache[oldest_idx].image);
RImageCache[oldest_idx].file = malloc(strlen(file)+1);
strcpy(RImageCache[oldest_idx].file, file);
RImageCache[oldest_idx].image = RCloneImage(image);
+3 -3
View File
@@ -223,7 +223,7 @@ RGetImageFromXPMData(RContext *context, char **data)
alloca(0);
#endif
if (image)
RDestroyImage(image);
RReleaseImage(image);
return NULL;
}
@@ -418,7 +418,7 @@ RLoadXPM(RContext *context, char *file, int index)
alloca(0);
#endif
if (image)
RDestroyImage(image);
RReleaseImage(image);
return NULL;
bad_file:
@@ -428,7 +428,7 @@ RLoadXPM(RContext *context, char *file, int index)
alloca(0);
#endif
if (image)
RDestroyImage(image);
RReleaseImage(image);
return NULL;
}
+3 -3
View File
@@ -101,7 +101,7 @@ RLoadPNG(RContext *context, char *file, int index)
fclose(f);
png_destroy_read_struct(&png, &pinfo, &einfo);
if (image)
RDestroyImage(image);
RReleaseImage(image);
return NULL;
}
@@ -177,7 +177,7 @@ RLoadPNG(RContext *context, char *file, int index)
if (!png_rows) {
RErrorCode = RERR_NOMEMORY;
fclose(f);
RDestroyImage(image);
RReleaseImage(image);
png_destroy_read_struct(&png, &pinfo, &einfo);
#ifdef C_ALLOCA
alloca(0);
@@ -189,7 +189,7 @@ RLoadPNG(RContext *context, char *file, int index)
if (!png_rows[y]) {
RErrorCode = RERR_NOMEMORY;
fclose(f);
RDestroyImage(image);
RReleaseImage(image);
png_destroy_read_struct(&png, &pinfo, &einfo);
#ifdef C_ALLOCA
alloca(0);
+39 -10
View File
@@ -55,6 +55,7 @@ RCreateImage(unsigned width, unsigned height, int alpha)
image->width = width;
image->height = height;
image->format = alpha ? RRGBAFormat : RRGBFormat;
image->refCount = 1;
/* the +4 is to give extra bytes at the end of the buffer,
* so that we can optimize image conversion for MMX(tm).. see convert.c
@@ -70,6 +71,44 @@ RCreateImage(unsigned width, unsigned height, int alpha)
}
RImage*
RRetainImage(RImage *image)
{
if (image)
image->refCount++;
return image;
}
void
RReleaseImage(RImage *image)
{
assert(image!=NULL);
image->refCount--;
if (image->refCount < 1) {
free(image->data);
free(image);
}
}
/* Obsoleted function. Use RReleaseImage() instead. This was kept only to
* allow a smoother transition and to avoid breaking existing programs, but
* it will be removed in a future release. Right now is just an alias to
* RReleaseImage(). Do _NOT_ use RDestroyImage() anymore in your programs.
* Being an alias to RReleaseImage() this function no longer actually
* destroys the image, unless the image is no longer retained in some other
* place.
*/
void
RDestroyImage(RImage *image)
{
RReleaseImage(image);
}
RImage*
RCloneImage(RImage *image)
@@ -126,16 +165,6 @@ RGetSubImage(RImage *image, int x, int y, unsigned width, unsigned height)
}
void
RDestroyImage(RImage *image)
{
assert(image!=NULL);
free(image->data);
free(image);
}
/*
*----------------------------------------------------------------------
* RCombineImages-
+6 -3
View File
@@ -37,7 +37,8 @@
static RImage *rotateImage(RImage *image, float angle);
RImage *RRotateImage(RImage *image, float angle)
RImage*
RRotateImage(RImage *image, float angle)
{
RImage *img;
int nwidth, nheight;
@@ -207,7 +208,8 @@ RImage *RRotateImage(RImage *image, float angle)
*/
static void copyLine(int x1, int y1, int x2, int y2, int nwidth, int format,
static void
copyLine(int x1, int y1, int x2, int y2, int nwidth, int format,
unsigned char *dst, unsigned char **src)
{
unsigned char *s = *src;
@@ -283,7 +285,8 @@ static void copyLine(int x1, int y1, int x2, int y2, int nwidth, int format,
}
static RImage *rotateImage(RImage *image, float angle)
static RImage*
rotateImage(RImage *image, float angle)
{
RImage *img;
int nwidth, nheight;
+1 -1
View File
@@ -617,7 +617,7 @@ RSmoothScaleImage(RImage *src, unsigned new_width, unsigned new_height)
}
free(contrib);
RDestroyImage(tmp);
RReleaseImage(tmp);
return dst;
}
+16 -16
View File
@@ -67,7 +67,7 @@ testDraw()
exit(1);
}
RCombineArea(img, icon, 0, 0, icon->width, icon->height, 8, 8);
RDestroyImage(icon);
RReleaseImage(icon);
tmp = img;
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 64, 0);
@@ -88,7 +88,7 @@ testDraw()
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 0, 64);
RDestroyImage(img);
RReleaseImage(img);
img = RCloneImage(tile);
/* Alter random pixels in image with the same amount for r/g/b */
@@ -103,7 +103,7 @@ testDraw()
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 64, 64);
RDestroyImage(img);
RReleaseImage(img);
img = RCloneImage(tile);
/* Draw lines in all directions to test different slopes */
@@ -133,7 +133,7 @@ testDraw()
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 0, 128);
RDestroyImage(img);
RReleaseImage(img);
img = RCloneImage(tile);
/* Alter lines in all directions (test different slopes) */
@@ -144,7 +144,7 @@ testDraw()
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 64, 128);
RDestroyImage(img);
RReleaseImage(img);
/* Create a bevel around the icon, and save it for a later use */
img = tmp;
@@ -156,7 +156,7 @@ testDraw()
cdelta.alpha = 0;
ROperateLine(img, RSubtractOperation, 8, 56, 56, 56, &cdelta);
ROperateLine(img, RSubtractOperation, 56, 8, 56, 55, &cdelta);
RDestroyImage(tile);
RReleaseImage(tile);
tmp = RCloneImage(img);
/* Draw some solid lines over the icon */
@@ -177,7 +177,7 @@ testDraw()
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 0, 192);
RDestroyImage(img);
RReleaseImage(img);
/* Restore the image with the icon, and alter some lines */
img = tmp;
@@ -247,7 +247,7 @@ testBevel()
RClearImage(img, &color);
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 140, 140, 0, 0);
RDestroyImage(img);
RReleaseImage(img);
tile = RRenderGradient(64, 64, &from, &to, RGRD_DIAGONAL);
@@ -255,25 +255,25 @@ testBevel()
RBevelImage(img, RBEV_SUNKEN);
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 3, 3);
RDestroyImage(img);
RReleaseImage(img);
img = RCloneImage(tile);
RBevelImage(img, RBEV_RAISED);
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 73, 3);
RDestroyImage(img);
RReleaseImage(img);
img = RCloneImage(tile);
RBevelImage(img, RBEV_RAISED2);
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 3, 73);
RDestroyImage(img);
RReleaseImage(img);
img = RCloneImage(tile);
RBevelImage(img, RBEV_RAISED3);
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 73, 73);
RDestroyImage(img);
RReleaseImage(img);
XSetWindowBackgroundPixmap(dpy, win, back);
XMapRaised(dpy, win);
@@ -306,7 +306,7 @@ void testScale()
scaled = RScaleImage(image, 140, 140);
RDestroyImage(image);
RReleaseImage(image);
RConvertImage(ctx, scaled, &pix);
XSetWindowBackgroundPixmap(dpy, win, pix);
XMapRaised(dpy, win);
@@ -345,7 +345,7 @@ void testRotate()
rotated = RRotateImage(image, 90.0);
RDestroyImage(image);
RReleaseImage(image);
RConvertImage(ctx, rotated, &pix);
XSetWindowBackgroundPixmap(dpy, win, pix);
XMapRaised(dpy, win);
@@ -478,7 +478,7 @@ drawClip()
RConvertImage(ctx, img, &pix);
XCopyArea(dpy, pix, back, ctx->copy_gc, 0, 0, 64, 64, 0, 0);
RDestroyImage(img);
RReleaseImage(img);
XSetWindowBackgroundPixmap(dpy, win, back);
XMapRaised(dpy, win);
@@ -576,7 +576,7 @@ benchmark()
}
printf("Average: %f, %f, %f\n", d1/5, d2/5, d3/5);
RDestroyImage(img);
RReleaseImage(img);
}
+1 -1
View File
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
puts(RMessageForError(RErrorCode));
exit(1);
}
RDestroyImage(tmp);
RReleaseImage(tmp);
XSetWindowBackgroundPixmap(dpy, win, pix);
XFreePixmap(dpy, pix);
+1 -1
View File
@@ -42,7 +42,7 @@ main(int argc, char **argv)
img = RSmoothScaleImage(tmp, tmp->width*atol(argv[2]),
tmp->height*atol(argv[2]));
RDestroyImage(tmp);
RReleaseImage(tmp);
}
*/
#if 0
+12
View File
@@ -195,6 +195,7 @@ typedef struct RImage {
int width, height; /* size of the image */
enum RImageFormat format;
RColor background; /* background color */
int refCount;
} RImage;
@@ -322,7 +323,18 @@ RImage *RCreateImageFromDrawable(RContext *context, Drawable drawable,
RImage *RLoadImage(RContext *context, char *file, int index);
RImage* RRetainImage(RImage *image);
void RReleaseImage(RImage *image);
/* Obsoleted function. Use RReleaseImage() instead. This was kept only to
* allow a smoother transition and to avoid breaking existing programs, but
* it will be removed in a future release. Right now is just an alias to
* RReleaseImage(). Do _NOT_ use RDestroyImage() anymore in your programs.
* Being an alias to RReleaseImage() this function no longer actually
* destroys the image, unless the image is no longer retained in some other
* place.
*/
void RDestroyImage(RImage *image);
RImage *RGetImageFromXPMData(RContext *context, char **xpmData);
+2 -2
View File
@@ -87,7 +87,7 @@ RGetImageFromXPMData(RContext *context, char **xpmData)
if (color_table[i])
free(color_table[i]);
}
RDestroyImage(image);
RReleaseImage(image);
RErrorCode = RERR_NOMEMORY;
XpmFreeXpmImage(&xpm);
return NULL;
@@ -210,7 +210,7 @@ RLoadXPM(RContext *context, char *file, int index)
if (color_table[i])
free(color_table[i]);
}
RDestroyImage(image);
RReleaseImage(image);
RErrorCode = RERR_NOMEMORY;
XpmFreeXpmImage(&xpm);
return NULL;