1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

wmaker: Moved timestamp variable (#1) to the global variable structure

This commit is contained in:
Christophe CURIS
2013-09-29 13:22:52 +02:00
committed by Carlos R. Mafra
parent 577506cbd2
commit af6c4ec37f
10 changed files with 25 additions and 27 deletions

View File

@@ -464,6 +464,13 @@ extern struct wmaker_global_variables {
/* locale to use. NULL==POSIX or C */
const char *locale;
/* Tracking of X events timestamps */
struct {
/* ts of the last event we received */
Time last_event;
} timestamp;
} w_global;
extern unsigned int ValidModMask;

View File

@@ -53,7 +53,6 @@
/****** Global Variables ******/
int ignore_wks_change = 0;
extern Time LastTimestamp;
extern Time LastFocusChange;
extern Atom _XA_WM_TAKE_FOCUS;
@@ -112,7 +111,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
WWindow *old_focused;
WWindow *focused = scr->focused_window;
Time timestamp = LastTimestamp;
Time timestamp = w_global.timestamp.last_event;
WApplication *oapp = NULL, *napp = NULL;
int wasfocused;

View File

@@ -38,7 +38,6 @@
/******** Global Variables **********/
extern Atom _XA_WINDOWMAKER_MENU;
extern Time LastTimestamp;
typedef struct {
short code;
@@ -67,7 +66,7 @@ static void sendMessage(Window window, int what, int tag)
event.xclient.format = 32;
event.xclient.display = dpy;
event.xclient.window = window;
event.xclient.data.l[0] = LastTimestamp;
event.xclient.data.l[0] = w_global.timestamp.last_event;
event.xclient.data.l[1] = what;
event.xclient.data.l[2] = tag;
event.xclient.data.l[3] = 0;

View File

@@ -84,7 +84,6 @@ extern Cursor wCursor[WCUR_LAST];
extern WShortKey wKeyBindings[WKBD_LAST];
extern int wScreenCount;
extern Time LastTimestamp;
extern Time LastFocusChange;
#define MOD_MASK wPreferences.modifier_mask
@@ -527,30 +526,30 @@ static void saveTimestamp(XEvent * event)
switch (event->type) {
case ButtonRelease:
case ButtonPress:
LastTimestamp = event->xbutton.time;
w_global.timestamp.last_event = event->xbutton.time;
break;
case KeyPress:
case KeyRelease:
LastTimestamp = event->xkey.time;
w_global.timestamp.last_event = event->xkey.time;
break;
case MotionNotify:
LastTimestamp = event->xmotion.time;
w_global.timestamp.last_event = event->xmotion.time;
break;
case PropertyNotify:
LastTimestamp = event->xproperty.time;
w_global.timestamp.last_event = event->xproperty.time;
break;
case EnterNotify:
case LeaveNotify:
LastTimestamp = event->xcrossing.time;
w_global.timestamp.last_event = event->xcrossing.time;
break;
case SelectionClear:
LastTimestamp = event->xselectionclear.time;
w_global.timestamp.last_event = event->xselectionclear.time;
break;
case SelectionRequest:
LastTimestamp = event->xselectionrequest.time;
w_global.timestamp.last_event = event->xselectionrequest.time;
break;
case SelectionNotify:
LastTimestamp = event->xselection.time;
w_global.timestamp.last_event = event->xselection.time;
#ifdef XDND
wXDNDProcessSelection(event);
#endif

View File

@@ -128,8 +128,6 @@ Atom _XA_WM_IGNORE_FOCUS_EVENTS;
/* cursors */
Cursor wCursor[WCUR_LAST];
/* last event timestamp for XSetInputFocus */
Time LastTimestamp = CurrentTime;
/* timestamp on the last time we did XSetInputFocus() */
Time LastFocusChange = CurrentTime;
@@ -596,6 +594,7 @@ int main(int argc, char **argv)
memset(&w_global, 0, sizeof(w_global));
w_global.program.state = WSTATE_NORMAL;
w_global.program.signal_state = WSTATE_NORMAL;
w_global.timestamp.last_event = CurrentTime;
/* setup common stuff for the monitor and wmaker itself */
WMInitializeApplication("WindowMaker", &argc, argv);

View File

@@ -89,7 +89,6 @@
extern Atom _XA_WM_SAVE_YOURSELF;
extern Time LastTimestamp;
static WMPropList *sApplications = NULL;
static WMPropList *sCommand;

View File

@@ -39,7 +39,6 @@
#include "shutdown.h"
extern Atom _XA_WM_DELETE_WINDOW;
extern Time LastTimestamp;
extern int wScreenCount;
static void wipeDesktop(WScreen * scr);
@@ -197,7 +196,7 @@ static void wipeDesktop(WScreen * scr)
wwin = scr->focused_window;
while (wwin) {
if (wwin->protocols.DELETE_WINDOW)
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, w_global.timestamp.last_event);
else
wClientKill(wwin);
wwin = wwin->prev;

View File

@@ -86,7 +86,6 @@ extern XContext wWinContext;
extern Atom _XA_WM_DELETE_WINDOW;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
extern Atom _XA_WINDOWMAKER_STATE;
extern Time LastTimestamp;
/***** Local Stuff *****/
static WWindowState *windowState = NULL;
@@ -2918,7 +2917,7 @@ static void windowCloseClick(WCoreWindow *sender, void *data, XEvent *event)
} else {
if (wwin->protocols.DELETE_WINDOW && event->xbutton.state == 0) {
/* send delete message */
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, w_global.timestamp.last_event);
}
}
}
@@ -2934,7 +2933,7 @@ static void windowCloseDblClick(WCoreWindow *sender, void *data, XEvent *event)
/* send delete message */
if (wwin->protocols.DELETE_WINDOW)
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, w_global.timestamp.last_event);
else
wClientKill(wwin);
}
@@ -2974,7 +2973,7 @@ static void windowIconifyClick(WCoreWindow *sender, void *data, XEvent *event)
return;
if (wwin->protocols.MINIATURIZE_WINDOW && event->xbutton.state == 0) {
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW, LastTimestamp);
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW, w_global.timestamp.last_event);
} else {
WApplication *wapp;
if ((event->xbutton.state & ControlMask) || (event->xbutton.button == Button3)) {

View File

@@ -69,7 +69,6 @@
#define WO_ENTRIES 3
/**** Global data ***/
extern Time LastTimestamp;
extern Atom _XA_WM_DELETE_WINDOW;
extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
@@ -113,7 +112,7 @@ static void execMenuCommand(WMenu * menu, WMenuEntry * entry)
switch (entry->order) {
case MC_CLOSE:
/* send delete message */
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, w_global.timestamp.last_event);
break;
case MC_KILL:
@@ -134,7 +133,7 @@ static void execMenuCommand(WMenu * menu, WMenuEntry * entry)
wDeiconifyWindow(wwin);
} else {
if (wwin->protocols.MINIATURIZE_WINDOW) {
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW, LastTimestamp);
wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW, w_global.timestamp.last_event);
} else {
wIconifyWindow(wwin);
}

View File

@@ -52,7 +52,6 @@
/* Global variables */
extern Atom _XA_WM_DELETE_WINDOW;
extern Time LastTimestamp;
/* Root Window Properties */
static Atom net_supported;
@@ -1406,7 +1405,7 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
} else if (event->message_type == net_close_window) {
if (!WFLAGP(wwin, no_closable)) {
if (wwin->protocols.DELETE_WINDOW)
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, w_global.timestamp.last_event);
}
} else if (event->message_type == net_wm_state) {
int maximized = wwin->flags.maximized;