about summary refs log tree commit diff
path: root/xevents.c
diff options
context:
space:
mode:
authorokan <okan>2017-05-09 18:43:40 +0000
committerokan <okan>2017-05-09 18:43:40 +0000
commit4040f112e11c844e1226ac5c66c4da6e8ae72cc6 (patch)
tree76fd974d7eecc253a91f330b4fccbe457d27281b /xevents.c
parenta8527b56612b69f32906ea4547f08b99ae57e4d9 (diff)
parent16a2ccc225dc002e87f8f88481cbb8dc669a3d3e (diff)
downloadcwm-4040f112e11c844e1226ac5c66c4da6e8ae72cc6.tar.gz
cwm-4040f112e11c844e1226ac5c66c4da6e8ae72cc6.tar.xz
cwm-4040f112e11c844e1226ac5c66c4da6e8ae72cc6.zip
cvsimport
* refs/heads/master:
  drop obsolete comment
  Alter callbacks to take a struct instead of a growing number of arguments; greatly simplifies upcoming work.
  Ensure clients stay within the viewable bounds on placement, even with empty borders; based on a patch from Vadim Vygonets.
  Clean up, unify and accurately calculate edge distance with client move/resize actions, so as to not lose windows off the edge.
  Switch bwidth type; unfortunately X11 is inconsistent.
Diffstat (limited to 'xevents.c')
-rw-r--r--xevents.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/xevents.c b/xevents.c
index 2cfd12d..560cbb4 100644
--- a/xevents.c
+++ b/xevents.c
@@ -215,7 +215,6 @@ xev_handle_enternotify(XEvent *ee)
 		client_setactive(cc);
 }
 
-/* We can split this into two event handlers. */
 static void
 xev_handle_buttonpress(XEvent *ee)
 {
@@ -233,22 +232,23 @@ xev_handle_buttonpress(XEvent *ee)
 
 	if (mb == NULL)
 		return;
+	mb->cargs->xev = CWM_XEV_BTN;
 	switch (mb->context) {
 	case CWM_CONTEXT_CC:
 		if (((cc = client_find(e->window)) == NULL) &&
 		    (cc = client_current()) == NULL)
 			return;
-		(*mb->callback)(cc, &mb->argument, CWM_XEV_BTN);
+		(*mb->callback)(cc, mb->cargs);
 		break;
 	case CWM_CONTEXT_SC:
 		if (e->window != e->root)
 			return;
 		if ((sc = screen_find(e->window)) == NULL)
 			return;
-		(*mb->callback)(sc, &mb->argument, CWM_XEV_BTN);
+		(*mb->callback)(sc, mb->cargs);
 		break;
 	case CWM_CONTEXT_NONE:
-		(*mb->callback)(NULL, &mb->argument, CWM_XEV_BTN);
+		(*mb->callback)(NULL, mb->cargs);
 		break;
 	}
 }
@@ -295,20 +295,21 @@ xev_handle_keypress(XEvent *ee)
 
 	if (kb == NULL)
 		return;
+	kb->cargs->xev = CWM_XEV_KEY;
 	switch (kb->context) {
 	case CWM_CONTEXT_CC:
 		if (((cc = client_find(e->window)) == NULL) &&
 		    (cc = client_current()) == NULL)
 			return;
-		(*kb->callback)(cc, &kb->argument, CWM_XEV_KEY);
+		(*kb->callback)(cc, kb->cargs);
 		break;
 	case CWM_CONTEXT_SC:
 		if ((sc = screen_find(e->window)) == NULL)
 			return;
-		(*kb->callback)(sc, &kb->argument, CWM_XEV_KEY);
+		(*kb->callback)(sc, kb->cargs);
 		break;
 	case CWM_CONTEXT_NONE:
-		(*kb->callback)(NULL, &kb->argument, CWM_XEV_KEY);
+		(*kb->callback)(NULL, kb->cargs);
 		break;
 	}
 }