24
24
#include < X11/XKBlib.h>
25
25
#include < X11/Xproto.h>
26
26
27
- XState *xstate = NULL ;
27
+ XState *xstate = nullptr ;
28
28
29
29
extern Window get_app_window (Window w);
30
30
extern Source<Window> current_app_window;
@@ -143,7 +143,7 @@ Window XState::get_window(Window w, Atom prop) {
143
143
Atom actual_type;
144
144
int actual_format;
145
145
unsigned long nitems, bytes_after;
146
- unsigned char *prop_return = NULL ;
146
+ unsigned char *prop_return = nullptr ;
147
147
148
148
if (XGetWindowProperty (dpy, w, prop, 0 , sizeof (Atom), False, XA_WINDOW, &actual_type, &actual_format,
149
149
&nitems, &bytes_after, &prop_return) != Success)
@@ -159,7 +159,7 @@ Atom XState::get_atom(Window w, Atom prop) {
159
159
Atom actual_type;
160
160
int actual_format;
161
161
unsigned long nitems, bytes_after;
162
- unsigned char *prop_return = NULL ;
162
+ unsigned char *prop_return = nullptr ;
163
163
164
164
if (XGetWindowProperty (dpy, w, prop, 0 , sizeof (Atom), False, XA_ATOM, &actual_type, &actual_format,
165
165
&nitems, &bytes_after, &prop_return) != Success)
@@ -175,7 +175,7 @@ bool XState::has_atom(Window w, Atom prop, Atom value) {
175
175
Atom actual_type;
176
176
int actual_format;
177
177
unsigned long nitems, bytes_after;
178
- unsigned char *prop_return = NULL ;
178
+ unsigned char *prop_return = nullptr ;
179
179
180
180
if (XGetWindowProperty (dpy, w, prop, 0 , sizeof (Atom), False, XA_ATOM, &actual_type, &actual_format,
181
181
&nitems, &bytes_after, &prop_return) != Success)
@@ -404,15 +404,15 @@ class IgnoreHandler : public Handler {
404
404
if (xstate->current_dev ->master )
405
405
XTestFakeMotionEvent (dpy, DefaultScreen (dpy), e->x , e->y , 0 );
406
406
if (proximity && !xstate->in_proximity )
407
- parent->replace_child (NULL );
407
+ parent->replace_child (nullptr );
408
408
}
409
409
virtual void release (guint b, RTriple e) {
410
410
if (xstate->current_dev ->master ) {
411
411
XTestFakeMotionEvent (dpy, DefaultScreen (dpy), e->x , e->y , 0 );
412
412
XTestFakeButtonEvent (dpy, b, false , CurrentTime);
413
413
}
414
414
if (proximity ? !xstate->in_proximity : !xstate->xinput_pressed .size ())
415
- parent->replace_child (NULL );
415
+ parent->replace_child (nullptr );
416
416
}
417
417
virtual std::string name () { return " Ignore" ; }
418
418
virtual Grabber::State grab_mode () { return Grabber::NONE; }
@@ -443,7 +443,7 @@ class ButtonHandler : public Handler {
443
443
if (xstate->current_dev ->master )
444
444
XTestFakeMotionEvent (dpy, DefaultScreen (dpy), e->x , e->y , 0 );
445
445
if (proximity && !xstate->in_proximity )
446
- parent->replace_child (NULL );
446
+ parent->replace_child (nullptr );
447
447
}
448
448
virtual void release (guint b, RTriple e) {
449
449
if (xstate->current_dev ->master ) {
@@ -453,14 +453,14 @@ class ButtonHandler : public Handler {
453
453
XTestFakeButtonEvent (dpy, b, false , CurrentTime);
454
454
}
455
455
if (proximity ? !xstate->in_proximity : !xstate->xinput_pressed .size ())
456
- parent->replace_child (NULL );
456
+ parent->replace_child (nullptr );
457
457
}
458
458
virtual std::string name () { return " Button" ; }
459
459
virtual Grabber::State grab_mode () { return Grabber::NONE; }
460
460
};
461
461
462
462
void XState::bail_out () {
463
- handler->replace_child (NULL );
463
+ handler->replace_child (nullptr );
464
464
xinput_pressed.clear ();
465
465
XFlush (dpy);
466
466
}
@@ -513,7 +513,7 @@ void XState::ping() {
513
513
514
514
void XState::remove_device (int deviceid) {
515
515
if (current_dev && current_dev->dev == deviceid)
516
- current_dev = NULL ;
516
+ current_dev = nullptr ;
517
517
}
518
518
519
519
void XState::ungrab (int deviceid) {
@@ -528,7 +528,7 @@ class WaitForPongHandler : public Handler, protected Timeout {
528
528
printf (" Warning: %s timed out\n " , " WaitForPongHandler" );
529
529
xstate->bail_out ();
530
530
}
531
- virtual void pong () { parent->replace_child (NULL ); }
531
+ virtual void pong () { parent->replace_child (nullptr ); }
532
532
virtual std::string name () { return " WaitForPong" ; }
533
533
virtual Grabber::State grab_mode () { return parent->grab_mode (); }
534
534
};
@@ -544,7 +544,7 @@ class AbstractScrollHandler : public Handler {
544
544
int orig_x, orig_y;
545
545
546
546
protected:
547
- AbstractScrollHandler () : last_t (0 ), offset_x(0.0 ), offset_y(0.0 ) {
547
+ AbstractScrollHandler () : have_x( false ), have_y( false ), last_x( 0.0 ), last_y( 0.0 ), last_t (0 ), offset_x(0.0 ), offset_y(0.0 ) {
548
548
if (!prefs.move_back .get () || (xstate->current_dev && xstate->current_dev ->absolute ))
549
549
return ;
550
550
Window dummy1, dummy2;
@@ -633,7 +633,7 @@ class ScrollHandler : public AbstractScrollHandler {
633
633
}
634
634
virtual void raw_motion (RTriple e, bool abs_x, bool abs_y) {
635
635
if (proximity && !xstate->in_proximity ) {
636
- parent->replace_child (NULL );
636
+ parent->replace_child (nullptr );
637
637
move_back ();
638
638
}
639
639
if (xstate->xinput_pressed .size ())
@@ -663,13 +663,13 @@ class ScrollAdvancedHandler : public AbstractScrollHandler {
663
663
}
664
664
virtual void release (guint b, RTriple e) {
665
665
Handler *p = parent;
666
- p->replace_child (NULL );
666
+ p->replace_child (nullptr );
667
667
p->release (b, e);
668
668
move_back ();
669
669
}
670
670
virtual void press (guint b, RTriple e) {
671
671
Handler *p = parent;
672
- p->replace_child (NULL );
672
+ p->replace_child (nullptr );
673
673
p->press (b, e);
674
674
move_back ();
675
675
}
@@ -691,7 +691,7 @@ class AdvancedStrokeActionHandler : public Handler {
691
691
if (stroke_action)
692
692
(*stroke_action)(s);
693
693
if (xstate->xinput_pressed .size () == 0 )
694
- parent->replace_child (NULL );
694
+ parent->replace_child (nullptr );
695
695
}
696
696
virtual std::string name () { return " InstantStrokeAction" ; }
697
697
virtual Grabber::State grab_mode () { return Grabber::NONE; }
@@ -821,7 +821,7 @@ class AdvancedHandler : public Handler {
821
821
mods.clear ();
822
822
xstate->fake_click (b);
823
823
}
824
- return parent->replace_child (NULL );
824
+ return parent->replace_child (nullptr );
825
825
}
826
826
replay_button = 0 ;
827
827
mods.erase ((b == button1) ? button2 : b);
@@ -975,15 +975,15 @@ class StrokeHandler : public Handler, public sigc::trackable {
975
975
976
976
if (stroke_action) {
977
977
(*stroke_action)(s);
978
- return parent->replace_child (NULL );
978
+ return parent->replace_child (nullptr );
979
979
}
980
980
RRanking ranking;
981
981
RAction act = actions.get_action_list (grabber->current_class ->get ())->handle (s, ranking);
982
982
if (!IS_CLICK (act))
983
983
Ranking::queue_show (ranking, e);
984
984
if (!act) {
985
985
XkbBell (dpy, None, 0 , None);
986
- return parent->replace_child (NULL );
986
+ return parent->replace_child (nullptr );
987
987
}
988
988
RModifiers mods = act->prepare ();
989
989
if (IS_CLICK (act))
@@ -1008,7 +1008,7 @@ class StrokeHandler : public Handler, public sigc::trackable {
1008
1008
unsetenv (" EASYSTROKE_Y1" );
1009
1009
unsetenv (" EASYSTROKE_X2" );
1010
1010
unsetenv (" EASYSTROKE_Y2" );
1011
- parent->replace_child (NULL );
1011
+ parent->replace_child (nullptr );
1012
1012
}
1013
1013
public:
1014
1014
StrokeHandler (guint b, RTriple e) :
@@ -1098,7 +1098,7 @@ std::string XState::select_window() {
1098
1098
return grabber->current_class ->get ();
1099
1099
}
1100
1100
1101
- XState::XState () : current_dev(NULL ), in_proximity(false ), accepted(true ) {
1101
+ XState::XState () : current_dev(nullptr ), in_proximity(false ), accepted(true ), modifiers( 0 ) {
1102
1102
int n, opcode, event, error;
1103
1103
char **ext = XListExtensions (dpy, &n);
1104
1104
for (int i = 0 ; i < n; i++)
0 commit comments