Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_window.c ewl_window.h 


Log Message:
API for setting windows transient for one another.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_window.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_window.c        28 Mar 2005 07:04:29 -0000      1.3
+++ ewl_window.c        10 Apr 2005 05:02:17 -0000      1.4
@@ -334,6 +334,38 @@
 }
 
 /**
+ * @param win: window to set transient
+ * @param forwin: the window to be transient for
+ * @return Returns no value.
+ * @brief Sets a window to be transient for another window.
+ */
+void ewl_window_transient_for(Ewl_Window *win, Ewl_Window *forwin)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("win", win);
+
+       win->transient = forwin;
+
+       if (forwin && REALIZED(win)) {
+#ifdef HAVE_EVAS_ENGINE_SOFTWARE_X11_H
+               if (REALIZED(forwin))
+                       
ecore_x_icccm_transient_for_set((Ecore_X_Window)win->window,
+                                                       
(Ecore_X_Window)forwin->window);
+               else
+                       ewl_callback_append(EWL_WIDGET(forwin),
+                                           EWL_CALLBACK_REALIZE,
+                                           ewl_window_realize_transient_cb,
+                                           win);
+#endif
+       }
+       else if (REALIZED(win)) {
+               ecore_x_icccm_transient_for_unset((Ecore_X_Window)win->window);
+       }
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
  * @param w: the window to be initialized to default values and callbacks
  * @return Returns TRUE or FALSE depending on if initialization succeeds.
  * @brief Initialize a window to default values and callbacks
@@ -549,6 +581,30 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        evas_object_pass_events_set(EWL_EMBED(w)->ev_clip, 1);
+       if (EWL_WINDOW(w)->transient)
+               ewl_window_transient_for(EWL_WINDOW(w),
+                                        EWL_WINDOW(w)->transient);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void ewl_window_realize_transient_cb(Ewl_Widget * w, void *ev_data __UNUSED__,
+                                    void *user_data)
+{
+       Ewl_Window *win = EWL_WINDOW(user_data);
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       /*
+        * Make sure the window is still transient for the realized window.
+        */
+       if (EWL_WIDGET(win->transient) == w)
+               ewl_window_transient_for(win, EWL_WINDOW(w));
+
+       /*
+        * Both windows realized so no need to keep the callback.
+        */
+       ewl_callback_del(EWL_WIDGET(win), EWL_CALLBACK_REALIZE,
+                        ewl_window_realize_transient_cb);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_window.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_window.h        9 Feb 2005 20:44:12 -0000       1.2
+++ ewl_window.h        10 Apr 2005 05:02:17 -0000      1.3
@@ -38,6 +38,7 @@
        Ewl_Embed       embed; /**< Inherits from the Ewl_Embed class */
 
        void           *window; /**< Provides a window for drawing */
+       Ewl_Window     *transient; /**< Window to be transient for */
 
        char           *title; /**< The current title on the provided window */
        char           *name; /**< Current name on the provided window */
@@ -65,6 +66,7 @@
 void            ewl_window_position_get(Ewl_Window * win, int *x, int *y);
 void            ewl_window_raise(Ewl_Window * win);
 void            ewl_window_lower(Ewl_Window * win);
+void            ewl_window_transient_for(Ewl_Window * win, Ewl_Window * 
forwin);
 
 /*
  * Internally used callbacks, override at your own risk.
@@ -73,6 +75,8 @@
                                     void *user_data);
 void            ewl_window_postrealize_cb(Ewl_Widget * w, void *ev_data,
                                     void *user_data);
+void            ewl_window_realize_transient_cb(Ewl_Widget * w, void *ev_data,
+                                               void *user_data);
 void            ewl_window_unrealize_cb(Ewl_Widget * w, void *ev_data,
                                     void *user_data);
 void            ewl_window_show_cb(Ewl_Widget * w, void *ev_data,




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to