Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        Makefile.am ewl_tooltip.h ewl_window.c ewl_window.h 


Log Message:
Added an API to the window to allow manipulating the window name and class.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/Makefile.am,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- Makefile.am 22 Dec 2003 17:29:15 -0000      1.38
+++ Makefile.am 30 Dec 2003 18:05:22 -0000      1.39
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-INCLUDES = @edje_cflags@ @ecore_cflags@ @edb_cflags@ @evas_cflags@ @ewd_cflags@ 
@etox_cflags@
+INCLUDES = @edje_cflags@ @ecore_cflags@ @edb_cflags@ @evas_cflags@ @ewd_cflags@ 
@etox_cflags@ -pg
 
 lib_LTLIBRARIES = libewl.la
 
@@ -103,4 +103,4 @@
        ewl_window.c
 
 libewl_la_LIBADD = @edje_libs@ @ecore_libs@ @edb_libs@ @evas_libs@ @ewd_libs@ 
@etox_libs@ -lm
-libewl_la_LDFLAGS = -version-info 0:0:0
+libewl_la_LDFLAGS = -version-info 0:0:0 -pg
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_tooltip.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_tooltip.h       23 Dec 2003 21:38:51 -0000      1.3
+++ ewl_tooltip.h       30 Dec 2003 18:05:22 -0000      1.4
@@ -6,14 +6,14 @@
 #define EWL_TOOLTIP(tt) ((Ewl_Tooltip *) tt)
 
 struct _ewl_tooltip {
-       Ewl_Floater box;   /* the box container */
+       Ewl_Floater box;    /**< the floating box container */
 
-       Ewl_Widget  *text;  /* the text displaying in the tooltip */
+       Ewl_Widget  *text;  /**< the text displaying in the tooltip */
 
-       double      delay;  /* how long before tooltip will display in secs */
-       int         hide;   /* flag to enable/disable tooltip */
+       double      delay;  /**< how long before tooltip will display in secs */
+       int         hide;   /**< flag to enable/disable tooltip */
 
-       Ecore_Timer *timer; /* pointer to the focus timer */
+       Ecore_Timer *timer; /**< pointer to the focus timer */
 };
 
 Ewl_Widget *ewl_tooltip_new (Ewl_Widget *parent);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -3 -r1.66 -r1.67
--- ewl_window.c        20 Nov 2003 02:21:29 -0000      1.66
+++ ewl_window.c        30 Dec 2003 18:05:22 -0000      1.67
@@ -84,6 +84,9 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("win", win);
 
+       if (!title)
+               title = "";
+
        if (strcmp(win->title, title)) {
                IF_FREE(win->title);
                win->title = strdup(title);
@@ -113,6 +116,97 @@
 }
 
 /**
+ * @param win: the window to change the name
+ * @param name: the name to set for the window
+ * @return Returns no value.
+ * @brief Set the name of the specified window
+ *
+ * Sets the name of window @a w to @a name and calls the necessary X lib
+ * functions to update the window.
+ */
+void ewl_window_set_name(Ewl_Window * win, char *name)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("win", win);
+
+       if (!name)
+               name = "";
+
+       if (strcmp(win->name, name)) {
+               IF_FREE(win->name);
+               win->name = strdup(name);
+       }
+
+       if (!REALIZED(win))
+               return;
+
+       ecore_x_window_prop_name_class_set(win->window, name, win->name);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param win: the window to retrieve the window
+ * @return Returns a pointer to a new copy of the name, NULL on failure.
+ * @brief Retrieve the name of the specified window
+ *
+ * The returned name should be freed.
+ */
+char           *ewl_window_get_name(Ewl_Window * win)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("win", win, NULL);
+
+       DRETURN_PTR(strdup(win->name), DLEVEL_STABLE);
+}
+
+/**
+ * @param win: the window to change the class
+ * @param classname: the class to set for the window
+ * @return Returns no value.
+ * @brief Set the class of the specified window
+ *
+ * Sets the class of window @a w to @a class and calls the necessary X lib
+ * functions to update the window.
+ */
+void ewl_window_set_class(Ewl_Window * win, char *classname)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("win", win);
+
+       if (!classname)
+               classname = "";
+
+       if (strcmp(win->classname, classname)) {
+               IF_FREE(win->classname);
+               win->classname = strdup(classname);
+       }
+
+       if (!REALIZED(win))
+               return;
+
+       ecore_x_window_prop_name_class_set(win->window, classname,
+                                          win->classname);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param win: the window to retrieve the window
+ * @return Returns a pointer to a new copy of the class, NULL on failure.
+ * @brief Retrieve the class of the specified window
+ *
+ * The returned class should be freed.
+ */
+char           *ewl_window_get_class(Ewl_Window * win)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("win", win, NULL);
+
+       DRETURN_PTR(strdup(win->classname), DLEVEL_STABLE);
+}
+
+/**
  * @param win: the window to remove the border
  * @return Returns no value.
  * @brief Remove the border from the specified window
@@ -194,7 +288,9 @@
        ewl_embed_init(EWL_EMBED(w));
        ewl_widget_set_appearance(EWL_WIDGET(w), "window");
        ewl_object_set_fill_policy(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
-       w->title = strdup("EWL!");
+       w->title = strdup("EWL");
+       w->name = strdup("EWL");
+       w->classname  = strdup("EWL");
 
        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
                             ewl_window_realize_cb, NULL);
@@ -241,7 +337,8 @@
                        ewl_object_get_current_w(o),
                        ewl_object_get_current_h(o));
 
-       ecore_x_window_prop_name_class_set(window->window, "EWL", "EWL!");
+       ecore_x_window_prop_name_class_set(window->window, window->name,
+                                          window->classname);
        ecore_x_window_prop_title_set(window->window, window->title);
        ecore_x_window_prop_protocol_set(window->window,
                        ECORE_X_WM_PROTOCOL_DELETE_REQUEST,1);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- ewl_window.h        25 Nov 2003 07:47:29 -0000      1.25
+++ ewl_window.h        30 Dec 2003 18:05:22 -0000      1.26
@@ -34,6 +34,8 @@
        Ecore_X_Window  window; /**< Provides a window for drawing */
 
        char           *title; /**< The current title on the provided window */
+       char           *name; /**< Current name on the provided window */
+       char           *classname; /**< Current class on the provided window */
 
         
        Ewl_Window_Flags flags; /**< Flags indicating window properties */
@@ -47,6 +49,10 @@
 Ewl_Window     *ewl_window_find_window(Ecore_X_Window window);
 void            ewl_window_set_title(Ewl_Window * win, char *title);
 char           *ewl_window_get_title(Ewl_Window * win);
+void            ewl_window_set_name(Ewl_Window * win, char *name);
+char           *ewl_window_get_name(Ewl_Window * win);
+void            ewl_window_set_class(Ewl_Window * win, char *classname);
+char           *ewl_window_get_class(Ewl_Window * win);
 void            ewl_window_set_borderless(Ewl_Window * win);
 void            ewl_window_move(Ewl_Window * win, int x, int y);
 void            ewl_window_get_position(Ewl_Window * win, int *x, int *y);




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to