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

Re: [E-devel] engage is ready for composite



Ok, the patch is so damn small. I just post it on the list for everyone
interested to try this out. :)
The patch is made with cvs diff -u in the engage/src dir.   

Usage:
Start compmgr, compiz or whatever does compositing.

then I encourage to use these params: 
engage -T false -m 0 -t gentoo  -b caffeeee -C 1 -P 1

I also included a timer for the redraw function. To me 25 fps are
enough and engage sucks with this only half as much cpu cylcles than
before.

Have Fun.


Regards,
Hannes
? engage-composite-redraw_timer.patch
? engage-composite.patch
Index: config.c
===================================================================
RCS file: /var/cvs/e/misc/engage/src/config.c,v
retrieving revision 1.58
diff -u -r1.58 config.c
--- config.c	25 Feb 2006 18:29:04 -0000	1.58
+++ config.c	30 Jul 2006 22:59:24 -0000
@@ -136,7 +136,14 @@
                               "ignore-running", "Ignore running apps");
   ecore_config_boolean_create("engage.options.ignore_iconified", 0, 'I',
                               "ignore-iconified", "Ignore iconified windows");
-
+  
+  
+  ecore_config_boolean_create("engage.options.use_composite", 0, 'C',
+                              "use-composite","Use with composite manager for nice transparency effects");
+   
+   ecore_config_boolean_create("engage.options.position_bug_workaround", 0, 'P',
+                              "position-bug-workaround","If the window seems to be at the bottom, ca. 5 pixels to high, try this");                          
+                              
   ecore_config_load();
   ret = ecore_config_args_parse();
 
@@ -179,7 +186,9 @@
   options.tray = ecore_config_boolean_get("engage.options.tray");
   options.ignore_run = ecore_config_boolean_get("engage.options.ignore_running");
   options.ignore_min = ecore_config_boolean_get("engage.options.ignore_iconified");
-
+  
+  options.use_composite = ecore_config_boolean_get("engage.options.use_composite");
+  options.position_bug_workaround = ecore_config_boolean_get("engage.options.position_bug_workaround");
   return ret;
 }
 
Index: dock.c
===================================================================
RCS file: /var/cvs/e/misc/engage/src/dock.c,v
retrieving revision 1.20
diff -u -r1.20 dock.c
--- dock.c	25 Oct 2005 00:54:54 -0000	1.20
+++ dock.c	30 Jul 2006 22:59:25 -0000
@@ -118,11 +118,25 @@
   need_redraw = true;
 }
 
