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

87 Commits

Author SHA1 Message Date
David Maciejak
0ccc5bbde7 Coverity: fix wmspec dereference after null check 2023-03-02 17:04:48 +00:00
David Maciejak
3cc5808dcd Coverity: fix wmspec uninitialized layer variable 2023-02-28 13:40:48 +00:00
David Maciejak
d2d5297a1e Coverity: fix potential buffer overflow 2023-02-28 13:33:11 +00:00
David Maciejak
4d658341d2 Add support for _NET_WM_FULLSCREEN_MONITORS
This patch adds the _NET_WM_FULLSCREEN_MONITORS hint as defined in EWMH which is based on Xinerama.
It's allowing a window to be displayed fullscreen on multiple monitors.

Issue mentioned at https://github.com/window-maker/wmaker/issues/8
Specs at https://specifications.freedesktop.org/wm-spec/1.5/ar01s06.html#idm45763309187776
GTK test program used https://bugzilla.gnome.org/show_bug.cgi?id=414476
2023-02-18 08:41:08 +00:00
82ab2d2d06 Correct calculation of usable space for reserved area.
Previous patch has correct the way, how reserved area found in
_NET_WM_STRUT was calculated. Unfortunately, the calculation was not
precise, as for not reserved areas (i.e. values of 0 for one of the
cardinals is set) must be calculated anyway for given head, otherwise
usable area might be too broad.
2021-03-18 16:08:40 +00:00
bbf24d1d39 Correct way for reserved space on multihead environment.
Applications such a panels or docks have ability for reserving space so
that no windows should cover or overlap them. There is (partially)
support for it by checking the _NET_WM_STRUT property, although
calculation for the reserved space was wrong in case of several heads
enabled.

In this patch calculation for reserved area has been corrected.
2021-03-16 20:39:54 +00:00
Nick Berendsen
1cd8fea423 Add support for _NET_WM_STATE_FOCUSED
Thanks to Jeremy Sowden for sending the patch to the mailing list.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2020-10-27 15:35:08 +00:00
Doug Torrance
54a24ab6f7 Remove trailing whitespace.
Also, the script is a one-liner, stolen from [1]:

ack --print0 -l '[ \t]+$' | xargs -0 -n1 perl -pi -e 's/[ \t]+$//'

