1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 14:42:29 +01:00
Commit Graph

88 Commits

Author SHA1 Message Date
Rodolfo García Peñas (kix)
c79eaa59b2 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
2012-11-04 00:27:46 +00:00
Rodolfo García Peñas (kix)
8349a018f0 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
2012-11-04 00:26:01 +00:00
Rodolfo García Peñas (kix)
2ff138f311 New helper function unset_icon_image()
The new function unset_icon_image() removes the RImage and the
file path for a given icon.
2012-11-03 19:52:30 +00:00
Rodolfo García Peñas (kix)
0106b2a4e9 get_pixmap_icon_from_wm_hints rewritten
The function get_pixmap_icon_from_wm_hints() is now rewritten using
the functions get_wwindow_image_from_wmhints() and icon_update_pixmap().

Now, the function creates a new RImage using get_wwindow_image_from_wmhints()
and then updates the Pixmap using the function icon_update_pixmap().
2012-10-31 22:57:31 +00:00
Rodolfo García Peñas (kix)
0493974cbc get_pixmap_icon_from_wm_hints uses getSize
The function get_pixmap_icon_from_wm_hints() now uses getSize() and
the code dup is removed.
2012-10-31 22:54:42 +00:00
Rodolfo García Peñas (kix)
d5e5ae6ca0 getSize returns XGetGeometry exit
The function getSize now returns the returned value by XGetGeometry.
The function now is not INLINE.
2012-10-31 22:52:53 +00:00
Rodolfo García Peñas (kix)
5728b6436d wIconChangeImageFile change image only if found
This patch changes the behavior of wIconChangeImageFile.

Before apply this patch the behavior was:

The image (file_image) is set to NULL, then the function tried to find
a new image. If the new image was not found, the variable file_image contains
NULL when the function returns, and the return code was 1.

With this patch the image is changed only if a new image is found.
2012-10-31 22:24:28 +00:00
Rodolfo García Peñas (kix)
3d0223ded4 wIconChangeImageFile removed dup code
This patch removes the dup code with get_rimage_from_file.
2012-10-31 22:24:28 +00:00
Rodolfo García Peñas (kix)
156d8ebfa5 wIconChangeImageFile don't update without file
The function wIconChangeImageFile mustn't update the icon if
no file is set.

This is a bug. To reproduce it:

1. Right click on dock icon. Select "Settings"
2. Erase the Icon Image contents (set empty)
3. Click "OK" -> Exit, no changes... no?
4. Right click on the same dock icon. Select "Settings"
5. Erase the Icon Image contents (set empty)
6. Click "OK" -> Crash

If wmaker don't crash, watch the file ~/GNUstep/Defaults/WMWindowAttributes,
the default icon ("*" has trash in the name). Probably something is not fine
at wIconUpdate.
2012-10-31 22:24:27 +00:00
Rodolfo García Peñas (kix)
280e1e099d Removed dup code at get_default_image
This patch removes the code dup at get_default_image. Now,
this function calls get_rimage_from_file()
2012-10-31 22:24:27 +00:00
Rodolfo García Peñas (kix)
206fe5e821 Changed get_default_icon_rimage function name
The function get_default_icon_rimage name is not correct, because
the function doesn't return the default icon rimage, returns the
rimage from a file name. So the correct function name should be
get_rimage_from_file.
2012-10-28 10:58:43 +00:00
Rodolfo García Peñas (kix)
b8025ee899 New helper function get_pixmap_icon_from_default_icon
The new helper function get_pixmap_icon_from_default_icon search
the default icon in the disk and return it.

Now get_pixmap_icon_from_user_icon() returns do the work about
search the user icon, and the work about default icon is splitted
in the function get_pixmap_icon_from_user_icon.
2012-10-28 10:58:43 +00:00
Rodolfo García Peñas (kix)
f3d36b1c26 Function makeIcon removed
The function makeIcon is only used in icon_update_pixmap(), so
both functions can be joined. Now the function icon_update_pixmap()
includes the contents of makeIcon.
2012-10-28 10:58:43 +00:00
Rodolfo García Peñas (kix)
ff9f942c47 Better default icon management
This patch replaces the Pixmap icons from screen.h with only one
RImage. This image is not processed yet, therefore could be used
for icons with title or without it (replacing def_ticon_pixmap and
def_icon_pixmap variables).

Now the code is better because the Pixmap is generated and saved in
the icon structure.

See that before this patch, the icon->pixmap was set to None!!
With this patch, the icon->pixmap is saved, using the common
method used in the other functions to create Pixmaps, the function
icon_update_pixmap().
2012-10-28 10:58:43 +00:00
Rodolfo García Peñas (kix)
4f4b7655de New helper function get_default_image
The new function get_default_image creates a RImage with the default
icon. Now the function get_pixmap_icon_from_user_icon() is more clear
and show that, first try to get the user selected image, if not set,
then it gets the default icon.
2012-10-28 10:58:43 +00:00
Rodolfo García Peñas (kix)
399d476126 declare get_pixmap_icon_from_* as static functions
The functions:

