]> gitweb.factorcode.org Git - factor.git/commitdiff
X11 UI: Fix resize flicker, exception when closing window, unsuccessful attempt at...
authorslava <slava@linux-vm.(none)>
Fri, 10 Apr 2009 17:29:07 +0000 (13:29 -0400)
committerslava <slava@linux-vm.(none)>
Fri, 10 Apr 2009 17:29:07 +0000 (13:29 -0400)
basis/ui/backend/x11/x11.factor
basis/ui/ui.factor
basis/x11/windows/windows.factor

index 422efbd188c66236757173f0227c5abedaf202bb..5a2a8974e7b2a3b76217ecb2ccec762b55fe1590 100755 (executable)
@@ -224,6 +224,10 @@ M: x-clipboard paste-clipboard
     [ XA_NET_WM_NAME XA_UTF8_STRING 8 PropModeReplace ] dip
     utf8 encode dup length XChangeProperty drop ;
 
+: set-class ( dpy window -- )
+    XA_WM_CLASS XA_STRING 8 PropModeReplace "Factor"
+    utf8 encode dup length XChangeProperty drop ;
+
 M: x11-ui-backend set-title ( string world -- )
     handle>> window>> swap
     [ dpy get ] 2dip [ set-title-old ] [ set-title-new ] 3bi ;
@@ -242,11 +246,15 @@ M: x11-ui-backend set-fullscreen* ( ? world -- )
 
 M: x11-ui-backend (open-window) ( world -- )
     dup gadget-window
-    handle>> window>> dup set-closable map-window ;
+    handle>> window>>
+    [ set-closable ] [ dpy get swap set-class ] [ map-window ] tri ;
 
 M: x11-ui-backend raise-window* ( world -- )
     handle>> [
-        dpy get swap window>> XRaiseWindow drop
+        dpy get swap window>>
+        [ RevertToPointerRoot CurrentTime XSetInputFocus drop ]
+        [ XRaiseWindow drop ]
+        2bi
     ] when* ;
 
 M: x11-handle select-gl-context ( handle -- )
index 1de3912f2861beb3df299ff184e106a3ef86f07c..8be486cb1a32fc646f35aa7183d002dfb0974102 100644 (file)
@@ -12,10 +12,7 @@ IN: ui
 ! Assoc mapping aliens to gadgets
 SYMBOL: windows
 
-ERROR: no-window handle ;
-
-: window ( handle -- world )
-    windows get-global ?at [ no-window ] unless ;
+: window ( handle -- world ) windows get-global at ;
 
 : window-focus ( handle -- gadget ) window world-focus ;
 
@@ -199,4 +196,4 @@ M: object close-window
 : with-ui ( quot -- )
     ui-running? [ call( -- ) ] [ '[ init-ui @ ] (with-ui) ] if ;
 
-HOOK: beep ui-backend ( -- )
\ No newline at end of file
+HOOK: beep ui-backend ( -- )
index 9619ae0bee3f1e252a04f94a81fa8bd3256947a0..8085907bef7c8e2fb950fd60738134376033d3d6 100644 (file)
@@ -6,10 +6,10 @@ arrays fry ;
 IN: x11.windows
 
 : create-window-mask ( -- n )
-    { CWBackPixel CWBorderPixel CWColormap CWEventMask } flags ;
+    { CWColormap CWEventMask } flags ;
 
 : create-colormap ( visinfo -- colormap )
-    dpy get root get rot XVisualInfo-visual AllocNone
+    [ dpy get root get ] dip XVisualInfo-visual AllocNone
     XCreateColormap ;
 
 : event-mask ( -- n )
@@ -29,8 +29,6 @@ IN: x11.windows
 
 : window-attributes ( visinfo -- attributes )
     "XSetWindowAttributes" <c-object>
-    0 over set-XSetWindowAttributes-background_pixel
-    0 over set-XSetWindowAttributes-border_pixel
     [ [ create-colormap ] dip set-XSetWindowAttributes-colormap ] keep
     event-mask over set-XSetWindowAttributes-event_mask ;