From 7246fa2d4c7c2b2a2105136751bfceed0eac3e3d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sat, 3 Nov 2012 19:54:03 +0100 Subject: [PATCH] Split get_pixmap_icon_from_icon_win() The function get_pixmap_icon_from_icon_win(), before this patch, creates the pixmap icon for dockapps (docks with a mini application inside). The function did three steps: 1. Create the (r)image 2. Create the pixmap using the image 3. Put the application inside the image Now these three steps are three functions: step 1: static void get_rimage_icon_from_icon_win(WIcon *icon); step 2: static void get_pixmap_icon_from_icon_win(WIcon *icon); step 3: static void set_dockapp_in_icon(WIcon *icon); These functions contains the same code, that before the changes. The original function get_pixmap_icon_from_icon_win() includes the calls to the new functions get_rimage_icon_from_icon_win() and set_dockapp_in_icon() --- src/icon.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/icon.c b/src/icon.c index d472553d..9a4838ba 100644 --- a/src/icon.c +++ b/src/icon.c @@ -60,7 +60,9 @@ static void miniwindowDblClick(WObjDescriptor * desc, XEvent * event); static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y); +static void set_dockapp_in_icon(WIcon *icon); static void get_pixmap_icon_from_icon_win(WIcon *icon); +static void get_rimage_icon_from_icon_win(WIcon *icon); static int get_pixmap_icon_from_wm_hints(WIcon *icon); static int get_rimage_icon_from_wm_hints(WIcon *icon); static void get_pixmap_icon_from_user_icon(WIcon *icon); @@ -692,15 +694,10 @@ static void get_pixmap_icon_from_default_icon(WIcon *icon) icon_update_pixmap(icon, icon->file_image); } -/* Get the Pixmap from the WIcon of the WWindow */ -static void get_pixmap_icon_from_icon_win(WIcon *icon) +/* Get the RImage from the WIcon of the WWindow */ +static void get_rimage_icon_from_icon_win(WIcon *icon) { - XWindowAttributes attr; RImage *image; - WScreen *scr = icon->core->screen_ptr; - int title_height = WMFontHeight(scr->icon_title_font); - unsigned int w, h, d; - int theight = 0; /* Create the new RImage */ image = get_window_image_from_x11(icon->icon_win); @@ -711,9 +708,29 @@ static void get_pixmap_icon_from_icon_win(WIcon *icon) /* Set the new info */ icon->file = NULL; icon->file_image = image; +} + +/* Get the Pixmap from the WIcon of the WWindow */ +static void get_pixmap_icon_from_icon_win(WIcon *icon) +{ + /* Get the RImage and set in icon->file_image */ + get_rimage_icon_from_icon_win(icon); /* Paint the image at the icon */ - icon_update_pixmap(icon, image); + icon_update_pixmap(icon, icon->file_image); + + /* Put the dockapp in the icon */ + set_dockapp_in_icon(icon); +} + +/* Set the dockapp in the WIcon */ +static void set_dockapp_in_icon(WIcon *icon) +{ + XWindowAttributes attr; + WScreen *scr = icon->core->screen_ptr; + int title_height = WMFontHeight(scr->icon_title_font); + unsigned int w, h, d; + int theight = 0; /* Reparent the dock application to the icon */ -- 2.11.4.GIT