void get_pixmap_icon_from_icon_win(WIcon *icon);
int get_pixmap_icon_from_wm_hints(WIcon *icon);
void get_pixmap_icon_from_user_icon(WIcon *icon);

should be static, because are only used in icon.c
2012-10-28 10:58:42 +00:00
Rodolfo García Peñas (kix)
948dde0abd New icon_update_pixmap helper function
The function icon_update_pixmap updates the WIcon's pixmap,
using the values in the WIcon struct.

This function provices a clear function to update the icon,
using only the icon, and the new image to set. This option is
better than using "makeIcon" function, with a lot of arguments.

This patch also changes the variable name "icon" to "image",
because is type rimage and then both functions uses the same name.
2012-10-28 10:58:42 +00:00
Rodolfo García Peñas (kix)
f9847da97c get_pixmap_icon_from_wm_hints removed extra arguments
The function get_pixmap_icon_from_wm_hints has two extra arguments
(WScreen and WWindow) not needed, because these arguments can be
accessed using the argument WIcon.

This function removes them in the function definition and provides
them in the function code.
2012-10-28 10:58:42 +00:00
Rodolfo García Peñas (kix)
362915a7b3 get_pixmap_icon_from_user_icon extra argument removed
The function get_pixmap_icon_from_user_icon uses the argument
scr (WScreen) that is not needed, because the argument is in the
struct WIcon, the other function argument.

This patch removes the argument WScreen and provides it in the function
using WIcon.
2012-10-28 10:58:42 +00:00
Christophe CURIS
baecab089c Fixed crash when changing icon to non-existent file
As found by Rodolfo, a crash could happen when changing an icon to
a non-existent file. From his report:

Steps To Reproduce
1. Open the Settings box, for example for WMDock. (Right click on WMDock, Settings).
2. In the "Icon Image" field, write some characters. For example "asdfasdfasd".
3. Click in "OK". You get "Could not open specified icon file: GNUstep.tiffasdfasdfasd"
4. Hit in "OK"
5. Repeat 2,3,4 some times (sometimes 1, sometimes 2, sometimes 10).

The problem came from freeing the previous icon but not updating
the pointer, so if the new file did not exist it ended up with a
fake-looking icon being used, hence possible crash.

BTS: http://www.kix.es/mantis/view.php?id=1
2012-10-09 00:12:22 +01:00
Rodolfo García Peñas (kix)
727b25d947 Icon: Make icon_create_for_* be more similar
The contents for searching the icon in wAppIconCreateForDock()
are moved to icon_create_for_dock().

Now wAppIconCreateForDock() and wAppIconCreate() do the same work and
icon_create_for_dock() and icon_create_for_wwindow() do the same work too.

The procedure to create the icon is similar in both functions.

Now wAppIconCreateForDock, needs more arguments (command, instance and class).
2012-10-06 15:51:45 +01:00
Rodolfo García Peñas (kix)
97f74548ef wIcon* functions renamed
These functiosn were renamed:

wIconCreateCore to icon_create_core
wIconCreateWithIconFile to icon_create_for_dock
wIconCreate to icon_create_for_wwindow
2012-10-06 15:46:13 +01:00
Rodolfo García Peñas (kix)
236c1c5f70 wIconCreate: get the icon file name first
The function wIconCreate search the icon image calling wDefaultGetIconFile.
wDefaultGetIconFile search first the icon file name and then search the
image using the icon file name. wDefaultGetIconFile returns the icon image
to wIconCreate, then wIconCreate search the file name (again).

Is better that wIconCreate search first the file name, and then get
the image using the file name.
2012-10-06 15:37:58 +01:00
Rodolfo García Peñas (kix)
da5e2f8a0d Icon: Replace code by call to helper function in wIconCreateWithIconFile
Code in the function wIconCreateWithIconFile does the same task as
get_default_icon_rimage(), therefore replace it with a call to that
function.

It is the code to get the image file (rimage) using the file name.
2012-10-06 15:32:29 +01:00
Iain Patterson
39a5f3da0b Allow windows to specify their own depth.
Accept windows' depth, visual and colormap instead of always using those
of the root window.  Internal windows such as menus behave as before.

In conjunction with a compositing manager on a display supporting the
RENDER extension windows can now manage their own opacity.

I wrote the patch after reading the FAQ for urxvt, which says,
regarding transparency support:

"3. Use an ARGB visual:

  urxvt -depth 32 -fg grey90 -bg rgba:0000/0000/4444/cccc

