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

[E-devel] Ecore_X_Icccm patch



Hey All,

I'm sending this as diff to list, without actual commitsies, so it can get proper review before going in as the icccm stuff is new to me.

Cheers,
dh
Index: Ecore_X.h
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.174
diff -u -r1.174 Ecore_X.h
--- Ecore_X.h	29 Sep 2006 05:49:13 -0000	1.174
+++ Ecore_X.h	31 Oct 2006 13:13:06 -0000
@@ -70,6 +70,12 @@
    unsigned int *data;
 } Ecore_X_Icon;
 
+typedef struct _Ecore_X_Icon_Size {
+   int min_width, min_height;
+   int max_width, max_height;
+   int width_inc, height_inc;
+} Ecore_X_Icon_Size;
+   
 typedef enum _Ecore_X_Window_State {
     /** The window is iconified. */
     ECORE_X_WINDOW_STATE_ICONIFIED,
@@ -1241,6 +1247,8 @@
 EAPI void  ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv);
 EAPI char *ecore_x_icccm_icon_name_get(Ecore_X_Window win);
 EAPI void  ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t);
+EAPI Ecore_X_Icon_Size *ecore_x_icccm_icon_size_get(Ecore_X_Window win);
+EAPI void  ecore_x_icccm_icon_size_set(Ecore_X_Window win);
 EAPI void  ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin);
 EAPI void  ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin);
 EAPI void  ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwin);
Index: ecore_x_icccm.c
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_x/ecore_x_icccm.c,v
retrieving revision 1.45
diff -u -r1.45 ecore_x_icccm.c
--- ecore_x_icccm.c	10 Jun 2006 19:26:25 -0000	1.45
+++ ecore_x_icccm.c	31 Oct 2006 13:13:41 -0000
@@ -30,6 +30,7 @@
 EAPI Ecore_X_Atom  ECORE_X_ATOM_WM_CLIENT_LEADER = 0;
 EAPI Ecore_X_Atom  ECORE_X_ATOM_WM_TRANSIENT_FOR = 0;
 EAPI Ecore_X_Atom  ECORE_X_ATOM_WM_SAVE_YOURSELF = 0;
+EAPI Ecore_X_Atom  ECORE_X_ATOM_WM_ICON_SIZE = 0;
 
 EAPI void
 ecore_x_icccm_init(void)
@@ -64,6 +65,8 @@
       XInternAtom(_ecore_x_disp, "WM_TRANSIENT_FOR", False);
    ECORE_X_ATOM_WM_SAVE_YOURSELF =
       XInternAtom(_ecore_x_disp, "WM_SAVE_YOURSELF", False);
+   ECORE_X_ATOM_WM_ICON_SIZE =
+      XInternAtom(_ecore_x_disp, "WM_ICON_SIZE", False);
 }
 
 EAPI void
@@ -1020,7 +1023,6 @@
       return (Ecore_X_Window) forwin;
    else
       return 0;
-
 }
 
 /**
@@ -1095,6 +1097,58 @@
 
    XSendEvent(_ecore_x_disp, root, False,
               SubstructureNotifyMask | SubstructureRedirectMask, &xev);
+}
+
+/**
+ * Get the window's icon size.
+ * @param win The window, or NULL for Root Window
+ * @return The window's icon size, or 0 if unset */
+EAPI Ecore_X_Icon_Size *
+ecore_x_icccm_icon_size_get(Ecore_X_Window win)
+{
+   int count;
+   Ecore_X_Icon_Size *esize;
+   XIconSize *size;
+   
+   if (win == 0)
+     win = DefaultRootWindow(_ecore_x_disp);
+   
+   if (XGetIconSizes(_ecore_x_disp, win, &size, &count)) 
+     {
+	esize = calloc(1, sizeof(Ecore_X_Icon_Size));
+	esize->min_height = size->min_height;
+	esize->min_width = size->min_width;
+	esize->max_height = size->max_height;
+	esize->max_width = size->max_width;
+	esize->width_inc = size->width_inc;
+	esize->height_inc = size->height_inc;
+	if (size) XFree(size);
+	return esize;
+     }
+   else
+     return NULL;
+}
+
+/**
+ * Set the window's icon size.
+ * @param win The window, or NULL for Root Window */
+EAPI void
+ecore_x_icccm_icon_size_set(Ecore_X_Window win) 
+{
+   XIconSize *size;
+
+   if (win == 0)
+     win = DefaultRootWindow(_ecore_x_disp);
+   
+   size = XAllocIconSize();
+   size->min_width = 8;
+   size->min_height = 8;
+   size->max_width = 48;
+   size->max_height = 48;
+   size->width_inc = 1;
+   size->height_inc = 1;
+   XSetIconSizes(_ecore_x_disp, win, size, 1);
+   XFree(size);
 }
 
 /* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */