1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-21 05:18:06 +01:00
Commit Graph

2713 Commits

Author SHA1 Message Date
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)
df4141236b CachedPixmaps added as pixmap folder
The CachedPixmap folder is added to the icon list. This is because
if one icon is created, but the user change it and set other icon, the first
icon cannot be selected anymore using the settings window. The user
needs modify the configuration files by hand.

Some extra paths are added to the debian default config file.
2012-10-31 22:24:28 +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
Iain Patterson
c3024542ad Allow struts from all windows.
Respect _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL from all windows, not
just WWindows.  This will allow us to respect struts from app icons
and dock icons.
2012-10-30 16:22:02 +00:00
Iain Patterson
700f8cc706 Brief documentation on wAppIconFor() and wWindowFor().
Brief comment on what wAppIconFor() and wWindowFor() do, as it
may not be immediately obvious.

Given a raw X11 Window they will find the AppIcon (or WWindow,
respectively) associated with that window.  Thus they can map an
X11 object to a Window Maker internal object.
2012-10-30 16:21:44 +00:00
Iain Patterson
67f73e9d54 AppIcon helper functions.
Create wAppIconFor() and wAppIconTouchesHead() to match wWindowFor()
and wWindowTouchesHead().  These functions will allow us to locate the
window and head associated with a particular app icon or dock icon.
2012-10-30 15:26:52 +00:00
Iain Patterson
930e59dd31 Partially support _NET_WM_STRUT_PARTIAL.
Window Maker already supports the _NET_WM_STRUT property as described
in the EWMH spec.  We respect client-provided struts and avoid placing
or maximizing windows over those areas.  An example is that we don't
try to place or maximize windows where they would be obscured by an
always-on-top gnome-panel.

_NET_WM_STRUT is now deprecated and redefined as a special case of
_NET_WM_STRUT_PARTIAL, which allows variable strut widths.  A panel at
the bottom of the screen, for example, does not have to reserve the
whole width as a strut if it does not fill 100% of the screen width.
By default the XFCE bottom panel does not extend the whole width of
the screen, for instance.

Our method for restricting parts of the screen from placement doesn't
have a way to account for struts which are not 100% tall or 100% wide,
so until now we have ignored partial struts.  In the case of the XFCE
panel mentioned above, the result is that a window may maximize
underneath the panel and be obscured.

As a partial hackaround we now query windows for _NET_WM_STRUT_PARTIAL
but throw away the start and end co-ordinates, assuming instead that
the struts are full-width/full-height.  This trades off a small amount
of wasted placement space to avoid the case where windows can be
partially obscured by panels, which can be particularly annoying if
the panel is at the top and the victim's titlebar becomes hidden.
2012-10-28 10:58:43 +00:00
Rodolfo García Peñas (kix)
45c5145ff2 Debian configuration file error
This patch removes the extra commas in the configuration file
WindowMaker.

This bug was created in the commit 0e995bbf6e
but no debian packages were released.
2012-10-28 10:58:43 +00:00
Rodolfo García Peñas (kix)
0bd7bcd434 remove_wwindowstate name changed
The function remove_wwindowstate is now remove_wwindowstate. This was
proposed by Christophe and Carlos:

- - -
On 2012-10-09 01:09, Carlos R. Mafra wrote:
> On Tue,  9 Oct 2012 at  0:58:19 +0200, Christophe wrote:
> you name the function "remove_*", which makes think that it would
> remove the entry from the list, but the function does not do that, it
> just frees the memory, so it may have been better called "free_" (or
> maybe "release_")?
>

Good point, release_ makes more sense to me.
- - -
2012-10-28 10:58:43 +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
Rodolfo García Peñas (kix)
ac4362a88f wmspec code clean - style
This patch do these changes:

1. Removes the extra curly brackets
2. Add curly brackets if needed (code style)
3. Removes spaces in the function prototypes/declaration
   I think this is the best moment to do it, all together
   in a style clean patch.
