forked from vitrine/wmaker
Hide WApplication fields in favor of accessors.
This commit is contained in:
@@ -37,6 +37,109 @@
|
||||
#include "dock.h"
|
||||
#include "defaults.h"
|
||||
|
||||
struct WApplication {
|
||||
struct WApplication *next;
|
||||
struct WApplication *prev;
|
||||
|
||||
Window main_window; /* ID of the group leader */
|
||||
struct WWindow *main_window_desc; /* main (leader) window descriptor */
|
||||
WMenu *menu; /* application menu */
|
||||
struct WAppIcon *app_icon;
|
||||
int refcount;
|
||||
struct WWindow *last_focused; /* focused window before hide */
|
||||
int last_workspace; /* last workspace used to work on the
|
||||
* app */
|
||||
WMHandlerID *urgent_bounce_timer;
|
||||
struct {
|
||||
unsigned int skip_next_animation:1;
|
||||
unsigned int hidden:1;
|
||||
unsigned int emulated:1;
|
||||
unsigned int bouncing:1;
|
||||
} flags;
|
||||
};
|
||||
|
||||
/******** Accessors/mutators ********/
|
||||
Window wApplicationGetMainWindow(WApplication *wapp) {
|
||||
return wapp->main_window;
|
||||
}
|
||||
|
||||
WMenu *wApplicationGetMenu(WApplication *wapp) {
|
||||
return wapp->menu;
|
||||
}
|
||||
|
||||
void wApplicationSetMenu(WApplication *wapp, WMenu *menu) {
|
||||
wapp->menu = menu;
|
||||
}
|
||||
|
||||
struct WWindow *wApplicationGetMainWindowDesc(WApplication *wapp) {
|
||||
return wapp->main_window_desc;
|
||||
}
|
||||
|
||||
struct WAppIcon *wApplicationGetAppIcon(WApplication *wapp) {
|
||||
return wapp->app_icon;
|
||||
}
|
||||
void wApplicationSetAppIcon(WApplication *wapp, struct WAppIcon *icon) {
|
||||
wapp->app_icon = icon;
|
||||
}
|
||||
|
||||
int wApplicationGetLastWorkspace(WApplication *wapp) {
|
||||
return wapp->last_workspace;
|
||||
}
|
||||
void wApplicationSetLastWorkspace(WApplication *wapp, int workspace) {
|
||||
wapp->last_workspace = workspace;
|
||||
}
|
||||
|
||||
struct WWindow *wApplicationGetLastFocused(WApplication *wapp) {
|
||||
return wapp->last_focused;
|
||||
}
|
||||
void wApplicationSetLastFocused(WApplication *wapp, struct WWindow *win) {
|
||||
wapp->last_focused = win;
|
||||
}
|
||||
|
||||
|
||||
WMHandlerID *wApplicationGetUrgentBounceTimer(WApplication *wapp) {
|
||||
return wapp->urgent_bounce_timer;
|
||||
}
|
||||
int wApplicationHasUrgentBounceTimer(WApplication *wapp) {
|
||||
return wapp->urgent_bounce_timer != NULL;
|
||||
}
|
||||
void wApplicationClearUrgentBounceTimer(WApplication *wapp) {
|
||||
if (wapp->urgent_bounce_timer) {
|
||||
WMDeleteTimerHandler(wapp->urgent_bounce_timer);
|
||||
wapp->urgent_bounce_timer = NULL;
|
||||
}
|
||||
}
|
||||
void wApplicationSetUrgentBounceTimer(WApplication *wapp, WMHandlerID *timer) {
|
||||
wapp->urgent_bounce_timer = timer;
|
||||
}
|
||||
|
||||
int wApplicationGetSkipNextAnimation(WApplication *wapp) {
|
||||
return wapp->flags.skip_next_animation;
|
||||
}
|
||||
void wApplicationSetSkipNextAnimation(WApplication *wapp, int skip) {
|
||||
wapp->flags.skip_next_animation = !!skip;
|
||||
}
|
||||
|
||||
int wApplicationIsHidden(WApplication *wapp) {
|
||||
return wapp->flags.hidden;
|
||||
}
|
||||
void wApplicationSetHidden(WApplication *wapp, int hidden) {
|
||||
wapp->flags.hidden = !!hidden;
|
||||
}
|
||||
|
||||
int wApplicationIsEmulated(WApplication *wapp) {
|
||||
return wapp->flags.emulated;
|
||||
}
|
||||
void wApplicationSetEmulated(WApplication *wapp, int emulated) {
|
||||
wapp->flags.emulated = !!emulated;
|
||||
}
|
||||
|
||||
int wApplicationIsBouncing(WApplication *wapp) {
|
||||
return wapp->flags.bouncing;
|
||||
}
|
||||
void wApplicationSetBouncing(WApplication *wapp, int bouncing) {
|
||||
wapp->flags.bouncing = !!bouncing;
|
||||
}
|
||||
|
||||
/******** Local variables ********/
|
||||
|
||||
@@ -198,6 +301,21 @@ void wApplicationDestroy(WApplication *wapp)
|
||||
wfree(wapp);
|
||||
}
|
||||
|
||||
void wApplicationIncrementRefcount(WApplication *wapp)
|
||||
{
|
||||
++wapp->refcount;
|
||||
}
|
||||
|
||||
int wApplicationHasLiveRefcount(WApplication *wapp)
|
||||
{
|
||||
return wapp->refcount > 1;
|
||||
}
|
||||
|
||||
void wApplicationClearRefcount(WApplication *wapp)
|
||||
{
|
||||
wapp->refcount = 0;
|
||||
}
|
||||
|
||||
void wApplicationActivate(WApplication *wapp)
|
||||
{
|
||||
if (wapp->app_icon) {
|
||||
|
||||
Reference in New Issue
Block a user