[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] _ecore_evas_x_fullscreen_set



Hi,

_ecore_evas_x_fullscreen_set has IMO some ICCCM non-compliance and other
evilness. You can see the effects of this e.g. when toggling fullscreen
state in entice (key f) in many WM's, including e17 and e16.

1) _ecore_evas_x_fullscreen_set starts with ecore_x_window_hide. This is
a window withdrawal (ICCCM). When a client withdraws itself by unmapping
the application window it should wait for the WM to reparent the window
to root or change/remove the WM_STATE hint before proceeding to mess
around with the window.
This is not done and causes problems for many WM's.

2) When entering fullscreen mode the window is changed to
override-redirect type to override WM control of borders, sizes, stacking etc.
This is in my opinion a very unusual and dubious use of the
override-redirect attribute.
I think that the whole fullscreen/unfullscreen thing should be left to
the WM, i.e. send an ECORE_X_WINDOW_STATE_FULLSCREEN client message to the root window and let the WM do whatever it does when fullscreening.
This will of course only work with EWMH compliant WM's, but do we
care about non-EWMH compliant ones?
If yes, I think _ecore_evas_x_fullscreen_set should detect this and fall back to the only other sane way to enter/leave fullscreen mode, i.e. use the standard mechanisms to resize/reposition the window and set/unset the borderless attribute (_MOTIF_WM_HINTS).

3) _ecore_evas_x_fullscreen_set messes with focus. IMO clients should
hardly ever do that (maybe except by requesting the WM) but again leave it to the WM. In this case I guess it was a hack required to get the override-redirect thing kind of working.

If there are no objections I will commit attached patch.

/Kim


Index: src/lib/ecore_evas/ecore_evas_x.c
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_evas/ecore_evas_x.c,v
retrieving revision 1.87
diff -u -r1.87 ecore_evas_x.c
--- src/lib/ecore_evas/ecore_evas_x.c	11 Aug 2006 02:26:16 -0000	1.87
+++ src/lib/ecore_evas/ecore_evas_x.c	11 Aug 2006 02:34:56 -0000
@@ -1940,72 +1940,16 @@
 static void
 _ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on)
 {
-   if (((ee->prop.fullscreen) && (on)) ||
-       ((!ee->prop.fullscreen) && (!on))) return;
-   ecore_x_window_hide(ee->engine.x.win);
-   ecore_x_window_override_set(ee->engine.x.win, on);
-   if (on)
-     {
-	int rw, rh;
-	
-	ecore_x_window_size_get(0, &rw, &rh);
-	ecore_x_window_raise(ee->engine.x.win);
-	ecore_x_window_show(ee->engine.x.win);
-	ecore_x_window_focus(ee->engine.x.win);
-	ee->engine.x.px = ee->x;
-	ee->engine.x.py = ee->y;
-	ee->engine.x.pw = ee->w;
-	ee->engine.x.ph = ee->h;
-	ee->x = 0;
-	ee->y = 0;
-	ee->w = rw;
-	ee->h = rh;
-     }
-   else
-     {
-	ee->x = ee->engine.x.px;
-	ee->y = ee->engine.x.py;
-	ee->w = ee->engine.x.pw;
-	ee->h = ee->engine.x.ph;
-	ecore_x_window_move_resize(ee->engine.x.win, ee->engine.x.px, ee->engine.x.py, ee->engine.x.pw, ee->engine.x.ph);
-     }
+   if ((ee->prop.fullscreen && on) ||
+      (!ee->prop.fullscreen && !on)) return;
+
+   ee->prop.fullscreen = on;
+   ee->engine.x.state.fullscreen = on;
    if (ee->should_be_visible)
-     {
-	ecore_x_window_show(ee->engine.x.win);
-	ecore_x_window_focus(ee->engine.x.win);
-     }
-   ecore_x_window_move_resize(ee->engine.x.win, 0, 0, ee->w, ee->h);
-   if ((ee->rotation == 90) || (ee->rotation == 270))
-     {
-	evas_output_size_set(ee->evas, ee->h, ee->w);
-	evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
-     }
+     ecore_x_netwm_state_request_send(ee->engine.x.win, ee->engine.x.win_root,
+				      ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on);
    else
-     {
-	evas_output_size_set(ee->evas, ee->w, ee->h);
-	evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
-     }
-   if (ee->prop.avoid_damage)
-     {
-	ecore_evas_avoid_damage_set(ee, 0);
-	ecore_evas_avoid_damage_set(ee, 1);
-     }
-   if (ee->shaped)
-     _ecore_evas_x_resize_shape(ee);
-/*   
-   if ((ee->expecting_resize.w > 0) &&
-       (ee->expecting_resize.h > 0))
-     {
-	if ((ee->expecting_resize.w == ee->w) &&
-	    (ee->expecting_resize.h == ee->h))
-	  _ecore_evas_x_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
-					   ecore_x_current_time_get());
-	ee->expecting_resize.w = 0;
-	ee->expecting_resize.h = 0;
-     }
- */
-   ee->prop.fullscreen = on;
-   if (ee->func.fn_resize) ee->func.fn_resize(ee);	
+     _ecore_evas_x_state_update(ee);
 }
 
 static void