@@ -15,22 +15,23 @@ use x11::xlib::{
15
15
} ;
16
16
17
17
use rwm:: {
18
+ drw,
18
19
enums:: { Col , Scheme , XEmbed } ,
19
- Arg , Client , Monitor , Window ,
20
+ util:: ecalloc,
21
+ Arg , Client , Monitor , State , Window ,
20
22
} ;
21
23
22
24
use crate :: {
23
25
arrange, cleanmask,
24
26
config:: CONFIG ,
25
- configure, drawbar, drawbars, drw ,
27
+ configure, drawbar, drawbars,
26
28
enums:: { Clk , Net } ,
27
29
focus, get_scheme_color, getsystraywidth, grabkeys, height, is_visible,
28
30
manage, recttomon, removesystrayicon, resizebarwin, resizeclient, restack,
29
31
sendevent, setclientstate, setfocus, setfullscreen, seturgent,
30
32
swallowingclient, textw, unfocus, unmanage, updatebars, updategeom,
31
33
updatesizehints, updatestatus, updatesystray, updatesystrayicongeom,
32
34
updatesystrayiconstate, updatetitle, updatewindowtype, updatewmhints,
33
- util:: ecalloc,
34
35
width, wintoclient, wintomon, wintosystrayicon,
35
36
xembed:: {
36
37
SYSTEM_TRAY_REQUEST_DOCK , XEMBED_EMBEDDED_NOTIFY ,
@@ -41,7 +42,7 @@ use crate::{
41
42
SW , SYSTRAY , WITHDRAWN_STATE ,
42
43
} ;
43
44
44
- pub ( crate ) fn buttonpress ( e : * mut XEvent ) {
45
+ pub ( crate ) fn buttonpress ( state : & State , e : * mut XEvent ) {
45
46
unsafe {
46
47
let mut arg = Arg :: I ( 0 ) ;
47
48
let ev = & ( * e) . button ;
@@ -104,13 +105,13 @@ pub(crate) fn buttonpress(e: *mut XEvent) {
104
105
} else {
105
106
& button. arg
106
107
} ;
107
- f ( a)
108
+ f ( state , a)
108
109
}
109
110
}
110
111
}
111
112
}
112
113
113
- pub ( crate ) fn clientmessage ( e : * mut XEvent ) {
114
+ pub ( crate ) fn clientmessage ( _state : & State , e : * mut XEvent ) {
114
115
unsafe {
115
116
let cme = & ( * e) . client_message ;
116
117
let mut c = wintoclient ( cme. window ) ;
@@ -273,7 +274,7 @@ pub(crate) fn clientmessage(e: *mut XEvent) {
273
274
}
274
275
}
275
276
276
- pub ( crate ) fn configurerequest ( e : * mut XEvent ) {
277
+ pub ( crate ) fn configurerequest ( _state : & State , e : * mut XEvent ) {
277
278
unsafe {
278
279
let ev = & ( * e) . configure_request ;
279
280
let c = wintoclient ( ev. window ) ;
@@ -351,7 +352,7 @@ pub(crate) fn configurerequest(e: *mut XEvent) {
351
352
}
352
353
}
353
354
354
- pub ( crate ) fn configurenotify ( e : * mut XEvent ) {
355
+ pub ( crate ) fn configurenotify ( state : & State , e : * mut XEvent ) {
355
356
unsafe {
356
357
let ev = & mut ( * e) . configure ;
357
358
/* TODO: updategeom handling sucks, needs to be simplified */
@@ -361,7 +362,7 @@ pub(crate) fn configurenotify(e: *mut XEvent) {
361
362
SH = ev. height ;
362
363
if updategeom ( ) != 0 || dirty {
363
364
drw:: resize ( DRW , SW as c_uint , BH as c_uint ) ;
364
- updatebars ( ) ;
365
+ updatebars ( state ) ;
365
366
let mut m = MONS ;
366
367
while !m. is_null ( ) {
367
368
let mut c = ( * m) . clients ;
@@ -381,7 +382,7 @@ pub(crate) fn configurenotify(e: *mut XEvent) {
381
382
}
382
383
}
383
384
384
- pub ( crate ) fn destroynotify ( e : * mut XEvent ) {
385
+ pub ( crate ) fn destroynotify ( _state : & State , e : * mut XEvent ) {
385
386
unsafe {
386
387
let ev = & ( * e) . destroy_window ;
387
388
let mut c = wintoclient ( ev. window ) ;
@@ -403,7 +404,7 @@ pub(crate) fn destroynotify(e: *mut XEvent) {
403
404
}
404
405
}
405
406
406
- pub ( crate ) fn enternotify ( e : * mut XEvent ) {
407
+ pub ( crate ) fn enternotify ( _state : & State , e : * mut XEvent ) {
407
408
log:: trace!( "enternotify" ) ;
408
409
unsafe {
409
410
let ev = & mut ( * e) . crossing ;
@@ -424,7 +425,7 @@ pub(crate) fn enternotify(e: *mut XEvent) {
424
425
}
425
426
}
426
427
427
- pub ( crate ) fn expose ( e : * mut XEvent ) {
428
+ pub ( crate ) fn expose ( _state : & State , e : * mut XEvent ) {
428
429
unsafe {
429
430
let ev = & ( * e) . expose ;
430
431
if ev. count == 0 {
@@ -440,7 +441,7 @@ pub(crate) fn expose(e: *mut XEvent) {
440
441
}
441
442
442
443
/* there are some broken focus acquiring clients needing extra handling */
443
- pub ( crate ) fn focusin ( e : * mut XEvent ) {
444
+ pub ( crate ) fn focusin ( _state : & State , e : * mut XEvent ) {
444
445
unsafe {
445
446
let ev = & ( * e) . focus_change ;
446
447
if !( * SELMON ) . sel . is_null ( ) && ev. window != ( * ( * SELMON ) . sel ) . win {
@@ -449,7 +450,7 @@ pub(crate) fn focusin(e: *mut XEvent) {
449
450
}
450
451
}
451
452
452
- pub ( crate ) fn keypress ( e : * mut XEvent ) {
453
+ pub ( crate ) fn keypress ( state : & State , e : * mut XEvent ) {
453
454
unsafe {
454
455
let ev = & mut ( * e) . key ;
455
456
let keysym = xlib:: XKeycodeToKeysym ( DPY , ev. keycode as KeyCode , 0 ) ;
@@ -458,13 +459,13 @@ pub(crate) fn keypress(e: *mut XEvent) {
458
459
&& cleanmask ( key. mod_ ) == cleanmask ( ev. state )
459
460
&& key. func . is_some ( )
460
461
{
461
- key. func . unwrap ( ) ( & ( key. arg ) ) ;
462
+ key. func . unwrap ( ) ( state , & ( key. arg ) ) ;
462
463
}
463
464
}
464
465
}
465
466
}
466
467
467
- pub ( crate ) fn mappingnotify ( e : * mut XEvent ) {
468
+ pub ( crate ) fn mappingnotify ( _state : & State , e : * mut XEvent ) {
468
469
unsafe {
469
470
let ev = & mut ( * e) . mapping ;
470
471
xlib:: XRefreshKeyboardMapping ( ev) ;
@@ -474,7 +475,7 @@ pub(crate) fn mappingnotify(e: *mut XEvent) {
474
475
}
475
476
}
476
477
477
- pub ( crate ) fn maprequest ( e : * mut XEvent ) {
478
+ pub ( crate ) fn maprequest ( _state : & State , e : * mut XEvent ) {
478
479
static mut WA : XWindowAttributes = XWindowAttributes {
479
480
x : 0 ,
480
481
y : 0 ,
@@ -534,7 +535,7 @@ pub(crate) fn maprequest(e: *mut XEvent) {
534
535
}
535
536
}
536
537
537
- pub ( crate ) fn motionnotify ( e : * mut XEvent ) {
538
+ pub ( crate ) fn motionnotify ( _state : & State , e : * mut XEvent ) {
538
539
log:: trace!( "motionnotify" ) ;
539
540
static mut MON : * mut Monitor = null_mut ( ) ;
540
541
unsafe {
@@ -552,7 +553,7 @@ pub(crate) fn motionnotify(e: *mut XEvent) {
552
553
}
553
554
}
554
555
555
- pub ( crate ) fn propertynotify ( e : * mut XEvent ) {
556
+ pub ( crate ) fn propertynotify ( _state : & State , e : * mut XEvent ) {
556
557
log:: trace!( "propertynotify" ) ;
557
558
unsafe {
558
559
let mut trans: Window = 0 ;
@@ -615,7 +616,7 @@ pub(crate) fn propertynotify(e: *mut XEvent) {
615
616
}
616
617
}
617
618
618
- pub ( crate ) fn unmapnotify ( e : * mut XEvent ) {
619
+ pub ( crate ) fn unmapnotify ( _state : & State , e : * mut XEvent ) {
619
620
log:: trace!( "unmapnotify" ) ;
620
621
unsafe {
621
622
let ev = & ( * e) . unmap ;
@@ -639,7 +640,7 @@ pub(crate) fn unmapnotify(e: *mut XEvent) {
639
640
}
640
641
}
641
642
642
- pub ( crate ) fn resizerequest ( e : * mut XEvent ) {
643
+ pub ( crate ) fn resizerequest ( _state : & State , e : * mut XEvent ) {
643
644
log:: trace!( "resizerequest" ) ;
644
645
unsafe {
645
646
let ev = & ( * e) . resize_request ;
0 commit comments