All pastes #335639 Raw Edit

Mine

public text v1 · immutable
·published 2007-02-01 14:19 UTC
rendered paste body
Index: src/group/group.h
===================================================================
--- src/group/group.h	(Revision 3540)
+++ src/group/group.h	(Arbeitskopie)
@@ -400,10 +400,7 @@
 	int oldTopTabCenterX;
 	int oldTopTabCenterY;
 
-	struct {	
-		Window id;
-		Bool mapped;
-	} inputPrevention;
+	Window inputPrevention;
 
 	GLushort color[4];
 };
Index: src/group/init.c
===================================================================
--- src/group/init.c	(Revision 3540)
+++ src/group/init.c	(Arbeitskopie)
@@ -95,8 +95,8 @@
 				groupDestroyCairoLayer(d->screens, group->tabBar->bgLayer);
 				groupDestroyCairoLayer(d->screens, group->tabBar->selectionLayer);
 
-				if (group->inputPrevention.id)
-					XDestroyWindow(d->display, group->inputPrevention.id);
+				if (group->inputPrevention)
+					XDestroyWindow(d->display, group->inputPrevention);
 
 				if (group->tabBar->region)
 					XDestroyRegion(group->tabBar->region);
Index: src/group/tab.c
===================================================================
--- src/group/tab.c	(Revision 3540)
+++ src/group/tab.c	(Arbeitskopie)
@@ -2052,16 +2052,15 @@
 void
 groupSwitchTopTabInput(CompScreen *s, GroupSelection *group, Bool enable)
 {
-	if(!group->tabBar || !group->inputPrevention.id)
+	if(!group->tabBar || !HAS_TOP_WIN(group) || !group->inputPrevention)
 		return;
 
-	if (!enable && !group->inputPrevention.mapped) {
-		XMapWindow(s->display->display, group->inputPrevention.id);
-		group->inputPrevention.mapped = TRUE;
-	} else if (enable && group->inputPrevention.mapped) {
-		XUnmapWindow(s->display->display, group->inputPrevention.id);
-		group->inputPrevention.mapped = FALSE;
-	}
+	CompWindow *w = TOP_TAB(group);
+
+	if (!enable) 
+		XMapRaised(s->display->display, group->inputPrevention);
+	else 
+		XUnmapWindow(s->display->display, group->inputPrevention);
 }
 
 /*
@@ -2073,21 +2072,23 @@
 {
 	XWindowChanges xwc; 
 	
-	if(!group->tabBar || !HAS_TOP_WIN(group) || !group->inputPrevention.id)
+	if(!group->tabBar || !HAS_TOP_WIN(group) || !group->inputPrevention)
 		return;
 
-	xwc.stack_mode = Above; 
-	xwc.sibling = TOP_TAB(group)->id; 
+	CompWindow *w = TOP_TAB(group);
 
-	xwc.x = group->tabBar->leftSpringX;
-	xwc.y = group->tabBar->region->extents.y1; 
+	xwc.x = group->tabBar->leftSpringX - WIN_X(w);
+	xwc.y = group->tabBar->region->extents.y1 - WIN_Y(w); 
 	xwc.width = group->tabBar->rightSpringX - group->tabBar->leftSpringX;
 	xwc.height = group->tabBar->region->extents.y2 - group->tabBar->region->extents.y1; 
 
-	XConfigureWindow(s->display->display, 
-			group->inputPrevention.id, 
-			CWSibling | CWStackMode | CWX | CWY | CWWidth | CWHeight, 
-			&xwc); 
+	XReparentWindow(s->display->display, group->inputPrevention,
+			w->id, xwc.x, xwc.y);
+
+	XConfigureWindow(s->display->display, group->inputPrevention, 
+			CWX | CWY | CWWidth | CWHeight, &xwc); 
+
+	XRaiseWindow(s->display->display, group->inputPrevention);
 }
 
 /*
@@ -2096,13 +2097,13 @@
  */
 void groupCreateInputPreventionWindow(CompScreen *s, GroupSelection* group)
 {
-	if (!group->inputPrevention.id)    //For preventing a memory leak. 
+	if (!group->inputPrevention)    //For preventing a memory leak. 
 	{ 
 		XSetWindowAttributes attrib; 
 		attrib.override_redirect = TRUE;
 		attrib.event_mask = ButtonPressMask;
 
-		group->inputPrevention.id = XCreateWindow(s->display->display, s->root,  
+		group->inputPrevention = XCreateWindow(s->display->display, s->root,  
 							-100, -100, 1, 1, 0, CopyFromParent,  
 							InputOnly, CopyFromParent,  
 							CWOverrideRedirect | CWEventMask, &attrib); 
@@ -2115,11 +2116,11 @@
  */
 void groupDestroyInputPreventionWindow(CompScreen *s, GroupSelection* group)
 {
-	if(group->inputPrevention.id) 
+	if(group->inputPrevention) 
 	{ 
-		XDestroyWindow(s->display->display, group->inputPrevention.id); 
+		XDestroyWindow(s->display->display, group->inputPrevention); 
 
-		group->inputPrevention.id = 0; 
+		group->inputPrevention = None; 
 	}
 
 	if (group->tabBar)
Index: src/group/paint.c
===================================================================
--- src/group/paint.c	(Revision 3540)
+++ src/group/paint.c	(Arbeitskopie)
@@ -312,14 +312,13 @@
 
 	/* FIXME: remove this after finding out how to get move notifies for input only windows */
 #if 1		
-	if (bar->mouseOver && group->inputPrevention.id) {
+	if (bar->mouseOver && group->inputPrevention) {
 		Bool hasText = FALSE;
 		Bool animation = FALSE;
 		int mouseX, mouseY;
 
 		groupGetCurrentMousePosition(s->display, &mouseX, &mouseY);
 
-
 		if (!(bar->lastHoveredSlot &&
 			XPointInRegion(bar->lastHoveredSlot->region, mouseX, mouseY)))
 		{
Index: src/group/group.c
===================================================================
--- src/group/group.c	(Revision 3540)
+++ src/group/group.c	(Arbeitskopie)
@@ -409,8 +409,7 @@
 		g->grabWindow = None;
 		g->grabMask = 0;
 		
-		g->inputPrevention.id = None;
-		g->inputPrevention.mapped = FALSE;
+		g->inputPrevention = None;
 
 		g->oldTopTabCenterX = 0;
 		g->oldTopTabCenterY = 0;
@@ -645,7 +644,7 @@
 		GroupSelection *group;
 			
 		for (group = gd->groups; group; group = group->next) {
-			if (group->inputPrevention.id == event->xbutton.window) {
+			if (group->inputPrevention == event->xbutton.window) {
 				GroupTabBarSlot *slot;
 					
 				for (slot = group->tabBar->slots; slot; slot = slot->next) {