This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.
The branch, next has been updated
via fd9bb936aa9379c27ba3bbf0c1fdb6c0ed1626cc (commit)
via cca2814afe040a729fb5b4d4d4a2512e2f540db8 (commit)
via c97bf1907963cf7b7094c42228d2c4fb008843f4 (commit)
via 6bfb175b1908cf1eab2530f66cd44db73e362ed1 (commit)
via 7246fa2d4c7c2b2a2105136751bfceed0eac3e3d (commit)
via 529276a3956e4d3ab9091eeaddc0416c8b194c06 (commit)
via 314f1dc9070433a18f914ab3bbc04599c9eabdca (commit)
via 19326554cc18f6b5effd59caabf7ae824ed0e699 (commit)
via 3e83e9d5ae307dae664ce4142ff80cb7d0b39ce7 (commit)
via ceedad4231e5370f8e687bdbaeb513e6cfe9108c (commit)
via c79eaa59b2b9233f7e01931f34b20f35f50fd5b2 (commit)
via 8349a018f0c13cb228036b248c10652555204e55 (commit)
via 2ff138f311a8c7857088064574bf19dd861affce (commit)
from 0106b2a4e90c5618760304261e241699eabd5a20 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/fd9bb936aa9379c27ba3bbf0c1fdb6c0ed1626cc
commit fd9bb936aa9379c27ba3bbf0c1fdb6c0ed1626cc
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:54:07 2012 +0100
appearanceObserver doesn't create icon again
The function appearanceObserver() is now faster because it doesn't
re-create the icon. Now it only draws the icon pixmap.
diff --git a/src/icon.c b/src/icon.c
index 2980db8..f82be53 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -72,15 +72,18 @@ static void unset_icon_image(WIcon *icon);
/****** Notification Observers ******/
-static void appearanceObserver(void *self, WMNotification * notif)
+static void appearanceObserver(void *self, WMNotification *notif)
{
WIcon *icon = (WIcon *) self;
uintptr_t flags = (uintptr_t)WMGetNotificationClientData(notif);
- if ((flags & WTextureSettings) || (flags & WFontSettings))
- icon->force_paint = 1;
-
- wIconPaint(icon);
+ if ((flags & WTextureSettings) || (flags & WFontSettings)) {
+ /* If the rimage exists, update the icon, else create it */
+ if (icon->file_image)
+ update_icon_pixmap(icon);
+ else
+ wIconPaint(icon);
+ }
/* so that the appicon expose handlers will paint the appicon specific
* stuff */
http://repo.or.cz/w/wmaker-crm.git/commit/cca2814afe040a729fb5b4d4d4a2512e2f540db8
commit cca2814afe040a729fb5b4d4d4a2512e2f540db8
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:54:06 2012 +0100
wIconSetHighlited: Do not create the icon again
The function wIconSetHighlited() is now faster because it doesn't
re-create the icon before setting the Highlited status. Now it only
draws the icon pixmap.
diff --git a/src/icon.c b/src/icon.c
index 9aa18c7..2980db8 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -554,8 +554,7 @@ void wIconSetHighlited(WIcon *icon, Bool flag)
return;
icon->highlighted = flag;
- icon->force_paint = True;
- wIconPaint(icon);
+ update_icon_pixmap(icon);
}
#endif
http://repo.or.cz/w/wmaker-crm.git/commit/c97bf1907963cf7b7094c42228d2c4fb008843f4
commit c97bf1907963cf7b7094c42228d2c4fb008843f4
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:54:05 2012 +0100
New function update_icon_pixmap
The new function update_icon_pixmap() updates the pixmap for a icon task.
Now, wIconCreate() creates the image and sets the icon->file and
icon->file_image variables and update_icon_pixmap() updates the
icon->pixmap.
This is interesting because we can update the pixmaps without creating the
image again.
diff --git a/src/icon.c b/src/icon.c
index 38814bf..9aa18c7 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -614,6 +614,11 @@ void wIconUpdate(WIcon *icon)
get_rimage_icon_from_user_icon(icon);
}
+ update_icon_pixmap(icon);
+}
+
+void update_icon_pixmap(WIcon *icon)
+{
if (icon->pixmap != None)
XFreePixmap(dpy, icon->pixmap);
diff --git a/src/icon.h b/src/icon.h
index f0786cb..48cf58b 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -62,6 +62,7 @@ void wIconPaint(WIcon *icon);
void wIconUpdate(WIcon *icon);
void wIconSelect(WIcon *icon);
void wIconChangeTitle(WIcon *icon, char *new_title);
+void update_icon_pixmap(WIcon *icon);
Bool wIconChangeImageFile(WIcon *icon, char *file);
http://repo.or.cz/w/wmaker-crm.git/commit/6bfb175b1908cf1eab2530f66cd44db73e362ed1
commit 6bfb175b1908cf1eab2530f66cd44db73e362ed1
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:54:04 2012 +0100
wIconUpdate create rimage and then pixmap
The function wIconUpdate now create the rimage for the icon, using
different functions. When the icon is created, then the pixmap is
generated using this rimage.
diff --git a/src/icon.c b/src/icon.c
index 9a4838b..38814bf 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -61,15 +61,10 @@ 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);
static void get_rimage_icon_from_user_icon(WIcon *icon);
-static void get_pixmap_icon_from_default_icon(WIcon *icon);
static void get_rimage_icon_from_default_icon(WIcon *icon);
-static void get_pixmap_icon_from_x11(WIcon *icon);
static void get_rimage_icon_from_x11(WIcon *icon);
static void icon_update_pixmap(WIcon *icon, RImage *image);
@@ -601,27 +596,38 @@ void wIconUpdate(WIcon *icon)
assert(scr->icon_tile != NULL);
- if (icon->pixmap != None)
- XFreePixmap(dpy, icon->pixmap);
-
- icon->pixmap = None;
-
if (wwin && WFLAGP(wwin, always_user_icon)) {
/* Forced use user_icon */
- get_pixmap_icon_from_user_icon(icon);
+ get_rimage_icon_from_user_icon(icon);
} else if (icon->icon_win != None) {
/* Get the Pixmap from the WIcon */
- get_pixmap_icon_from_icon_win(icon);
+ get_rimage_icon_from_icon_win(icon);
} else if (wwin && wwin->net_icon_image) {
/* Use _NET_WM_ICON icon */
- get_pixmap_icon_from_x11(icon);
+ get_rimage_icon_from_x11(icon);
} else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags &
IconPixmapHint)) {
/* Get the Pixmap from the wm_hints, else, from the user */
- if (get_pixmap_icon_from_wm_hints(icon))
- get_pixmap_icon_from_user_icon(icon);
+ if (get_rimage_icon_from_wm_hints(icon))
+ get_rimage_icon_from_user_icon(icon);
} else {
/* Get the Pixmap from the user */
- get_pixmap_icon_from_user_icon(icon);
+ get_rimage_icon_from_user_icon(icon);
+ }
+
+ if (icon->pixmap != None)
+ XFreePixmap(dpy, icon->pixmap);
+
+ icon->pixmap = None;
+
+ /* Create the pixmap */
+ if (icon->file_image)
+ icon_update_pixmap(icon, icon->file_image);
+
+ /* If dockapp, put inside the icon */
+ if (icon->icon_win != None) {
+ /* file_image is NULL, because is docked app */
+ icon_update_pixmap(icon, icon->file_image);
+ set_dockapp_in_icon(icon);
}
/* No pixmap, set default background */
@@ -633,15 +639,6 @@ void wIconUpdate(WIcon *icon)
wIconPaint(icon);
}
-static void get_pixmap_icon_from_x11(WIcon *icon)
-{
- /* Set the icon->file_image */
- get_rimage_icon_from_x11(icon);
-
- /* Update icon->pixmap */
- icon_update_pixmap(icon, icon->file_image);
-}
-
static void get_rimage_icon_from_x11(WIcon *icon)
{
/* Remove the icon image */
@@ -660,15 +657,6 @@ static void get_rimage_icon_from_user_icon(WIcon *icon)
get_rimage_icon_from_default_icon(icon);
}
-static void get_pixmap_icon_from_user_icon(WIcon *icon)
-{
- /* Set the icon->file_image */
- get_rimage_icon_from_user_icon(icon);
-
- /* Update icon->pixmap */
- icon_update_pixmap(icon, icon->file_image);
-}
-
static void get_rimage_icon_from_default_icon(WIcon *icon)
{
WScreen *scr = icon->core->screen_ptr;
@@ -685,15 +673,6 @@ static void get_rimage_icon_from_default_icon(WIcon *icon)
icon->file_image = RRetainImage(scr->def_icon_rimage);
}
-static void get_pixmap_icon_from_default_icon(WIcon *icon)
-{
- /* Update icon->file image */
- get_rimage_icon_from_default_icon(icon);
-
- /* Now, create the pixmap using the default (saved) image */
- icon_update_pixmap(icon, icon->file_image);
-}
-
/* Get the RImage from the WIcon of the WWindow */
static void get_rimage_icon_from_icon_win(WIcon *icon)
{
@@ -710,19 +689,6 @@ static void get_rimage_icon_from_icon_win(WIcon *icon)
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, 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)
{
@@ -789,18 +755,6 @@ static int get_rimage_icon_from_wm_hints(WIcon *icon)
return 0;
}
-/* Get the Pixmap from the XWindow wm_hints */
-static int get_pixmap_icon_from_wm_hints(WIcon *icon)
-{
- int ret;
-
- ret = get_rimage_icon_from_wm_hints(icon);
- if (ret == 0)
- icon_update_pixmap(icon, icon->file_image);
-
- return ret;
-}
-
void wIconPaint(WIcon * icon)
{
WScreen *scr = icon->core->screen_ptr;
http://repo.or.cz/w/wmaker-crm.git/commit/7246fa2d4c7c2b2a2105136751bfceed0eac3e3d
commit 7246fa2d4c7c2b2a2105136751bfceed0eac3e3d
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:54:03 2012 +0100
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()
diff --git a/src/icon.c b/src/icon.c
index d472553..9a4838b 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 */
http://repo.or.cz/w/wmaker-crm.git/commit/529276a3956e4d3ab9091eeaddc0416c8b194c06
commit 529276a3956e4d3ab9091eeaddc0416c8b194c06
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:54:02 2012 +0100
Solved bug if icon doesn't exists
There is a bug in wmaker with icon files set in config files, but
that doesn't exist in the disk. For example, if the config files have:
etc/WindowMaker/WMWindowAttributes:
xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};
share/WindowMaker/IconSets/Default.iconset:
xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};
But the icon "HP-16C-48.xpm" doesn't exist in the disk, wmaker does:
1. Load the config file in memory, in a database
2. When the application is launched, wmaker tries to find their icon in
the database (using wDefaultGetIconFile), the icon is found:
HP-16C-48.xpm
3. When WindowMaker try to find the full path for the icon, using
FindImage(),
WindowMaker cannot find the icon, and returns NULL.
Even, if the user set the default_icon boolean variable to True, wmaker
finds in the database the wrong icon.
This patch checks that the icon exists both in the database AND in the
disk. If the
icon doesn't exist in the disk and the default_icon variable is set to True,
then windowmaker loads the default icon using the function
get_default_image()
because this function searches the default icon directly.
The function get_default_image() is moved from icon.c to wdefaults.c because
it is now used in both places. This function is now splitted, to find the
file
(get_default_image_path) path and the file image (get_default_image)
diff --git a/src/defaults.h b/src/defaults.h
index 2541f20..4104f84 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -41,6 +41,7 @@ void wDefaultFillAttributes(char *instance, char *class,
WWindowAttributes *attr, WWindowAttributes *mask,
Bool useGlobalDefault);
+char *get_default_image_path(WScreen *scr);
char *wDefaultGetIconFile(char *instance, char *class, Bool default_icon);
RImage * wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int
max_size);
@@ -48,6 +49,7 @@ RImage * wDefaultGetImage(WScreen *scr, char *winstance, char
*wclass, int max_s
int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
+RImage *get_default_image(WScreen *scr);
char *get_default_icon_filename(WScreen *scr, char *winstance, char *wclass,
char *command,
Bool default_icon);
RImage *get_rimage_from_file(WScreen *scr, char *file_name, int max_size);
diff --git a/src/icon.c b/src/icon.c
index 6aca13b..d472553 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -73,7 +73,6 @@ static void get_rimage_icon_from_x11(WIcon *icon);
static void icon_update_pixmap(WIcon *icon, RImage *image);
static void unset_icon_image(WIcon *icon);
-static RImage *get_default_image(WScreen *scr);
/****** Notification Observers ******/
static void appearanceObserver(void *self, WMNotification * notif)
@@ -693,27 +692,6 @@ static void get_pixmap_icon_from_default_icon(WIcon *icon)
icon_update_pixmap(icon, icon->file_image);
}
-/* This function creates the RImage using the default icon */
-static RImage *get_default_image(WScreen *scr)
-{
- RImage *image = NULL;
- char *path, *file;
-
- /* Get the default icon */
- file = wDefaultGetIconFile(NULL, NULL, True);
- if (file) {
- path = FindImage(wPreferences.icon_path, file);
- image = get_rimage_from_file(scr, path, wPreferences.icon_size);
-
- if (!image)
- wwarning(_("could not find default icon "%s""), file);
-
- wfree(file);
- }
-
- return image;
-}
-
/* Get the Pixmap from the WIcon of the WWindow */
static void get_pixmap_icon_from_icon_win(WIcon *icon)
{
diff --git a/src/wdefaults.c b/src/wdefaults.c
index 8a4cdab..532b19e 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -385,11 +385,15 @@ char *get_default_icon_filename(WScreen *scr, char
*winstance, char *wclass, cha
/* Get the file name of the image, using instance and class */
file_name = wDefaultGetIconFile(winstance, wclass, default_icon);
+ /* Check if the file really exists in the disk */
+ if (file_name)
+ file_path = FindImage(wPreferences.icon_path, file_name);
+
/* If the specific (or generic if default_icon is True) icon filename
* is not found, and command is specified, then include the .app icons
* and re-do the search, but now always including the default icon
* so the icon is found always. The .app is selected before default */
- if (!file_name && scr && command) {
+ if ((!file_name || !file_path ) && scr && command) {
wApplicationExtractDirPackIcon(scr, command, winstance, wclass);
file_name = wDefaultGetIconFile(winstance, wclass, True);
}
@@ -416,6 +420,9 @@ char *get_default_icon_filename(WScreen *scr, char
*winstance, char *wclass, cha
*/
}
+ if (!file_path && default_icon)
+ file_path = get_default_image_path(scr);
+
return file_path;
}
@@ -437,14 +444,52 @@ RImage *get_rimage_from_file(WScreen *scr, char
*file_name, int max_size)
return image;
}
-RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int
max_size)
+/* This function returns the default icon's full path
+ * If the path for an icon is not found, returns NULL */
+char *get_default_image_path(WScreen *scr)
+{
+ char *path = NULL, *file = NULL;
+
+ /* Get the default icon */
+ file = wDefaultGetIconFile(NULL, NULL, True);
+ if (file)
+ path = FindImage(wPreferences.icon_path, file);
+
+ return path;
+}
+
+/* This function creates the RImage using the default icon */
+RImage *get_default_image(WScreen *scr)
+{
+ RImage *image = NULL;
+ char *path = NULL;
+
+ /* Get the filename full path */
+ path = get_default_image_path(scr);
+ if (!path)
+ return NULL;
+
+ /* Get the default icon */
+ image = get_rimage_from_file(scr, path, wPreferences.icon_size);
+ if (!image)
+ wwarning(_("could not find default icon "%s""), path);
+
+ return image;
+}
+
+RImage *wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int
max_size)
{
char *file_name = NULL;
/* Get the file name of the image, using instance and class */
file_name = get_default_icon_filename(scr, winstance, wclass, NULL,
True);
- if (!file_name)
- return NULL;
+
+ /* If no filename, is because the winstance and wclass in the database
+ * returns a invalid icon (config file error), then should be removed
FIXME! */
+ if (!file_name) {
+ wwarning(_("icon "%s" doesn't exist, check your config files"),
file_name);
+ file_name = get_default_image_path(scr);
+ }
return get_rimage_from_file(scr, file_name, max_size);
}
http://repo.or.cz/w/wmaker-crm.git/commit/314f1dc9070433a18f914ab3bbc04599c9eabdca
commit 314f1dc9070433a18f914ab3bbc04599c9eabdca
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:54:01 2012 +0100
get_pixmap_icon_from_icon_win rewritten
The function get_pixmap_icon_from_icon_win() is now rewritten.
This function now creates the icon using the function
get_window_image_from_x11(),
using itself as Window and updates the icon using icon_update_pixmap().
At this point the Pixmap is only the icon background. Now we must put
inside the
dockapp, in the correct position. Then the funcion get the dock application
size,
(the max size is wPreferences.icon_size, because
get_window_image_from_x11() checks
the valid size), checks if the icon has title and then reparents the
dockapp to put
it inside the icon.
This patch includes a lot of comments to better understand the code.
diff --git a/src/icon.c b/src/icon.c
index b02fce0..6aca13b 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -715,60 +715,60 @@ static RImage *get_default_image(WScreen *scr)
}
/* Get the Pixmap from the WIcon of the WWindow */
-static void get_pixmap_icon_from_icon_win(WIcon * icon)
+static void get_pixmap_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 width, height, depth;
- int theight;
- int resize = 0;
- Pixmap pixmap;
+ unsigned int w, h, d;
+ int theight = 0;
- getSize(icon->icon_win, &width, &height, &depth);
+ /* Create the new RImage */
+ image = get_window_image_from_x11(icon->icon_win);
- if (width > wPreferences.icon_size) {
- resize = 1;
- width = wPreferences.icon_size;
- }
+ /* Free the icon info */
+ unset_icon_image(icon);
- if (height > wPreferences.icon_size) {
- resize = 1;
- height = wPreferences.icon_size;
- }
+ /* Set the new info */
+ icon->file = NULL;
+ icon->file_image = image;
- if (icon->show_title && (height + title_height <
wPreferences.icon_size)) {
- pixmap = XCreatePixmap(dpy, scr->w_win, wPreferences.icon_size,
- wPreferences.icon_size, scr->w_depth);
- XSetClipMask(dpy, scr->copy_gc, None);
- XCopyArea(dpy, scr->icon_tile_pixmap, pixmap, scr->copy_gc, 0,
0,
- wPreferences.icon_size, wPreferences.icon_size, 0, 0);
- drawIconTitle(scr, pixmap, title_height);
+ /* Paint the image at the icon */
+ icon_update_pixmap(icon, image);
+
+ /* Reparent the dock application to the icon */
+
+ /* We need the application size to center it
+ * and show in the correct position */
+ getSize(icon->icon_win, &w, &h, &d);
+
+ /* Set extra space for title */
+ if (icon->show_title && (h + title_height < wPreferences.icon_size)) {
theight = title_height;
+ drawIconTitle(scr, icon->pixmap, theight);
} else {
- pixmap = None;
- theight = 0;
- XSetWindowBackgroundPixmap(dpy, icon->core->window,
scr->icon_tile_pixmap);
- }
+ XSetWindowBackgroundPixmap(dpy, icon->core->window,
scr->icon_tile_pixmap);
+ }
+ /* Set the icon border */
XSetWindowBorderWidth(dpy, icon->icon_win, 0);
+
+ /* Put the dock application in the icon */
XReparentWindow(dpy, icon->icon_win, icon->core->window,
- (wPreferences.icon_size - width) / 2,
- theight + (wPreferences.icon_size - height - theight) /
2);
- if (resize)
- XResizeWindow(dpy, icon->icon_win, width, height);
+ (wPreferences.icon_size - w) / 2,
+ theight + (wPreferences.icon_size - h - theight) / 2);
+ /* Show it and save */
XMapWindow(dpy, icon->icon_win);
XAddToSaveSet(dpy, icon->icon_win);
- /* Save it */
- icon->pixmap = pixmap;
-
+ /* Needed to move the icon clicking on the application part */
if ((XGetWindowAttributes(dpy, icon->icon_win, &attr)) &&
(attr.all_event_masks & ButtonPressMask))
- wHackedGrabButton(Button1, MOD_MASK,
icon->core->window, True,
- ButtonPressMask, GrabModeSync,
GrabModeAsync,
- None, wCursor[WCUR_ARROW]);
+ wHackedGrabButton(Button1, MOD_MASK, icon->core->window, True,
+ ButtonPressMask, GrabModeSync, GrabModeAsync,
+ None, wCursor[WCUR_ARROW]);
}
/* Get the RImage from the XWindow wm_hints */
http://repo.or.cz/w/wmaker-crm.git/commit/19326554cc18f6b5effd59caabf7ae824ed0e699
commit 19326554cc18f6b5effd59caabf7ae824ed0e699
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:54:00 2012 +0100
Make get_wwindow_image_from_x11() take Window as argument
The function get_wwindow_image_from_x11() is renamed to
get_window_image_from_x11()
and does the same work, but now its argument is a Window struct instead of a
WWindow.
This change is better because it allows objects with Windows (but without
WWindows) to call this function.
The function now is not static to allow its use in other parts of the code.
diff --git a/src/wmspec.c b/src/wmspec.c
index 6bd51ce..b3dfb8b 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -420,7 +420,7 @@ static RImage *makeRImageFromARGBData(unsigned long *data)
return image;
}
-static RImage *get_wwindow_image_from_x11(WWindow *wwin)
+RImage *get_window_image_from_x11(Window window)
{
RImage *image;
Atom type;
@@ -429,7 +429,7 @@ static RImage *get_wwindow_image_from_x11(WWindow *wwin)
unsigned long *property, *data;
/* Get the icon from X11 Window */
- if (XGetWindowProperty(dpy, wwin->client_win, net_wm_icon, 0L, LONG_MAX,
+ if (XGetWindowProperty(dpy, window, net_wm_icon, 0L, LONG_MAX,
False, XA_CARDINAL, &type, &format, &items,
&rest,
(unsigned char **)&property) != Success ||
!property)
return NULL;
@@ -464,7 +464,7 @@ static void updateIconImage(WWindow *wwin)
RReleaseImage(wwin->net_icon_image);
/* Save the icon in the X11 icon */
- wwin->net_icon_image = get_wwindow_image_from_x11(wwin);
+ wwin->net_icon_image = get_window_image_from_x11(wwin->client_win);
/* Refresh the Window Icon */
if (wwin->icon)
diff --git a/src/wmspec.h b/src/wmspec.h
index 63d1eff..5bb26f0 100644
--- a/src/wmspec.h
+++ b/src/wmspec.h
@@ -45,4 +45,5 @@ char *wNETWMGetIconName(Window window);
char *wNETWMGetWindowName(Window window);
void wNETFrameExtents(WWindow *wwin);
void wNETCleanupFrameExtents(WWindow *wwin);
+RImage *get_window_image_from_x11(Window window);
#endif
http://repo.or.cz/w/wmaker-crm.git/commit/3e83e9d5ae307dae664ce4142ff80cb7d0b39ce7
commit 3e83e9d5ae307dae664ce4142ff80cb7d0b39ce7
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:53:59 2012 +0100
New functions get_*_icon_from_x11
A new functions get_pixmap_icon_from_x11 and get_rimage_icon_from_x11
are included in icon.h
1. get_pixmap_icon_from_x11, set the rimage at icon->file_image
The code sets net_icon_image in icon->file_image
2. The get_rimage_icon_from_x11 function, only converts
the icon->file_image in icon->pixmap
diff --git a/src/icon.c b/src/icon.c
index 3e46f04..b02fce0 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -67,6 +67,8 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon);
static void get_rimage_icon_from_user_icon(WIcon *icon);
static void get_pixmap_icon_from_default_icon(WIcon *icon);
static void get_rimage_icon_from_default_icon(WIcon *icon);
+static void get_pixmap_icon_from_x11(WIcon *icon);
+static void get_rimage_icon_from_x11(WIcon *icon);
static void icon_update_pixmap(WIcon *icon, RImage *image);
static void unset_icon_image(WIcon *icon);
@@ -611,7 +613,7 @@ void wIconUpdate(WIcon *icon)
get_pixmap_icon_from_icon_win(icon);
} else if (wwin && wwin->net_icon_image) {
/* Use _NET_WM_ICON icon */
- icon_update_pixmap(icon, wwin->net_icon_image);
+ get_pixmap_icon_from_x11(icon);
} else if (wwin && wwin->wm_hints && (wwin->wm_hints->flags &
IconPixmapHint)) {
/* Get the Pixmap from the wm_hints, else, from the user */
if (get_pixmap_icon_from_wm_hints(icon))
@@ -630,6 +632,25 @@ void wIconUpdate(WIcon *icon)
wIconPaint(icon);
}
+static void get_pixmap_icon_from_x11(WIcon *icon)
+{
+ /* Set the icon->file_image */
+ get_rimage_icon_from_x11(icon);
+
+ /* Update icon->pixmap */
+ icon_update_pixmap(icon, icon->file_image);
+}
+
+static void get_rimage_icon_from_x11(WIcon *icon)
+{
+ /* Remove the icon image */
+ unset_icon_image(icon);
+
+ /* Set the new icon image */
+ icon->file = NULL;
+ icon->file_image = RRetainImage(icon->owner->net_icon_image);
+}
+
static void get_rimage_icon_from_user_icon(WIcon *icon)
{
if (icon->file_image)
http://repo.or.cz/w/wmaker-crm.git/commit/ceedad4231e5370f8e687bdbaeb513e6cfe9108c
commit ceedad4231e5370f8e687bdbaeb513e6cfe9108c
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:53:58 2012 +0100
Split get_pixmap_icon_from_wm_hints() into two
The function get_pixmap_icon_from_wm_hints() is splitted in two
functions now:
1. get_rimage_icon_from_wm_hints, set the rimage at icon->image
The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_wm_hints() function, but now only converts
the icon->file_image in icon->pixmap
diff --git a/src/icon.c b/src/icon.c
index a94b4b2..3e46f04 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -62,6 +62,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int
coord_y);
static void get_pixmap_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);
static void get_rimage_icon_from_user_icon(WIcon *icon);
static void get_pixmap_icon_from_default_icon(WIcon *icon);
@@ -749,8 +750,8 @@ static void get_pixmap_icon_from_icon_win(WIcon * icon)
None, wCursor[WCUR_ARROW]);
}
-/* Get the Pixmap from the XWindow wm_hints */
-static int get_pixmap_icon_from_wm_hints(WIcon *icon)
+/* Get the RImage from the XWindow wm_hints */
+static int get_rimage_icon_from_wm_hints(WIcon *icon)
{
RImage *image = NULL;
unsigned int w, h, d;
@@ -765,9 +766,23 @@ static int get_pixmap_icon_from_wm_hints(WIcon *icon)
if (!image)
return 1;
- icon_update_pixmap(icon, image);
+ /* FIXME: If unset_icon_image, pointer double free then crash
+ unset_icon_image(icon); */
+ icon->file_image = image;
+
+ return 0;
+}
+
+/* Get the Pixmap from the XWindow wm_hints */
+static int get_pixmap_icon_from_wm_hints(WIcon *icon)
+{
+ int ret;
+
+ ret = get_rimage_icon_from_wm_hints(icon);
+ if (ret == 0)
+ icon_update_pixmap(icon, icon->file_image);
- return 0;
+ return ret;
}
void wIconPaint(WIcon * icon)
http://repo.or.cz/w/wmaker-crm.git/commit/c79eaa59b2b9233f7e01931f34b20f35f50fd5b2
commit c79eaa59b2b9233f7e01931f34b20f35f50fd5b2
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:53:57 2012 +0100
Split get_pixmap_icon_from_user_icon() into two
The function get_pixmap_icon_from_user_icon() is splitted in two
functions now:
1. get_rimage_icon_from_user_icon, set the rimage at icon->image
The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_user_icon() function, but now only converts
the icon->file_image in icon->pixmap
diff --git a/src/icon.c b/src/icon.c
index 2e0f9b0..a94b4b2 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -63,6 +63,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int
coord_y);
static void get_pixmap_icon_from_icon_win(WIcon *icon);
static int get_pixmap_icon_from_wm_hints(WIcon *icon);
static void get_pixmap_icon_from_user_icon(WIcon *icon);
+static void get_rimage_icon_from_user_icon(WIcon *icon);
static void get_pixmap_icon_from_default_icon(WIcon *icon);
static void get_rimage_icon_from_default_icon(WIcon *icon);
@@ -628,15 +629,21 @@ void wIconUpdate(WIcon *icon)
wIconPaint(icon);
}
-static void get_pixmap_icon_from_user_icon(WIcon *icon)
+static void get_rimage_icon_from_user_icon(WIcon *icon)
{
- /* If the icon has image, update it and continue */
- if (icon->file_image) {
- icon_update_pixmap(icon, icon->file_image);
+ if (icon->file_image)
return;
- }
- get_pixmap_icon_from_default_icon(icon);
+ get_rimage_icon_from_default_icon(icon);
+}
+
+static void get_pixmap_icon_from_user_icon(WIcon *icon)
+{
+ /* Set the icon->file_image */
+ get_rimage_icon_from_user_icon(icon);
+
+ /* Update icon->pixmap */
+ icon_update_pixmap(icon, icon->file_image);
}
static void get_rimage_icon_from_default_icon(WIcon *icon)
http://repo.or.cz/w/wmaker-crm.git/commit/8349a018f0c13cb228036b248c10652555204e55
commit 8349a018f0c13cb228036b248c10652555204e55
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:53:56 2012 +0100
Split get_pixmap_icon_from_default_icon() into two
The function get_pixmap_icon_from_default_icon() is splitted in two
functions now:
1. get_rimage_icon_from_default_icon, set the rimage at icon->image
The code comes from the function get_pixmap_icon_from_default_icon()
2. The get_pixmap_icon_from_default_icon(), but now only converts
the icon->file_image in icon->pixmap
diff --git a/src/icon.c b/src/icon.c
index fce0a51..2e0f9b0 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -64,6 +64,7 @@ static void get_pixmap_icon_from_icon_win(WIcon *icon);
static int get_pixmap_icon_from_wm_hints(WIcon *icon);
static void get_pixmap_icon_from_user_icon(WIcon *icon);
static void get_pixmap_icon_from_default_icon(WIcon *icon);
+static void get_rimage_icon_from_default_icon(WIcon *icon);
static void icon_update_pixmap(WIcon *icon, RImage *image);
static void unset_icon_image(WIcon *icon);
@@ -638,7 +639,7 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon)
get_pixmap_icon_from_default_icon(icon);
}
-static void get_pixmap_icon_from_default_icon(WIcon *icon)
+static void get_rimage_icon_from_default_icon(WIcon *icon)
{
WScreen *scr = icon->core->screen_ptr;
@@ -646,8 +647,21 @@ static void get_pixmap_icon_from_default_icon(WIcon *icon)
if (!scr->def_icon_rimage)
scr->def_icon_rimage = get_default_image(scr);
+ /* Remove the icon image */
+ unset_icon_image(icon);
+
+ /* Set the new icon image */
+ icon->file = NULL;
+ icon->file_image = RRetainImage(scr->def_icon_rimage);
+}
+
+static void get_pixmap_icon_from_default_icon(WIcon *icon)
+{
+ /* Update icon->file image */
+ get_rimage_icon_from_default_icon(icon);
+
/* Now, create the pixmap using the default (saved) image */
- icon_update_pixmap(icon, scr->def_icon_rimage);
+ icon_update_pixmap(icon, icon->file_image);
}
/* This function creates the RImage using the default icon */
http://repo.or.cz/w/wmaker-crm.git/commit/2ff138f311a8c7857088064574bf19dd861affce
commit 2ff138f311a8c7857088064574bf19dd861affce
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Nov 3 19:53:54 2012 +0100
New helper function unset_icon_image()
The new function unset_icon_image() removes the RImage and the
file path for a given icon.
diff --git a/src/icon.c b/src/icon.c
index 018333b..fce0a51 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -66,6 +66,7 @@ static void get_pixmap_icon_from_user_icon(WIcon *icon);
static void get_pixmap_icon_from_default_icon(WIcon *icon);
static void icon_update_pixmap(WIcon *icon, RImage *image);
+static void unset_icon_image(WIcon *icon);
static RImage *get_default_image(WScreen *scr);
/****** Notification Observers ******/
@@ -251,11 +252,7 @@ void wIconDestroy(WIcon * icon)
if (icon->pixmap)
XFreePixmap(dpy, icon->pixmap);
- if (icon->file)
- wfree(icon->file);
-
- if (icon->file_image != NULL)
- RReleaseImage(icon->file_image);
+ unset_icon_image(icon);
wCoreDestroy(icon->core);
wfree(icon);
@@ -390,10 +387,7 @@ Bool wIconChangeImageFile(WIcon *icon, char *file)
/* New image! */
if (!error && image) {
/* Remove the old one */
- if (icon->file_image) {
- RReleaseImage(icon->file_image);
- icon->file_image = NULL;
- }
+ unset_icon_image(icon);
/* Set the new image */
icon->file_image = image;
@@ -585,6 +579,15 @@ void wIconSelect(WIcon * icon)
}
}
+static void unset_icon_image(WIcon *icon)
+{
+ if (icon->file)
+ wfree(icon->file);
+
+ if (icon->file_image)
+ RReleaseImage(icon->file_image);
+}
+
void wIconUpdate(WIcon *icon)
{
WScreen *scr = icon->core->screen_ptr;
-----------------------------------------------------------------------
Summary of changes:
src/defaults.h | 2 +
src/icon.c | 210 +++++++++++++++++++++++++++++-------------------------
src/icon.h | 1 +
src/wdefaults.c | 53 +++++++++++++-
src/wmspec.c | 6 +-
src/wmspec.h | 1 +
6 files changed, 169 insertions(+), 104 deletions(-)
repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
--
wmaker-crm.git ("The Window Maker window manager")
--
To unsubscribe, send mail to [email protected].