mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
wmaker: Moved definition of X Contexts into the global variables structure
This commit is contained in:
committed by
Carlos R. Mafra
parent
e2ce62eb5b
commit
ec91b9f68e
@@ -522,6 +522,13 @@ extern struct wmaker_global_variables {
|
||||
|
||||
} atom;
|
||||
|
||||
/* X Contexts */
|
||||
struct {
|
||||
XContext client_win;
|
||||
XContext app_win;
|
||||
XContext stack;
|
||||
} context;
|
||||
|
||||
} w_global;
|
||||
|
||||
extern unsigned int ValidModMask;
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
|
||||
/**** Global variables ****/
|
||||
extern WDDomain *WDWindowAttributes;
|
||||
extern XContext wWinContext;
|
||||
|
||||
#define MOD_MASK wPreferences.modifier_mask
|
||||
#define ICON_SIZE wPreferences.icon_size
|
||||
@@ -1221,7 +1220,7 @@ WAppIcon *wAppIconFor(Window window)
|
||||
if (window == None)
|
||||
return NULL;
|
||||
|
||||
if (XFindContext(dpy, window, wWinContext, (XPointer *) & desc) == XCNOENT)
|
||||
if (XFindContext(dpy, window, w_global.context.client_win, (XPointer *) & desc) == XCNOENT)
|
||||
return NULL;
|
||||
|
||||
if (desc->parent_type == WCLASS_APPICON || desc->parent_type == WCLASS_DOCK_ICON)
|
||||
|
||||
@@ -37,10 +37,6 @@
|
||||
#include "dock.h"
|
||||
#include "defaults.h"
|
||||
|
||||
/******** Global variables ********/
|
||||
|
||||
extern XContext wAppWinContext;
|
||||
extern XContext wWinContext;
|
||||
|
||||
/******** Local variables ********/
|
||||
|
||||
@@ -73,7 +69,7 @@ WApplication *wApplicationOf(Window window)
|
||||
|
||||
if (window == None)
|
||||
return NULL;
|
||||
if (XFindContext(dpy, window, wAppWinContext, (XPointer *) & wapp) != XCSUCCESS)
|
||||
if (XFindContext(dpy, window, w_global.context.app_win, (XPointer *) & wapp) != XCSUCCESS)
|
||||
return NULL;
|
||||
return wapp;
|
||||
}
|
||||
@@ -140,7 +136,7 @@ WApplication *wApplicationCreate(WWindow * wwin)
|
||||
wapp->flags.emulated = WFLAGP(wapp->main_window_desc, emulate_appicon);
|
||||
|
||||
/* application descriptor */
|
||||
XSaveContext(dpy, main_window, wAppWinContext, (XPointer) wapp);
|
||||
XSaveContext(dpy, main_window, w_global.context.app_win, (XPointer) wapp);
|
||||
|
||||
create_appicon_for_application(wapp, wwin);
|
||||
|
||||
@@ -183,7 +179,7 @@ void wApplicationDestroy(WApplication * wapp)
|
||||
wapp->prev->next = wapp->next;
|
||||
}
|
||||
|
||||
XDeleteContext(dpy, wapp->main_window, wAppWinContext);
|
||||
XDeleteContext(dpy, wapp->main_window, w_global.context.app_win);
|
||||
wAppMenuDestroy(wapp->menu);
|
||||
|
||||
/* Remove application icon */
|
||||
@@ -195,7 +191,7 @@ void wApplicationDestroy(WApplication * wapp)
|
||||
if (wwin) {
|
||||
/* undelete client window context that was deleted in
|
||||
* wWindowDestroy */
|
||||
XSaveContext(dpy, wwin->client_win, wWinContext, (XPointer) & wwin->client_descriptor);
|
||||
XSaveContext(dpy, wwin->client_win, w_global.context.client_win, (XPointer) & wwin->client_descriptor);
|
||||
}
|
||||
wfree(wapp);
|
||||
}
|
||||
|
||||
@@ -46,9 +46,6 @@
|
||||
|
||||
/****** Global Variables ******/
|
||||
|
||||
/* contexts */
|
||||
extern XContext wWinContext;
|
||||
|
||||
#ifdef SHAPE
|
||||
extern Bool wShapeSupported;
|
||||
#endif
|
||||
@@ -191,7 +188,7 @@ void wClientConfigure(WWindow * wwin, XConfigureRequestEvent * xcre)
|
||||
WWindow *sibling;
|
||||
|
||||
if ((xcre->value_mask & CWSibling) &&
|
||||
(XFindContext(dpy, xcre->above, wWinContext, (XPointer *) & desc) == XCSUCCESS)
|
||||
(XFindContext(dpy, xcre->above, w_global.context.client_win, (XPointer *) & desc) == XCSUCCESS)
|
||||
&& (desc->parent_type == WCLASS_WINDOW)) {
|
||||
sibling = desc->parent;
|
||||
xwc.sibling = sibling->frame->core->window;
|
||||
|
||||
@@ -65,9 +65,6 @@
|
||||
#define CLIP_IDLE 0
|
||||
#define CLIP_FORWARD 2
|
||||
|
||||
/**** Global variables ****/
|
||||
extern XContext wWinContext;
|
||||
|
||||
#define MOD_MASK wPreferences.modifier_mask
|
||||
#define ICON_SIZE wPreferences.icon_size
|
||||
|
||||
@@ -4050,7 +4047,7 @@ static void clipLeave(WDock *dock)
|
||||
return;
|
||||
|
||||
if (XCheckTypedEvent(dpy, EnterNotify, &event) != False) {
|
||||
if (XFindContext(dpy, event.xcrossing.window, wWinContext,
|
||||
if (XFindContext(dpy, event.xcrossing.window, w_global.context.client_win,
|
||||
(XPointer *) & desc) != XCNOENT
|
||||
&& desc && desc->parent_type == WCLASS_DOCK_ICON
|
||||
&& ((WAppIcon *) desc->parent)->dock == dock) {
|
||||
|
||||
13
src/event.c
13
src/event.c
@@ -77,7 +77,6 @@
|
||||
#include "switchmenu.h"
|
||||
|
||||
/******** Global Variables **********/
|
||||
extern XContext wWinContext;
|
||||
extern XContext wVEdgeContext;
|
||||
|
||||
extern WShortKey wKeyBindings[WKBD_LAST];
|
||||
@@ -702,7 +701,7 @@ static void handleExpose(XEvent * event)
|
||||
|
||||
while (XCheckTypedWindowEvent(dpy, event->xexpose.window, Expose, &ev)) ;
|
||||
|
||||
if (XFindContext(dpy, event->xexpose.window, wWinContext, (XPointer *) & desc) == XCNOENT) {
|
||||
if (XFindContext(dpy, event->xexpose.window, w_global.context.client_win, (XPointer *) & desc) == XCNOENT) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -769,8 +768,8 @@ static void handleButtonPress(XEvent * event)
|
||||
}
|
||||
|
||||
desc = NULL;
|
||||
if (XFindContext(dpy, event->xbutton.subwindow, wWinContext, (XPointer *) & desc) == XCNOENT) {
|
||||
if (XFindContext(dpy, event->xbutton.window, wWinContext, (XPointer *) & desc) == XCNOENT) {
|
||||
if (XFindContext(dpy, event->xbutton.subwindow, w_global.context.client_win, (XPointer *) & desc) == XCNOENT) {
|
||||
if (XFindContext(dpy, event->xbutton.window, w_global.context.client_win, (XPointer *) & desc) == XCNOENT) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1034,7 +1033,7 @@ static void handleClientMessage(XEvent * event)
|
||||
* For when the icon frame gets a ClientMessage
|
||||
* that should have gone to the icon_window.
|
||||
*/
|
||||
if (XFindContext(dpy, event->xbutton.window, wWinContext, (XPointer *) & desc) != XCNOENT) {
|
||||
if (XFindContext(dpy, event->xbutton.window, w_global.context.client_win, (XPointer *) & desc) != XCNOENT) {
|
||||
struct WIcon *icon = NULL;
|
||||
|
||||
if (desc->parent_type == WCLASS_MINIWINDOW) {
|
||||
@@ -1084,7 +1083,7 @@ static void handleEnterNotify(XEvent * event)
|
||||
}
|
||||
}
|
||||
|
||||
if (XFindContext(dpy, event->xcrossing.window, wWinContext, (XPointer *) & desc) != XCNOENT) {
|
||||
if (XFindContext(dpy, event->xcrossing.window, w_global.context.client_win, (XPointer *) & desc) != XCNOENT) {
|
||||
if (desc->handle_enternotify)
|
||||
(*desc->handle_enternotify) (desc, event);
|
||||
}
|
||||
@@ -1148,7 +1147,7 @@ static void handleLeaveNotify(XEvent * event)
|
||||
{
|
||||
WObjDescriptor *desc = NULL;
|
||||
|
||||
if (XFindContext(dpy, event->xcrossing.window, wWinContext, (XPointer *) & desc) != XCNOENT) {
|
||||
if (XFindContext(dpy, event->xcrossing.window, w_global.context.client_win, (XPointer *) & desc) != XCNOENT) {
|
||||
if (desc->handle_leavenotify)
|
||||
(*desc->handle_leavenotify) (desc, event);
|
||||
}
|
||||
|
||||
@@ -91,9 +91,6 @@ WDDomain *WDWindowAttributes = NULL;
|
||||
WDDomain *WDRootMenu = NULL;
|
||||
|
||||
/* XContexts */
|
||||
XContext wWinContext;
|
||||
XContext wAppWinContext;
|
||||
XContext wStackContext;
|
||||
XContext wVEdgeContext;
|
||||
|
||||
#ifdef SHAPE
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
#include "rootmenu.h"
|
||||
#include "switchmenu.h"
|
||||
|
||||
/****** Global Variables ******/
|
||||
|
||||
extern XContext wWinContext;
|
||||
|
||||
#define MOD_MASK wPreferences.modifier_mask
|
||||
|
||||
@@ -1276,7 +1273,7 @@ static WMenu *findMenu(WScreen * scr, int *x_ret, int *y_ret)
|
||||
if (win == None)
|
||||
return NULL;
|
||||
|
||||
if (XFindContext(dpy, win, wWinContext, (XPointer *) & desc) == XCNOENT)
|
||||
if (XFindContext(dpy, win, w_global.context.client_win, (XPointer *) & desc) == XCNOENT)
|
||||
return NULL;
|
||||
|
||||
if (desc->parent_type == WCLASS_MENU) {
|
||||
@@ -1398,7 +1395,7 @@ WMenu *wMenuUnderPointer(WScreen * screen)
|
||||
if (win == None)
|
||||
return NULL;
|
||||
|
||||
if (XFindContext(dpy, win, wWinContext, (XPointer *) & desc) == XCNOENT)
|
||||
if (XFindContext(dpy, win, w_global.context.client_win, (XPointer *) & desc) == XCNOENT)
|
||||
return NULL;
|
||||
|
||||
if (desc->parent_type == WCLASS_MENU)
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
#include "stacking.h"
|
||||
#include "workspace.h"
|
||||
|
||||
/*** Global Variables ***/
|
||||
extern XContext wStackContext;
|
||||
|
||||
static void notifyStackChange(WCoreWindow * frame, char *detail)
|
||||
{
|
||||
@@ -77,7 +75,7 @@ void RemakeStackList(WScreen * scr)
|
||||
/* verify list integrity */
|
||||
c = 0;
|
||||
for (i = 0; i < nwindows; i++) {
|
||||
if (XFindContext(dpy, windows[i], wStackContext, (XPointer *) & frame)
|
||||
if (XFindContext(dpy, windows[i], w_global.context.stack, (XPointer *) & frame)
|
||||
== XCNOENT) {
|
||||
continue;
|
||||
}
|
||||
@@ -404,7 +402,7 @@ void AddToStackList(WCoreWindow * frame)
|
||||
WCoreWindow *trans = NULL;
|
||||
|
||||
frame->screen_ptr->window_count++;
|
||||
XSaveContext(dpy, frame->window, wStackContext, (XPointer) frame);
|
||||
XSaveContext(dpy, frame->window, w_global.context.stack, (XPointer) frame);
|
||||
curtop = WMGetFromBag(scr->stacking_list, index);
|
||||
|
||||
/* first window in this level */
|
||||
@@ -560,7 +558,7 @@ void RemoveFromStackList(WCoreWindow * frame)
|
||||
{
|
||||
int index = frame->stacking->window_level;
|
||||
|
||||
if (XDeleteContext(dpy, frame->window, wStackContext) == XCNOENT) {
|
||||
if (XDeleteContext(dpy, frame->window, w_global.context.stack) == XCNOENT) {
|
||||
wwarning("RemoveFromStackingList(): window not in list ");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,9 +102,6 @@ extern int wXkbEventBase;
|
||||
#endif
|
||||
|
||||
/* contexts */
|
||||
extern XContext wWinContext;
|
||||
extern XContext wAppWinContext;
|
||||
extern XContext wStackContext;
|
||||
extern XContext wVEdgeContext;
|
||||
|
||||
#ifndef HAVE_INOTIFY
|
||||
@@ -472,9 +469,9 @@ void StartUp(Bool defaultScreenOnly)
|
||||
|
||||
memset(&wKeyBindings, 0, sizeof(wKeyBindings));
|
||||
|
||||
wWinContext = XUniqueContext();
|
||||
wAppWinContext = XUniqueContext();
|
||||
wStackContext = XUniqueContext();
|
||||
w_global.context.client_win = XUniqueContext();
|
||||
w_global.context.app_win = XUniqueContext();
|
||||
w_global.context.stack = XUniqueContext();
|
||||
wVEdgeContext = XUniqueContext();
|
||||
|
||||
/* _XA_VERSION = XInternAtom(dpy, "VERSION", False); */
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include "WindowMaker.h"
|
||||
#include "wcore.h"
|
||||
|
||||
/****** Global Variables ******/
|
||||
extern XContext wWinContext;
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* wCoreCreateTopLevel--
|
||||
@@ -72,7 +70,7 @@ WCoreWindow *wCoreCreateTopLevel(WScreen *screen, int x, int y, int width, int h
|
||||
core->descriptor.self = core;
|
||||
|
||||
XClearWindow(dpy, core->window);
|
||||
XSaveContext(dpy, core->window, wWinContext, (XPointer) & core->descriptor);
|
||||
XSaveContext(dpy, core->window, w_global.context.client_win, (XPointer) & core->descriptor);
|
||||
|
||||
return core;
|
||||
}
|
||||
@@ -116,7 +114,7 @@ WCoreWindow *wCoreCreate(WCoreWindow *parent, int x, int y, int width, int heigh
|
||||
core->screen_ptr = parent->screen_ptr;
|
||||
core->descriptor.self = core;
|
||||
|
||||
XSaveContext(dpy, core->window, wWinContext, (XPointer) & core->descriptor);
|
||||
XSaveContext(dpy, core->window, w_global.context.client_win, (XPointer) & core->descriptor);
|
||||
return core;
|
||||
}
|
||||
|
||||
@@ -125,7 +123,7 @@ void wCoreDestroy(WCoreWindow * core)
|
||||
if (core->stacking)
|
||||
wfree(core->stacking);
|
||||
|
||||
XDeleteContext(dpy, core->window, wWinContext);
|
||||
XDeleteContext(dpy, core->window, w_global.context.client_win);
|
||||
XDestroyWindow(dpy, core->window);
|
||||
wfree(core);
|
||||
}
|
||||
|
||||
11
src/window.c
11
src/window.c
@@ -79,9 +79,6 @@ extern WShortKey wKeyBindings[WKBD_LAST];
|
||||
extern Bool wShapeSupported;
|
||||
#endif
|
||||
|
||||
/* contexts */
|
||||
extern XContext wWinContext;
|
||||
|
||||
/***** Local Stuff *****/
|
||||
static WWindowState *windowState = NULL;
|
||||
static FocusMode getFocusMode(WWindow *wwin);
|
||||
@@ -146,7 +143,7 @@ WWindow *wWindowFor(Window window)
|
||||
if (window == None)
|
||||
return NULL;
|
||||
|
||||
if (XFindContext(dpy, window, wWinContext, (XPointer *) & desc) == XCNOENT)
|
||||
if (XFindContext(dpy, window, w_global.context.client_win, (XPointer *) & desc) == XCNOENT)
|
||||
return NULL;
|
||||
|
||||
if (desc->parent_type == WCLASS_WINDOW)
|
||||
@@ -226,7 +223,7 @@ void wWindowDestroy(WWindow *wwin)
|
||||
if (wwin->cmap_windows)
|
||||
XFree(wwin->cmap_windows);
|
||||
|
||||
XDeleteContext(dpy, wwin->client_win, wWinContext);
|
||||
XDeleteContext(dpy, wwin->client_win, w_global.context.client_win);
|
||||
|
||||
if (wwin->frame)
|
||||
wFrameWindowDestroy(wwin->frame);
|
||||
@@ -621,7 +618,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
||||
else if (!wFetchName(dpy, window, &title))
|
||||
title = NULL;
|
||||
|
||||
XSaveContext(dpy, window, wWinContext, (XPointer) & wwin->client_descriptor);
|
||||
XSaveContext(dpy, window, w_global.context.client_win, (XPointer) & wwin->client_descriptor);
|
||||
|
||||
#ifdef SHAPE
|
||||
if (wShapeSupported) {
|
||||
@@ -1360,7 +1357,7 @@ WWindow *wManageInternalWindow(WScreen *scr, Window window, Window owner,
|
||||
scr->resizebar_texture, scr->window_title_color, &scr->title_font,
|
||||
scr->w_depth, scr->w_visual, scr->w_colormap);
|
||||
|
||||
XSaveContext(dpy, window, wWinContext, (XPointer) & wwin->client_descriptor);
|
||||
XSaveContext(dpy, window, w_global.context.client_win, (XPointer) & wwin->client_descriptor);
|
||||
|
||||
wwin->frame->flags.is_client_window_frame = 1;
|
||||
wwin->frame->flags.justification = wPreferences.title_justification;
|
||||
|
||||
Reference in New Issue
Block a user