prepinani oken...

Ján Tomka jan.tomka na stonline.sk
Sobota Únor 23 05:10:42 CET 2002


On Thu, Feb 21, 2002 at 11:11:11PM +0100, Pavel Dobes wrote:
> pomoci Alt+Tab, ale stale mi chybi moznost na kterou jem si zvykl u ms 
> windows - drzet Alt a pomoci Tab prepinat pouze po ikonach v dialogu, 

dobry den,

tento patch namiesto prepinania okien otvori v strede obrazovky zoznam
okien (ak ho uz nemate sami otvoreny) a az po pusteni alt prepne na
vybrane okno.

s pozdravom,
	judas
-- 
[judas na hell judas]$ whatis life
life: nothing appropriate
------------- další část ---------------
--- wm/src/cycling.c	Fri Jan  4 23:14:54 2002
+++ wm-menu-cycle/src/cycling.c	Sat Feb 23 04:50:46 2002
@@ -170,6 +170,31 @@
 }
 
 
+static void
+updateSwitchMenu(WScreen *scr, WWindow *wwin)
+{
+    int i;
+    WMenu *switchmenu = scr->switch_menu;
+    WMenuEntry *entry;
+ 
+    for (i = 0; i < switchmenu->entry_no; i++) {
+	entry = switchmenu->entries[i];
+	
+	if (entry->clientdata == wwin) {
+	    entry->flags.indicator_type = MI_DIAMOND;
+	    entry->flags.indicator_on = 1;
+	} else if (entry->flags.indicator_on && entry->flags.indicator_type == MI_DIAMOND) {
+	    if (((WWindow *)entry->clientdata)->flags.shaded) {
+		entry->flags.indicator_type = MI_SHADED;
+		entry->flags.indicator_on = 1;
+	    } else
+		entry->flags.indicator_on = 0;
+	}
+	
+    }
+
+    wMenuPaint(switchmenu);
+}
 
 
 void
@@ -177,7 +202,7 @@
 {
     WScreen *scr = wScreenForRootWindow(event->xkey.root);
     Bool done = False;
-    Bool openedSwitchMenu = False;
+    Bool openedSwitchMenu = True;
     WWindow *newFocused;
     WWindow *oldFocused;
     int modifiers;
@@ -217,9 +242,6 @@
     scr->flags.doing_alt_tab = 1;
 
 
-    if (wPreferences.circ_raise)
-	XRaiseWindow(dpy, newFocused->frame->core->window);
-    wWindowFocus(newFocused, scr->focused_window);
     oldFocused = newFocused;
 
     if (hasModifier)
@@ -227,14 +249,18 @@
     else
 	done = True;
     
-#if 0
-    if (wPreferences.popup_switchmenu && 
-	(!scr->switch_menu || !scr->switch_menu->flags.mapped)) {
+    if (!scr->switch_menu) {
+	OpenSwitchMenu(scr, scr->scr_width / 2,	scr->scr_height / 2, False);
+	wMenuMove(scr->switch_menu, (scr->scr_width - scr->switch_menu->frame->core->width) / 2,
+		(scr->scr_height - scr->switch_menu->frame->core->height) / 2, True);
+    } else if (!scr->switch_menu->flags.mapped)
+	OpenSwitchMenu(scr, scr->scr_width / 2,
+		(scr->scr_height - scr->switch_menu->frame->core->height) / 2, False);
+    else
+	openedSwitchMenu = False;
+
+    updateSwitchMenu(scr, newFocused);
 
-	OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, False);
-	openedSwitchMenu = True;
-    }
-#endif
     while (!done) {
 	WMMaskEvent(dpy,KeyPressMask|KeyReleaseMask|ExposureMask, &ev);
 
@@ -250,28 +276,28 @@
 		&& wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) {
 
 		newFocused = nextToFocusAfter(newFocused);
-		wWindowFocus(newFocused, oldFocused);
 		oldFocused = newFocused;
 	    
 		if (wPreferences.circ_raise) {
 		    /* restore order */
 		    CommitStacking(scr);
-		    XRaiseWindow(dpy, newFocused->frame->core->window);
 		}
 
+		updateSwitchMenu(scr, newFocused);
+
 	    } else if (wKeyBindings[WKBD_FOCUSPREV].keycode == ev.xkey.keycode
 		       && wKeyBindings[WKBD_FOCUSPREV].modifier == modifiers) {
 
 		newFocused = nextToFocusBefore(newFocused);
-		wWindowFocus(newFocused, oldFocused);
 		oldFocused = newFocused;
 
 		if (wPreferences.circ_raise) {
 		    /* restore order */
 		    CommitStacking(scr);
-		    XRaiseWindow(dpy, newFocused->frame->core->window);
 		}
 
+		updateSwitchMenu(scr, newFocused);
+
 	    } else {
 		somethingElse = True;
 		done = True;
@@ -295,6 +321,7 @@
     if (hasModifier) {
 	XUngrabKeyboard(dpy, CurrentTime);
     }
+    XRaiseWindow(dpy, newFocused->frame->core->window);
     wSetFocusTo(scr, newFocused);
 
     if (wPreferences.circ_raise) {
@@ -304,7 +331,8 @@
 
     scr->flags.doing_alt_tab = 0;
     if (openedSwitchMenu) 
-	OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, False);
+	OpenSwitchMenu(scr, scr->scr_width  / 2,
+		(scr->scr_height - scr->switch_menu->frame->core->height) / 2, False);
     
     if (somethingElse) {
 	WMHandleEvent(&ev);
------------- další část ---------------
A non-text attachment was scrubbed...
Name: [žádný popis není k dispozici]
Type: application/pgp-signature
Size: 232 bytes
Desc: [žádný popis není k dispozici]
URL: <http://www.linux.cz/pipermail/linux/attachments/20020223/76ffcd84/attachment.sig>


Další informace o konferenci Linux