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 */ /* locale to use. NULL==POSIX or C */
const char *locale; const char *locale;
/* Tracking of X events timestamps */
struct {
/* ts of the last event we received */
Time last_event;
} timestamp;
} w_global; } w_global;
extern unsigned int ValidModMask; extern unsigned int ValidModMask;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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