This requires XFT support, and the support of your X-server. If that
doesn't work for you, blame Xorg and Keith Packard. ARGB visuals
aren't there yet, no matter what they claim. Rxvt-Unicode contains the
necessary bugfixes and workarounds for Xft and Xlib to make it work,
but that doesn't mean that your WM has the required kludges in place."

  In conjunction with a compositing manager (I tested compton) it does
work and urxvt draws a semi-transparent background with fully opaque
foreground text and scrollbars; much prettier than applying a blanket
transparency value over the whole window with the compositing manager.
Other application windows I tested were, as expected, drawn the same
as before.

  I verified that urxvt is drawn in the same way when using xfwm4
(with builtin compositing).  Since Window Maker doesn't (at time of
writing) have its own compositing manager I should clarify that one is
required to see any benefit from this patch.

  Whether or not this feature is useful for any application other than
urxvt I don't know, though I assume that an application which chose an
ARGB visual in the same way would be able to draw itself prettily.

  On a display without RENDER things work just as they do without the
patch.  I have, however, only been able to test on a fairly standard
TrueColor display supporting multiple colour depths with 24bpp being
the default.  Testing with more ... exotic ... display types would
probably be advisable.
2012-08-22 00:24:41 +01:00
Rodolfo García Peñas (kix)
bef6555b6a noDefault changed to default_icon
The functions wDefaultGetIconFile(), get_default_icon_filename() and
get_generic_value() use the argument noDefault in order to avoid searching the
default icon. This double negation is difficult to read though. This patch
changes it to be True if the default icon should be included or false if not.

This patch changes the noDefault argument to default_icon, then the
True is now False and False is True.

The main change is at get_generic_value():