+double lasttime = 0;
+
 void
 od_dock_redraw(Ecore_Evas * ee)
 {
-  Evas_List      *item = dock.icons;
+  
 
+    double time = ecore_time_get();
+	
+	if(time - lasttime < 0.04)
+	{
+	 // need_redraw = false; // ????
+	  return;
+	}
+    
+    lasttime = time;
+
+
+  Evas_List      *item = dock.icons;
   while (item) {
     OD_Icon        *icon = (OD_Icon *) item->data;
 
Index: engage.h
===================================================================
RCS file: /var/cvs/e/misc/engage/src/engage.h,v
retrieving revision 1.30
diff -u -r1.30 engage.h
--- engage.h	25 Oct 2005 00:54:54 -0000	1.30
+++ engage.h	30 Jul 2006 22:59:30 -0000
@@ -104,6 +104,7 @@
   unsigned        bg_fore, bg_back; // color - ARGB
   double          icon_appear_duration;
   int             tray, ignore_run, ignore_min;
+  int			  use_composite, position_bug_workaround;
 };
 
 struct _OD_Window {
Index: window.c
===================================================================
RCS file: /var/cvs/e/misc/engage/src/window.c,v
retrieving revision 1.31
diff -u -r1.31 window.c
--- window.c	13 Jun 2005 18:55:14 -0000	1.31
+++ window.c	30 Jul 2006 22:59:31 -0000
@@ -6,6 +6,8 @@
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
+#include <X11/extensions/shape.h>
+
 #ifdef XINERAMA
 #include <X11/extensions/Xinerama.h>
 #endif
@@ -32,6 +34,22 @@
 static void     handle_menu_draw(void *data, Evas * e, Evas_Object * obj,
                                  void *event);
 static void     od_window_set_hidden(int hidden);
+static void 	window_input_shape_rectangle_set(Ecore_X_Window win, int x, int y, int w, int h);
+
+
+static void
+window_input_shape_rectangle_set(Ecore_X_Window win, int x, int y, int w, int h)
+{
+   XRectangle rect;
+   
+   rect.x = x;
+   rect.y = y;
+   rect.width = w;
+   rect.height = h;
+   XShapeCombineRectangles(ecore_x_display_get(), win, ShapeInput, 0, 0, &rect, 1, ShapeSet, Unsorted);
+}
+
+
 int
 od_window_hide_timer_cb(void *data)
 {
@@ -82,6 +100,13 @@
 {
   if (_ee != ee)
     return;
+    
+  if(options.use_composite)
+  {
+    Ecore_X_Window win = ecore_evas_software_x11_window_get(_ee);
+    window_input_shape_rectangle_set(win,0,0,options.width,options.height);
+  }
+  
   if (mouse_focus_timer)
     ecore_timer_del(mouse_focus_timer);
   mouse_focus_timer = NULL;
@@ -94,6 +119,13 @@
 {
   if (_ee != ee)
     return;
+  
+  if(options.use_composite) // it should be enough to do this at zoom out, but so it looks less cluttered
+  { 
+    Ecore_X_Window win = ecore_evas_software_x11_window_get(_ee);
+    window_input_shape_rectangle_set(win,0,options.height-options.size,options.width,options.size);    
+  }
+    
   if (mouse_focus_timer)
     ecore_timer_del(mouse_focus_timer);
   mouse_focus_timer = ecore_timer_add(0.5, od_window_hide_timer_cb, NULL);
@@ -188,7 +220,7 @@
   if (!(strcmp(options.engine, "gl")))
     ee = ecore_evas_gl_x11_new(NULL, 0,
                                (int) ((res_x - options.width) / 2.0 + x),
-                               (int) (res_y - options.height + y),
+                               (int) (res_y - options.height + y), 
                                options.width, options.height);
   else {
     if (strcmp(options.engine, "software")) {
@@ -198,18 +230,33 @@
     }
     ee = ecore_evas_software_x11_new(NULL, 0,
                                      (int) ((res_x - options.width) / 2.0 + x),
-                                     (int) (res_y - options.height + y),
+                                     (int) (res_y - options.height + y), 
                                      options.width, options.height);
   }
 
   ecore_evas_title_set(ee, "Engage");
   ecore_evas_name_class_set(ee, "engage", "engage");
-  ecore_evas_borderless_set(ee, 1);
-  if (options.mode == OM_ONTOP) {
+ 
+  if(options.use_composite)
+  {
+    ecore_evas_alpha_set(ee, 1);
+    Ecore_X_Window win = ecore_evas_software_x11_window_get(ee);
+    ecore_x_window_override_set(win,1);
+    window_input_shape_rectangle_set(win,0,options.height-options.size,options.width,options.size);
+  }
+  else
+    ecore_evas_borderless_set(ee, 1);  
+
+
+
+  if (options.mode == OM_ONTOP) 
+  {
     ecore_evas_avoid_damage_set(ee, 1);
-    ecore_evas_shaped_set(ee, 1);
-  } else
+     if(!options.use_composite) ecore_evas_shaped_set(ee, 1);
+  } 
+  else
     ecore_evas_shaped_set(ee, 0);
+    
   ecore_evas_callback_post_render_set(ee, handle_post_render_cb);
   ecore_evas_callback_pre_render_set(ee, handle_pre_render_cb);
   ecore_evas_callback_delete_request_set(ee, handle_delete_cb);
@@ -234,11 +281,19 @@
                                  handle_mouse_move, NULL);
 
   od_window = ecore_evas_software_x11_window_get(ee);
-  printf("move %d %d\n", (int) ((res_x - options.width) / 2.0 + x),
-		                        (int) (res_y - options.height + y));
+ 
+ 
+//  printf("move %d %d\n", (int) ((res_x - options.width) / 2.0 + x),
+//		                        (int) (res_y - options.height + y);
+
+// its just a spell against bad magic... or the dirty tricks of naughty programmer :)
+  if(options.position_bug_workaround)
+  	y += 5;
+  	
   ecore_x_window_move(od_window,
                       (int) ((res_x - options.width) / 2.0 + x),
                       (int) (res_y - options.height + y));
+  
   ecore_x_netwm_window_type_set(od_window, ECORE_X_WINDOW_TYPE_DOCK);
 
   // Reserve a strut
@@ -317,6 +372,9 @@
 #endif
   }
 
+  od_dock_redraw(ee);
+  
+  
   if (options.auto_hide)
     od_window_hide();
 }
@@ -389,7 +447,14 @@
       od_dock_zoom_in();
     need_redraw = true;
   } else if (dock.state == zoomed || dock.state == zooming)
-    od_dock_zoom_out();
+  	{
+      od_dock_zoom_out();
+      if(options.use_composite)
+      {
+  	    Ecore_X_Window win = ecore_evas_software_x11_window_get(ee);
+        window_input_shape_rectangle_set(win, 0, options.height-options.size, options.width, options.size); 
+      }
+  	}
 }
 
 static void
@@ -398,8 +463,10 @@
   Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *) event;
 
 #ifdef HAVE_EWL
+/* this doesnt work with the override window or composite, dont know, have to look at it... */
+if(!options.use_composite)
   if (ev->button == 3)
-    od_config_menu_draw(ev->canvas.x, ev->canvas.y);
+      od_config_menu_draw(ev->canvas.x, ev->canvas.y);
 #endif
 }