[1]
https://stackoverflow.com/questions/149057/how-to-remove-trailing-whitespace-of-all-files-recursively
2020-04-09 14:28:09 +01:00
Tim Taenny
2427200c3e Added feature: automatic scaling of application icons
If the option "Enforce icon margin" is selected, application window
icons will be selected or scaled so that they only use 75% of the
available icon_size.
Even if the feature is not enabled, this change will scale down
large application icons to icon_size, so that icons can be used
that were rejected by the previous implementation of findBestIcon.
(Example: The Qt Creator icon never showed before, because it is
only provided in 128x128 resolution. Now it's visible.)
2019-01-31 17:22:49 +00:00
Bad Sector
569fbff07c wmaker: Add new advanced option to ignore decoration changes from clients.
This adds an option (IgnoreDecorationChanges in plist) for windows to
ignore any requests from the clients for changing decorations. Since the
default state for any window pre-request is to have all decorations visible
this basically means that applications cannot hide any of the titlebar,
sizing bar, titlebar buttons, etc and any hint that causes these elements
to be hidden will be followed by a restoration if this option is set.

 This is useful for broken clients (e.g. Steam) and clients that force
subpar client side decorations. It is basically a per-window setting of the
global advanced option to ignore Gtk hints, except that it also applies to
non-Gtk applications.
2018-02-14 08:16:55 +00:00
6e4698fe11 Fixed couple of compilator warning and removed unused macros. 2017-02-25 10:19:52 +00:00
e2f8525728 Added 'head' parameter to wMaximizeWindow
Additional 'head' parameter will help to select head (display) where
window should be maximized.
2017-02-08 07:26:35 +00:00
Bjørn Mork
6429847494 wmaker: fix stacking order of dock and fullscreen
This reverts the commits:
 311ab6b08c ("Raise fullscreened window")
 a504370f3b ("Remove WMFullscreenLevel")

Removing WMFullscreenLevel had the side effect that a dock or panel
having the _NET_WM_WINDOW_TYPE_DOCK type would stack on top of
fullscreen windows, obscuring part of them.  This is unwanted. No
other window should cover a focused fullscreen window:.
https://specifications.freedesktop.org/wm-spec/latest/ar01s09.html#STACKINGORDER

Simply raising the fullscreen window to the top of the stack of normal
windows is not sufficient if there are windows with higher stacking
levels present.  The separate WMFullscreenLevel is needed.

Cc: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2016-07-12 23:21:00 +01:00
Christophe CURIS
7d6ecb51f6 wmaker: rewrote the update of _NET_WORKAREA property
As reported by Moritz, the Qt toolkit (and maybe a few other ones) are
using the content of this property, but WindowMaker did not set it properly
so for examples the menus in KDE could fail to display in multi-screen
configuration (probably because the toolkit is using the property to make
sure the menu stays in the visible area).

The original code just assumed it was safe to use the usable area of the
1st screen in the list, but unfortunately it is not that simple.

The new code calculates a rectangle that contains the usable region from
all the screens, so the toolkit gets a more accurate value.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-16 09:37:48 +00:00
Christophe CURIS
ee617cb291 wmaker: comment out definition of wm-spec constant that we do not use
Include a comment to explain what their aim is, and why WindowMaker is not
making use of them. They are not simply removed because it is informative
for future contributors that we know about them and we purposedly decided
to not use them.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-12-10 10:19:19 +00:00
Christophe CURIS
3dea732ccb wmaker: removed variable 'done' to prepare return status in 'wNETWMProcessClientMessage'
Using a variable to store the return value that will be used later is not a
good idea, because it forces to track everywhere in the function when
needing to work on the function.

This patch removes the variables and places explicit return if each case,
so on first look it is clear where the code stops.

It also fixes a bug where the function would handle an event but still
returns False (meaning the event was not treated), whose root cause was
coming from the complexity brought by the variable.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-29 18:44:48 +00:00
Christophe CURIS
88352b7274 wmaker: do not remove Title Bar for windows that declare themselves as Toolbar or Tear-off menu
As pointed by Germán Arias, some windows in GNUstep did not have a title
bar because they declare themselves with the NET_WM type MENU.

A closer look at the spec shows that this type is meant for stuff like tear
off menus, and thus like for toolbar it is not expected that the
application does not want a titlebar, as opposite to DROPDOWN_MENU,
POPUP_MENU and COMBO.

So, this patch moves the case for TYPE_MENU to be the same as TYPE_TOOLBAR
and remove the flag that disables having a title bar.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-23 22:43:38 +00:00
Milan Čermák
484c880fd0 wmaker: remove call to internal X11 header
The header 'Xarch' is not part of the standard, it is an internal header
that is already included by the other headers; furthermore it is not needed
directly by the code in wmspec.c.

As it breaks compilation on some platforms (namely Solaris 10), its call is
removed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2014-11-02 13:08:59 +01:00
BALATON Zoltan
cb3702559a wmaker: Restore multi screen functionality by reverting wrong commits
Revert patches that moved variables from WMScreen to global level
because this broke X displays with multiple independent screens and
caused dock and clip icons to become mixed up. When managing multiple
screens each screen used to have it's own state/dock and clip. This
commit restores that by reverting mainly the commits listed below (and
those that are invalidated by reverting these) and fixing up later
commits to apply after the revert.

Reverted commits:
f60e65001b Moved 'workspace_name_font' from the Screen to a Workspace object in the global namespace
9e103a46e9 Variable workspace_count moved to the workspace object in the global namespace
e5ae684d02 Variable last_workspace moved to workspace object in global namespace
c610b8d7ce Variable current_workspace moved to workspace object in global namespace
f0c5073600 Array of workspaces moved to the workspace object in the global namespace
9c252988f8 Variable workspace_menu moved to workspace object in global namespace
e86b8dcb2f Clip, Dock and Drawers menu moved to appropriate global namespace
074092f319 Removed WScreen args not used
4a7daf2322 AppIcon list moved out of WScreen
2103fe390b Variable clip_icon moved to clip object in the global namespace
014bc52531 wClipIconPaint appicon argument removed
40e1ea08b8 Varible session_state moved to global namespace
6987d4aa40 Removed WScreen argument
0de3e590ce shortcutWindows moved to w_global
2e64831fb6 Removed unused variable wapp_list
b6423a7b4f wmaker: Moved variable Screen Count into the global namespace

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2014-11-02 13:04:14 +01:00
David Maciejak
9c381862b3 wmaker: implement EWMH _NET_WORKAREA
This patch is adding the _NET_WORKAREA property
which according to EWMH spec MUST be implemented.
Some application like rdesktop or nautilus are using
it, that's maybe why you encountered some errors like these:

** (nautilus:6457): WARNING **: Can not get _NET_WORKAREA
** (nautilus:6457): WARNING **: Can not determine workarea, guessing at layout

For now, the property is only updated when a workarea is created or destroyed.
2014-08-29 12:43:50 +01:00
Brad Jorsch
6d5ffca076 Set no_focusable for "notification" and "tooltip" windows
Notification popups, and tooltips for that matter, shouldn't be taking
focus away from apps the user is actually interacting with.
2014-04-24 09:27:15 +01:00
Brad Jorsch
288943c813 Add _NET_WM_WINDOW_TYPEs added in EWMH 1.3
EWMH 1.3 added various window types: dropdown_menu, popup_menu, tooltip,
notification, combo, and dnd. We may as well set appropriate defaults if
these types get set on a window that isn't override-redirect.

I'm not terribly attached to these defaults, except that the ones for
'notification' are what I set manually for xfce4-notifyd before deciding
to patch wmaker.
2014-02-13 08:55:47 +00:00
Brad Jorsch
2e0d2f3df9 Minimal support for _NET_WM_WINDOW_OPACITY
While we don't provide compositing ourselves, add-on compositors such as
xcompmgr need us to copy the _NET_WM_WINDOW_OPACITY property from the
client window to the frame window.

We can do this easily enough.
2014-02-13 08:55:47 +00:00
Christophe CURIS
be022d9623 wmaker: Use the macro 'wlengthof' to get the number of element in an array
The new macro 'wlengthof' from WUtil makes code easier to read than the
previous [sizeof() / sizeof([0]) ] construct.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-12-30 18:11:03 +00:00
Amadeusz Sławiński
a504370f3b Remove WMFullscreenLevel
Make fullscreen windows be on the same level as normal ones.
2013-12-30 18:11:02 +00:00
Christophe CURIS
1f24970160 wmaker: Removed unused args to local functions in wmspec
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-11-01 15:27:11 -02:00
Christophe CURIS
fd10d4069f wmaker: Marked args as unused for compiler in WINGs Notif callback code
The mechanism of Notifications in the WINGs toolkit is relying on
callbacks to dispatch notifications, which means having a fixed argument
list for the handling function.

It is then correct to not use all the arguments, so this patch adds the
appropriate stuff to avoid a false report from compiler.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-10-13 23:00:19 +01:00
Rodolfo García Peñas (kix)
f0c5073600 Array of workspaces moved to the workspace object in the global namespace
The variable workspaces, that contains the list of workspaces
is moved to the global workspace properties.

Now the screen is not needed to know the workspaces.

The function getWindowState() doesn't need the WScreen argument.
2013-10-09 13:02:44 +01:00
Rodolfo García Peñas (kix)
c610b8d7ce Variable current_workspace moved to workspace object in global namespace
The variable current_workspace, that contains the current workspace
is moved to the global workspace properties.

Now the screen is not needed to know the workspace_count.
2013-10-09 13:02:44 +01:00
Rodolfo García Peñas (kix)
9e103a46e9 Variable workspace_count moved to the workspace object in the global namespace
The variable workspace_count, that contains the number of workspaces
is moved to the global workspace properties.

Now the screen is not needed to know the workspace_count.
2013-10-09 13:02:44 +01:00
Christophe CURIS
ecfb2dc902 wmaker: Moved definition of WM-related XAtoms into the global variables structure 2013-09-30 00:53:10 +02:00
Christophe CURIS
af6c4ec37f wmaker: Moved timestamp variable (#1) to the global variable structure 2013-09-29 16:31:49 +01:00
Christophe CURIS
74cd836e48 wmaker: Replaced local 'extern' definition of wPreferences by proper header usage
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2013-06-30 15:10:09 +01:00
Christophe CURIS
7f6699ffca Changed formula for getting the number of elements in a static array
When using the formula [sizeof(array) / sizeof( x )] to get the number
of element in a static array, it is better to use array[0] for 'x'
instead of the base type of array:
 - in case the base type would change someday;
 - if the compiler were deciding to insert padding somewhere
2013-05-11 00:17:27 +01:00
Rodolfo García Peñas (kix)
6aa43d356c wIconChangeTitle rewritten
The function wIconChangeTitle() now changes the icon title name
doing the full work (except painting it).

The function receives now the icon to change the name and the
wwindow with the new name. The function checks if icon and the
window exists.

Then, try to get the name using wNETWMGetIconName(), if not found
then try to read it from wGetIconName(). Then the icon has the new
name and the function returns.

This is better because:

1. We don't need a flag to know if the window got the name
   using the wNETWMGetIconName function. Now call this function
   always.

2. We do the same work in all calls to the wIconChangeTitle()
   function.

The functions that uses wIconChangeTitle (at client.c, icon.c and
wmspec.c) uses always the value set by wNETWMGetIconName() first,
else, the value set by wGetIconName(). This is the reason for the
flag net_has_icon_title. Now the flag can be removed.
2013-04-09 08:30:54 +01:00
Rodolfo García Peñas (kix)
4093d24625 wIconUpdate removed image argument
The argument image is not used in any call, so can be removed.
2013-04-08 22:06:26 +01:00
Iain Patterson
2affd6d484 Make window border size configurable.
Use the new preference FrameBorderWidth to configure the width of frame
window borders.
2013-03-26 23:19:39 +00:00
Rodolfo García Peñas (kix)
522d84b0ef wIconUpdate image preselected
The function wIconUpdate can receive a image to setup as icon image.
If image is NULL, then use the original method, using different procedures
to get the image.
2012-11-17 20:38:36 +01:00
Rodolfo García Peñas (kix)
cc1503a2f0 wAppIconPaint argument removed
This patch removes the wAppIconPaint() Bool flag, because now it is
always False.
2012-11-11 11:59:41 +00:00
Rodolfo García Peñas (kix)
33ebded4f9 wAppIconPaint paint argument
The function wAppIconPaint has a new argument. This argument is used
to force an icon create if needed.
2012-11-11 11:57:58 +00:00
Rodolfo García Peñas (kix)
19326554cc 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.
2012-11-04 00:35:36 +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
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)
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)
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
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