-       /* Search the default icon name - See noDefault argument! */
-       if (!value && !noDefault) {
+       /* Search the default icon name - See default_icon argument! */
+       if (!value && default_icon) {

Because the functions wDefaultGetIconFile() and get_default_icon_filename()
mainly forwards the noDefault argument to get_generic_value().
2012-07-18 11:12:01 +01:00
Rodolfo García Peñas (kix)
2e7b7b7e02 Removed WScreen argument in wIconValidateIconSize
This patch removes the argument WScreen in wIconValidateIconSize,
because is not used.
2012-07-16 02:06:36 +02:00
Rodolfo García Peñas (kix)
fccde3b7e6 Better icon scale
The icons should be scaled if their size is "max_size - ~3 pixels".
Tipically, max_size is 64 pixels. With the current wIconValidateIconSize
the max size for an icon is "64 pixels", then the icon don't have border
and is ugly. This problem is in the dock icons and in the switchpanel.

The new wIconValidateIconSize function don't use the fixel value of 64
pixels, uses the argument max_size to get the final icon size. The icon
is scaled holding the aspect ratio and reserve ~2 or ~3 pixels to hold
left space to the icon border. Now the icon is inside the icon space,
with border.

This patch removes the preprocessor option of DONT_SCALE_ICONS, because
all the icons should be scaled if needed, to hold a beatiful interface.
2012-07-15 16:29:57 +02:00
Rodolfo García Peñas (kix)
d6db53af0b Remove unused argument from wDefaultGetIconFile()
The function wDefaultGetIconFile() doesn't use the argument WScreen,
so it can be removed.
2012-07-04 20:44:40 +02:00
Rodolfo García Peñas (kix)
0e671d3683 icon.c code cleanup 2012-06-23 11:26:33 +01:00
Rodolfo García Peñas (kix)
ee450acb30 Change a small comment in icon.c
The path of the CacheIcons is defined at CACHE_ICON_PATH. The path
~/GNUstep/Library/WindowMaker/CachedPixmaps can be changed in a future
and the comment is incorrect.
2012-06-18 23:22:22 +01:00
Rodolfo García Peñas (kix)
cedf620543 New function get_name_for_instance_class
The function get_name_for_icon is renamed to get_name_for_wwin.

The previous contents of get_name_for_icon are now at the new
function get_name_for_instance_class.
2012-06-12 00:15:20 +01:00
Rodolfo García Peñas (kix)
f8291de919 Function get_name_for_icon splitted
The function get_name_for_icon returns now the name of the icon,
without the full icon path and without extension (.xpm). Now is
not static.

The full path, including the folder creation, is done now by
wmkdirhier() (WINGs). This function is much better, because
supports "infinite" folders, not like the old get_name_for_icon
which could only create the specific folder for Cache Icons.

Using this functions, wIconStore() do the same work, but in a better
way, more clear.
2012-06-10 00:30:14 +01:00
Rodolfo García Peñas (kix)
7ef416f8ac New functions in icon.c
This patch creates some functions:

1. Rename getnameforicon() to get_name_for_icon()
2. New function get_icon_cache_path, to get the icon cache folder
   ($HOME + GNUstep/Library/WindowMaker/CachedPixmaps). This folder
   is defined now in the preprocessor. Not used yet, in next commits.
3. New function get_wwindow_image_from_wmhints to read the image from
   X11 wmhints. Previous code at wIconStore() now changed.
2012-06-10 00:01:55 +01:00
Tobias Stoeckmann
cc30444dda No need to call memset after wmalloc
memset is the last function call in wmalloc, just before it returns the
newly allocated memory.  Therefore it is not needed to call it again
after wmalloc call.  Although I would prefer to switch wmalloc to a
calloc-based wcalloc function, the compatibility of WINGs for old apps
should be kept.
2012-05-04 18:41:01 -03:00
Rodolfo García Peñas (kix)
0db76b822d wIconStore(): do not save the icon if it exists
The function wIconStore() doesn't write a new file overwriting the
previous icon if the icon file exists.
2012-04-16 09:32:24 -03:00
Rodolfo García Peñas (kix)
21fb6db616 WindowMaker: New function wIconCreateCore()
The new function wIconCreateCore do the common work to create a WIcon.

This code was before in wIconCreateWithIconFile() and wIconCreateWithIconFile().
2012-04-15 23:15:47 -03:00
Rodolfo García Peñas (kix)
aab9028fc2 Coding-style cleanup
Code style cleanup in multiple files. Tabs, spaces, curly brackets,...
2012-03-30 19:50:10 +01:00
Rodolfo García Peñas (kix)
1a0e665e58 WindowMaker: icon.c comments added
Some comments added to icon.c file.
2012-03-16 09:04:03 +00:00
Rodolfo García Peñas (kix)
1bec2efba0 WindowMaker: icon.c goto removed
The goto "make_icons" in icon.c was removed.
2012-03-16 09:03:11 +00:00
Rodolfo García Peñas (kix)
72f359be44 WindowMaker: New function get_pixmap_icon_from_user_icon
The new function get_pixmap_icon_from_user_icon() splits the
function wIconUpdate().
2012-03-16 08:59:45 +00:00
Rodolfo García Peñas (kix)
cf9f0ec67e WindowMaker: New function get_pixmap_icon_from_wm_hints
The new function get_pixmap_icon_from_wm_hints() splits the
function wIconUpdate().
2012-03-16 08:57:35 +00:00
Rodolfo García Peñas (kix)
3adc058421 WindowMaker: New function get_pixmap_icon_from_icon_win
The new function get_pixmap_icon_from_icon_win() splits the
function wIconUpdate().
2012-03-16 08:55:50 +00:00
Rodolfo García Peñas (kix)
9079b904d6 Little simplification in makeIcon() 2012-03-08 23:19:05 +01:00
Iain Patterson
07a0639c93 Don't shrink icons in switchpanel.
Icons in the switchpanel are constrained to the value of the IconSize
preference but the grid in which they are arranged is fixed at 64 pixels.
If IconSize is less than 64x64 the panel will show smaller icons with a
wide spacing, which looks pretty stupid.

Fix it by forcing the switchpanel to attempt to load images at the size
it's going to use.  The icon it actually gets may of course still be
smaller.
2012-02-16 09:13:01 +00:00
Tamas TEVESZ
f65b99e615 Remove warnings
* Remove assigned but not used variables (GCC 4.6)
* Bump _XOPEN_SOURCE to 600, ridding of FreeBSD warnings (this probably need
  to be tweaked on a per-implementation basis as problems arise)
2011-03-24 16:19:52 +01:00
Brad Jorsch
ee1f13da45 Fix wIconUpdate logic
This patch changes the logic for choosing the icon, and gets rid of
wIconChangeImage in favor of wIconChangeImageFile.

Old logic:
* On create, load either NET_WM_ICON or the file from disk.
* On update, choose (in order):
  1. WM_HINTS icon_window
  2. WM_HINTS icon_pixmap
  3. Whatever was loaded on creation, unless wIconChangeImage or
	 wIconChangeImageFile was called.
  4. Default icon.

New logic:
* On update, choose (in order):
  1. WM_HINTS icon_window
  2. NET_WM_ICON
  3. WM_HINTS icon_pixmap
  4. Icon file from disk.
  5. Default icon.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-08 22:00:24 +02:00
Tamas TEVESZ
3c408fa179 Update local copy of GPLv2 and FSF address in copyrights
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-08 18:13:56 +02:00
Tamas TEVESZ
1f21919809 Remove wsyserrorwithcode, rename wsyserror to werror
wsyserrorwithcode - Not used, no point either.
wsyserror->werror - qualifying "error" with a "type" hardly makes
sense if there are not at least two "type"s. There are not. Safe trip.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Alexey I. Froloff
392ab2607d Highlite current window's appicon
This patch highlites appicon of a currently focused window.

Original-patch-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-11 17:56:40 +02:00