4. Moves variable definition with the same type to the same line
2012-10-28 10:58:42 +00:00
Rodolfo García Peñas (kix)
8b6f884d36 wNETWMCheckClientHintChange should be void
The function wNETWMCheckClientHintChange returns a Bool,
but this value is never used, son can be removed.

This function now is void.

kix@osaka:~/src/wmaker/wmaker-crm-tosnd/src$ grep wNETWMCheckClientHintChange *.[ch]
client.c:                       wNETWMCheckClientHintChange(wwin, event);
wmspec.c:Bool wNETWMCheckClientHintChange(WWindow * wwin, XPropertyEvent * event)
wmspec.h:Bool wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event);
2012-10-28 10:58:42 +00:00
Rodolfo García Peñas (kix)
027a720c17 wNETWMCheckClientHints should be void
The function wNETWMCheckClientHints returns a Boolean, but
this value is never used, so can be removed.

This patch removes the boolean returned, the variable hasState,
and so some parts of the function changes.
The patch also moves some variable definition to the same line:
one type, one line.
2012-10-28 10:58:42 +00:00
Rodolfo García Peñas (kix)
e71f78f4fe Code not needed at wWindowSetupInitialAttributes
The variable "check" is always False, so the if (!False) is always
True and the function wNETWMCheckClientHints is always called.

The variable check is not used anymore, so the variable check
can be removed.
2012-10-28 10:58:42 +00:00
Rodolfo García Peñas (kix)
a6d3317a9a wNETWMCheckInitialClientState is now void
The function wNETWMCheckInitialClientState returns a Bool,
but this value is never used, so the function can be void.

kix@osaka:~/src/wmaker/wmaker-crm-tosnd/src$ grep wNETWMCheckInitialClientState *.[ch]
window.c:       wNETWMCheckInitialClientState(wwin);
wmspec.c:Bool wNETWMCheckInitialClientState(WWindow * wwin)
wmspec.c:       wmessage("wNETWMCheckInitialClientState");
wmspec.h:Bool wNETWMCheckInitialClientState(WWindow *wwin);
kix@osaka:~/src/wmaker/wmaker-crm-tosnd/src$
2012-10-28 10:58:42 +00:00
Rodolfo García Peñas (kix)
235114993d wNETWMShowingDesktop is now static
The function wNETWMShowingDesktop is only used at wmspec.c, so
can be static.
2012-10-28 10:58:42 +00:00
Rodolfo García Peñas (kix)
404e4a7a03 Make debug statement print function name
The wmessage function returns "enter" in two functions, so is
not possible to know the function that sends the message.

It is better to replace it with the function name.
2012-10-28 10:58:42 +00:00
Carlos R. Mafra
653b099ea2 Revert "Fixed incorrect attributes for XCreateWindow's attributes"
This reverts commit 824255b1ae.

According to Iain Patterson:

  This patch breaks the frame extents stuff I submitted recently. With
the patch and compton set to draw semi-opaque frame extents what
actually happens is no window decorations are drawn and a bunch of
BadDrawable errors are spewed to the console.

  After reverting the patch everything works again.
2012-10-28 10:58:42 +00:00
Christophe CURIS
824255b1ae Fixed incorrect attributes for XCreateWindow's attributes
The code was setting some values in the window's attribute structure
which were not being used (missing the corresponding vmask flag) and
was setting some vmask bits without setting the corresponding
value in the structure.
2012-10-10 22:47:28 +01:00
Christophe CURIS
a2d2f76bd0 Fixed possible null pointer dereference
The new function 'unpaint_app_icon' checks its argument 'wapp' aginst NULL,
however it does dereference the pointer beforehand, which will end up in
a crash if the null-pointer case occurs.
2012-10-09 00:29:22 +01: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)
e357e94896 Icon creation in only one function
This patch avoids the icon creation in winspector.c and adds the
ability of creating + paiting and unpainting instead of destroying the icon.

