mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-22 14:08:06 +01:00
AppIcon helper functions.
Create wAppIconFor() and wAppIconTouchesHead() to match wWindowFor() and wWindowTouchesHead(). These functions will allow us to locate the window and head associated with a particular app icon or dock icon.
This commit is contained in:
committed by
Carlos R. Mafra
parent
930e59dd31
commit
67f73e9d54
@@ -60,6 +60,7 @@
|
||||
extern Cursor wCursor[WCUR_LAST];
|
||||
extern WPreferences wPreferences;
|
||||
extern WDDomain *WDWindowAttributes;
|
||||
extern XContext wWinContext;
|
||||
|
||||
#define MOD_MASK wPreferences.modifier_mask
|
||||
|
||||
@@ -1016,3 +1017,19 @@ static void remove_from_appicon_list(WScreen *scr, WAppIcon *appicon)
|
||||
appicon->prev = NULL;
|
||||
appicon->next = NULL;
|
||||
}
|
||||
|
||||
WAppIcon *wAppIconFor(Window window)
|
||||
{
|
||||
WObjDescriptor *desc;
|
||||
|
||||
if (window == None)
|
||||
return NULL;
|
||||
|
||||
if (XFindContext(dpy, window, wWinContext, (XPointer *) & desc) == XCNOENT)
|
||||
return NULL;
|
||||
|
||||
if (desc->parent_type == WCLASS_APPICON || desc->parent_type == WCLASS_DOCK_ICON)
|
||||
return desc->parent;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -83,4 +83,5 @@ void paint_app_icon(WApplication *wapp);
|
||||
void unpaint_app_icon(WApplication *wapp);
|
||||
void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance,
|
||||
char *wm_class);
|
||||
WAppIcon *wAppIconFor(Window window);
|
||||
#endif
|
||||
|
||||
@@ -201,6 +201,25 @@ Bool wWindowTouchesHead(WWindow * wwin, int head)
|
||||
return (a != 0);
|
||||
}
|
||||
|
||||
Bool wAppIconTouchesHead(WAppIcon * aicon, int head)
|
||||
{
|
||||
WScreen *scr;
|
||||
WMRect rect;
|
||||
int a;
|
||||
|
||||
if (!aicon || !aicon->icon)
|
||||
return False;
|
||||
|
||||
scr = aicon->icon->core->screen_ptr;
|
||||
rect = wGetRectForHead(scr, head);
|
||||
a = calcIntersectionArea(aicon->x_pos, aicon->y_pos,
|
||||
aicon->icon->core->width,
|
||||
aicon->icon->core->height,
|
||||
rect.pos.x, rect.pos.y, rect.size.width, rect.size.height);
|
||||
|
||||
return (a != 0);
|
||||
}
|
||||
|
||||
int wGetHeadForWindow(WWindow * wwin)
|
||||
{
|
||||
WMRect rect;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef _WMXINERAMA_H_
|
||||
#define _WMXINERAMA_H_
|
||||
|
||||
#include "appicon.h"
|
||||
#include "screen.h"
|
||||
#include "window.h"
|
||||
#include <WINGs/WINGs.h>
|
||||
@@ -51,6 +52,7 @@ WArea wGetUsableAreaForHead(WScreen *scr, int head, WArea *totalAreaPtr, Bool no
|
||||
WMPoint wGetPointToCenterRectInHead(WScreen *scr, int head, int width, int height);
|
||||
|
||||
Bool wWindowTouchesHead(WWindow *wwin, int head);
|
||||
Bool wAppIconTouchesHead(WAppIcon *aicon, int head);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user