mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-23 22:52:34 +01:00
WindowMaker: New function wIconCreateCore()
The new function wIconCreateCore do the common work to create a WIcon. This code was before in wIconCreateWithIconFile() and wIconCreateWithIconFile().
This commit is contained in:
committed by
Carlos R. Mafra
parent
219315aa58
commit
21fb6db616
99
src/icon.c
99
src/icon.c
@@ -56,6 +56,8 @@ static void miniwindowExpose(WObjDescriptor * desc, XEvent * event);
|
|||||||
static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event);
|
static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event);
|
||||||
static void miniwindowDblClick(WObjDescriptor * desc, XEvent * event);
|
static void miniwindowDblClick(WObjDescriptor * desc, XEvent * event);
|
||||||
|
|
||||||
|
static WIcon *wIconCreateCore(WScreen *scr, int coord_x, int coord_y);
|
||||||
|
|
||||||
void get_pixmap_icon_from_icon_win(WIcon *icon);
|
void get_pixmap_icon_from_icon_win(WIcon *icon);
|
||||||
int get_pixmap_icon_from_wm_hints(WScreen *scr, WWindow *wwin, WIcon *icon);
|
int get_pixmap_icon_from_wm_hints(WScreen *scr, WWindow *wwin, WIcon *icon);
|
||||||
void get_pixmap_icon_from_user_icon(WScreen *scr, WIcon * icon);
|
void get_pixmap_icon_from_user_icon(WScreen *scr, WIcon * icon);
|
||||||
@@ -110,35 +112,8 @@ WIcon *wIconCreate(WWindow * wwin)
|
|||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
WIcon *icon;
|
WIcon *icon;
|
||||||
char *file;
|
char *file;
|
||||||
unsigned long vmask = 0;
|
|
||||||
XSetWindowAttributes attribs;
|
|
||||||
|
|
||||||
icon = wmalloc(sizeof(WIcon));
|
icon = wIconCreateCore(scr, wwin->icon_x, wwin->icon_y);
|
||||||
memset(icon, 0, sizeof(WIcon));
|
|
||||||
icon->core = wCoreCreateTopLevel(scr, wwin->icon_x, wwin->icon_y,
|
|
||||||
wPreferences.icon_size, wPreferences.icon_size, 0);
|
|
||||||
|
|
||||||
if (wPreferences.use_saveunders) {
|
|
||||||
vmask |= CWSaveUnder;
|
|
||||||
attribs.save_under = True;
|
|
||||||
}
|
|
||||||
/* a white border for selecting it */
|
|
||||||
vmask |= CWBorderPixel;
|
|
||||||
attribs.border_pixel = scr->white_pixel;
|
|
||||||
|
|
||||||
XChangeWindowAttributes(dpy, icon->core->window, vmask, &attribs);
|
|
||||||
|
|
||||||
/* will be overriden if this is an application icon */
|
|
||||||
icon->core->descriptor.handle_mousedown = miniwindowMouseDown;
|
|
||||||
icon->core->descriptor.handle_expose = miniwindowExpose;
|
|
||||||
icon->core->descriptor.parent_type = WCLASS_MINIWINDOW;
|
|
||||||
icon->core->descriptor.parent = icon;
|
|
||||||
|
|
||||||
icon->core->stacking = wmalloc(sizeof(WStacking));
|
|
||||||
icon->core->stacking->above = NULL;
|
|
||||||
icon->core->stacking->under = NULL;
|
|
||||||
icon->core->stacking->window_level = NORMAL_ICON_LEVEL;
|
|
||||||
icon->core->stacking->child_of = NULL;
|
|
||||||
|
|
||||||
icon->owner = wwin;
|
icon->owner = wwin;
|
||||||
if (wwin->wm_hints && (wwin->wm_hints->flags & IconWindowHint)) {
|
if (wwin->wm_hints && (wwin->wm_hints->flags & IconWindowHint)) {
|
||||||
@@ -183,33 +158,8 @@ WIcon *wIconCreate(WWindow * wwin)
|
|||||||
WIcon *wIconCreateWithIconFile(WScreen * scr, char *iconfile, int tile)
|
WIcon *wIconCreateWithIconFile(WScreen * scr, char *iconfile, int tile)
|
||||||
{
|
{
|
||||||
WIcon *icon;
|
WIcon *icon;
|
||||||
unsigned long vmask = 0;
|
|
||||||
XSetWindowAttributes attribs;
|
|
||||||
|
|
||||||
icon = wmalloc(sizeof(WIcon));
|
icon = wIconCreateCore(scr, 0, 0);
|
||||||
memset(icon, 0, sizeof(WIcon));
|
|
||||||
icon->core = wCoreCreateTopLevel(scr, 0, 0, wPreferences.icon_size, wPreferences.icon_size, 0);
|
|
||||||
if (wPreferences.use_saveunders) {
|
|
||||||
vmask = CWSaveUnder;
|
|
||||||
attribs.save_under = True;
|
|
||||||
}
|
|
||||||
/* a white border for selecting it */
|
|
||||||
vmask |= CWBorderPixel;
|
|
||||||
attribs.border_pixel = scr->white_pixel;
|
|
||||||
|
|
||||||
XChangeWindowAttributes(dpy, icon->core->window, vmask, &attribs);
|
|
||||||
|
|
||||||
/* will be overriden if this is a application icon */
|
|
||||||
icon->core->descriptor.handle_mousedown = miniwindowMouseDown;
|
|
||||||
icon->core->descriptor.handle_expose = miniwindowExpose;
|
|
||||||
icon->core->descriptor.parent_type = WCLASS_MINIWINDOW;
|
|
||||||
icon->core->descriptor.parent = icon;
|
|
||||||
|
|
||||||
icon->core->stacking = wmalloc(sizeof(WStacking));
|
|
||||||
icon->core->stacking->above = NULL;
|
|
||||||
icon->core->stacking->under = NULL;
|
|
||||||
icon->core->stacking->window_level = NORMAL_ICON_LEVEL;
|
|
||||||
icon->core->stacking->child_of = NULL;
|
|
||||||
|
|
||||||
if (iconfile) {
|
if (iconfile) {
|
||||||
icon->file_image = RLoadImage(scr->rcontext, iconfile, 0);
|
icon->file_image = RLoadImage(scr->rcontext, iconfile, 0);
|
||||||
@@ -232,6 +182,47 @@ WIcon *wIconCreateWithIconFile(WScreen * scr, char *iconfile, int tile)
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static WIcon *wIconCreateCore(WScreen *scr, int coord_x, int coord_y)
|
||||||
|
{
|
||||||
|
WIcon *icon;
|
||||||
|
unsigned long vmask = 0;
|
||||||
|
XSetWindowAttributes attribs;
|
||||||
|
|
||||||
|
icon = wmalloc(sizeof(WIcon));
|
||||||
|
memset(icon, 0, sizeof(WIcon));
|
||||||
|
icon->core = wCoreCreateTopLevel(scr,
|
||||||
|
coord_x,
|
||||||
|
coord_y,
|
||||||
|
wPreferences.icon_size,
|
||||||
|
wPreferences.icon_size,
|
||||||
|
0);
|
||||||
|
|
||||||
|
if (wPreferences.use_saveunders) {
|
||||||
|
vmask = CWSaveUnder;
|
||||||
|
attribs.save_under = True;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a white border for selecting it */
|
||||||
|
vmask |= CWBorderPixel;
|
||||||
|
attribs.border_pixel = scr->white_pixel;
|
||||||
|
|
||||||
|
XChangeWindowAttributes(dpy, icon->core->window, vmask, &attribs);
|
||||||
|
|
||||||
|
/* will be overriden if this is a application icon */
|
||||||
|
icon->core->descriptor.handle_mousedown = miniwindowMouseDown;
|
||||||
|
icon->core->descriptor.handle_expose = miniwindowExpose;
|
||||||
|
icon->core->descriptor.parent_type = WCLASS_MINIWINDOW;
|
||||||
|
icon->core->descriptor.parent = icon;
|
||||||
|
|
||||||
|
icon->core->stacking = wmalloc(sizeof(WStacking));
|
||||||
|
icon->core->stacking->above = NULL;
|
||||||
|
icon->core->stacking->under = NULL;
|
||||||
|
icon->core->stacking->window_level = NORMAL_ICON_LEVEL;
|
||||||
|
icon->core->stacking->child_of = NULL;
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
void wIconDestroy(WIcon * icon)
|
void wIconDestroy(WIcon * icon)
|
||||||
{
|
{
|
||||||
WCoreWindow *core = icon->core;
|
WCoreWindow *core = icon->core;
|
||||||
|
|||||||
Reference in New Issue
Block a user