Now the icon is always created by wApplicationCreate and the icon
exists while the application is runnning. If the user doesn't want
an appicon the winspector.c will not remove the icon, it will only
not paint it on the screen. But the icon is still created.

Probably the most difficult part in this code is how to handle the
icons in the iconlist. We must include the icon in the iconlist when
it is painted, not when it is created. And it must be removed when it
is unpainted.

We can check if the icon is in the iconlist if icon->next AND icon->prev
are null, else it is on the applist. If it is included we must not
paint it again because the function PlaceIcon() will calculate a new
icon place in the screen including the icon!, then a hole is painted.
2012-10-08 15:26:29 +01:00
Rodolfo García Peñas (kix)
952f6bfb1c wcore set vmask in one step
This patch set the vmask in one line.

- vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect;
- vmask |= CWColormap;

Is similar to:

+ vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect | CWColormap;

And vmask is not used between the two original lines, therefore we can do the
initialization in only one line.
2012-10-08 15:17:15 +01:00
Rodolfo García Peñas (kix)
e3db102591 wmcore code clean
This patch changes spaces with tabs, make the comments shorter and removes
some old comments.
2012-10-08 15:11:57 +01:00
Rodolfo García Peñas (kix)
41af9ca07f New helper function remove_wwindowstate()
The common code in the functions wWindowDeleteSavedState and
wWindowDeleteSavedStatesForPID is moved to a new function remove_wwindowstate.
2012-10-06 15:52:29 +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)
adfb761021 wAppIconCreateForDockm, changed variable WAppIcon name
The variable "dicon" is now named "aicon", the same name that
the WAppIcon variable used in wAppIconCreate.

Some clean code more, like spaces in function arguments.
2012-10-06 15:46:03 +01:00
Rodolfo García Peñas (kix)
ff49393bfa Remove call to wIconUpdate() from wAppIconCreate()
Remove the call to wIconUpdate() in wAppIconCreate() and place it in
makeAppIconFor() since wAppIconCreate() is only used in that function
and icon update or icon painting is not icon creation.

Now the function wAppIconCreate() only creates the app_icon.
2012-10-06 15:44:57 +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
Rodolfo García Peñas (kix)
e988386013 Removed block in restore_icon_state
The block inside restore_icon_state is not needed, so can be removed.

There are no changes with or without the block (variables scope,...).
2012-10-06 15:29:58 +01:00
Rodolfo García Peñas (kix)
a089647d27 Coding style cleanup in dock.c
This patch reviews the code style in dock.c, removing some
curly brackets not needed and adding other where needed.

This patch removes some lines commented and some extra lines for
better understanding.
2012-10-06 15:25:10 +01:00
Rodolfo García Peñas (kix)
3c7ca36d5b Code style cleanup in framewin.c
This patch reviews the code style in framewin.c, removing some
curly brackets not needed.

This patch also removes some commented-out lines.
2012-10-06 15:23:26 +01:00
Iain Patterson
5c0b851cc6 Remove _NET_FRAME_EXTENTS on shutdown.
After we exit there are no window decorations therefore frame extents
are meaningless.

We could be left with parts of the window being the wrong opacity if the
property is left intact and a compositing manager configured to draw
decorations with a different opacity to the rest of the window is still
running.

Remove the _NET_FRAME_EXTENTS property from all windows when we shut
down to prevent windows from being drawn incorrectly after we're gone.
2012-09-16 13:01:23 +02:00
Rodolfo García Peñas (kix)
0e995bbf6e Debian 0.95.3-20120909-1 version
This is not a final version, is only a version for developers.

This version includes compatibility with debconf 9.
This version will be modified to change the libwutil2 symbols
to a new upstream version, probably 0.95.4.
2012-09-10 11:00:09 +02:00
Iain Patterson
5d8dfa4764 Fixed invalid argument to popen in readMenuPipe().
We were passing "rb" to popen(), which was failing with EINVAL with the
result that generated menus were not displayed.
2012-08-25 11:00:09 +01:00