1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-30 18:32:34 +01:00
Commit Graph

1745 Commits

Author SHA1 Message Date
David Maciejak
215b6ee2e6 Set proper motif wm hints name
Just a cosmetic change as the variable is currently not in use.
According to the Motif Toolkit API and MwmUtil.h, the last long
variable from the Motif WM Hints struct is currenlty used
for the status.
2023-04-09 10:42:52 +01:00
David Maciejak
ab45c6c6c2 Add central position feature for active window
This patch adds a new Central feature under the window menu
"Other maximization" entry.
Shortcut can be configured via WPrefs "Center active window" action.
When called the active window is centered on the screen head.
If the window height or width are bigger than the head size,
the window is resized to fit.
There are some transitions defined as below:
*from fullscreen to center
*from any corner to center
*from top half to center top half
*from bottom half to center bottom half
*from left half to center left half
*from right half to center right half

Undoing the action is done via the window menu "Unmaximize" entry
or the shortcut.
2023-03-31 09:11:38 +01:00
David Maciejak
802cbc0d75 Hot corners feature core
Add mouse pointer position detection to trigger the corner actions.

Screen corners can be assigned an external command to be
executed when the mouse pointer is entering those areas.

In WPrefs, "Hot Corner Shortcut Preferences" can be used
for configuration or by manually adding a "HotCorners" key
and value to "YES" in the ~/GNUstep/Defaults/WindowMaker file.

Actions are specified by the "HotCornerActions" and are defined
as a four entries list ("top left action", "top right action",
"bottom left action", "bottom right action").
A screen corner area is a cube shape defined by the "HotCornerEdge"
which is a number of pixels from 2 (by default) to 10.

To lower the risk of triggering that feature accidentally a
"HotCornerDelay" key can be used which is the time before the action
is triggered while the pointer is in one of the screen corner.
Default value is 250 ms.

Hot Corners feature is disabled by default.
2023-03-26 10:35:33 +01:00
David Maciejak
157d1ba85f Fix internal function name typo
The patch is to fix a typo in the fct name movePionterToWindowCenter
2023-03-23 12:57:58 +00:00
David Maciejak
18a539b372 Add some more cases to handle window unusual size request
As discussed on the ML, the test to check for CARD16 limit is probably innacurate.
Check instead for maxH and maxW which are set by default to twice the size
of the screen or to the max values passed by the window normal hints property.
2023-03-16 15:02:18 +00:00
David Maciejak
eae9200c5d Fix ICCM ConfigureNotify request
According to ICCM specs at [1]

*Not changing the size, location, border width, or stacking order of the window at all.
A client will receive a synthetic ConfigureNotify event that describes the (unchanged)
geometry of the window. The (x,y) coordinates will be in the root coordinate system,
adjusted for the border width the client requested, irrespective of any reparenting
that has taken place. The border_width will be the border width the client requested.
The client will not receive a real ConfigureNotify event because no change has actually
taken place.

*Moving or restacking the window without resizing it or changing its border width.
A client will receive a synthetic ConfigureNotify event following the change that
describes the new geometry of the window. The event's (x,y) coordinates will be in
the root coordinate system adjusted for the border width the client requested.
The border_width will be the border width the client requested. The client may not
receive a real ConfigureNotify event that describes this change because the window
manager may have reparented the top-level window. If the client does receive a
real event, the synthetic event will follow the real one.

*Resizing the window or changing its border width
(regardless of whether the window was also moved or restacked).
A client that has selected for StructureNotify events will receive a real
ConfigureNotify event.
Note that the coordinates in this event are relative to the parent,
which may not be the root if the window has been reparented. The coordinates will
reflect the actual border width of the window (which the window manager may have
changed). The TranslateCoordinates request can be used to convert the coordinates
if required.

In Window Maker, the first case is not implemented: doing a synthetic ConfigureNotify
to notify no changes were done. That's creating some issues with app like Citrix icaclient
when sometime windows are blank and need to be moved to be refreshed.

[1]https://x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#configuring_the_window
2023-03-16 15:02:18 +00:00
David Maciejak
25cb9d208a Update window.c copyright
Just updating the copyright line in the file header.
2023-03-16 15:02:18 +00:00
David Maciejak
23471b2e21 WPrefs: update maximization feature descriptions
Align the old maximization descriptions to the new visual indicator
names. The internal shortcut names had also been updated, meaning a
reconfiguration of the shortcuts in WPrefs is required.
2023-03-16 11:36:02 +00:00
David Maciejak
258ffc8b97 Window menu: add maximization visual indicators
Add visual indicators for the maximization options in the window menu.
2023-03-14 12:27:16 +00:00
David Maciejak
86b7ec1a58 Restore proper drawer direction when screen was resized
Since 48d4820dee the dock is positioned
dynamically based on the screen midpoint.
The side issue using such method is if in case the screen was temporarily
resized the dock as a chance to be displayed on the other side making
the drawer saved configuration from WMState esp the direction wrong when
wm is started again.
For example, the dock and drawer are displayed on the right of the screen.
Then the screen resolution is downsized temporaily to half or less of
the previous size. The position stored in WMState will be updated and the
direction of the drawer is still opening on the left.
But on next wm start, when reading the conf.
The position of the dock and drawer are corresponding to the
middle or less of the unresized screen. The dock and drawer will be sticked
on the left. But the drawer direction was not updated and still opening
on the left (which is out of the screen).
2023-03-14 12:27:16 +00:00
Doug Torrance
9831e3f72a Move declarations to beginning of switch statements
Several variable declarations were recently added immediately after
labels, but this causes compile errors in GCC versions prior to 11,
e.g.,

    wsmap.c: In function ‘handle_event’:
    wsmap.c:534:4: error: a label can only be part of a statement and a declaration is not a statement
      534 |    WMScreen *wmscr = wsmap->scr->wmscreen;
          |    ^~~~~~~~

We move these declarations to the top of the corresponding switch
statements so that Window Maker can compile on these older versions of
GCC.
2023-03-13 15:33:21 +00:00
David Maciejak
0ecf7d3540 KeepDockOnPrimaryHead: fix drawer direction
When that option is on, swapping drawer does not always mean
swapping drawer direction. For example if drawer is on the left
side of the second head and moving to the left side of the first head,
the direction should be the same.
2023-03-13 15:32:19 +00:00
David Maciejak
4576b5bf1e Info Panel: display proper number of colors in deepcolor env
Instead of displaying a number of unitary colors in 10bit env,
display a more human readable message.
2023-03-13 15:32:19 +00:00
David Maciejak
4c52232ee7 Window titlebar double click to unmaximize
Commit 6e2075f3df from 2020 added
a feature to maximize window when double clicking on the titlebar.
But unmaximizing is not supported so when double clicking again
on the window titlebar the window geometry was not reverted back.
2023-03-12 09:44:10 +00:00
David Maciejak
43edd37ee2 Update file headers year copyright
Update copyright year for Window Maker Team entries.
2023-03-12 09:44:10 +00:00
David Maciejak
e95aea2e30 Workspace pager: display ? on non visited mini workspace
When the workspace pager is displayed it's showing grey mini workspaces
for non rendered/non visited workspaces. That patch is adding an exclamation
mark in the middle of the dummy grey background mini workspaces.
2023-03-11 11:38:25 +00:00
David Maciejak
3e991badf7 SwitchPanel: fix app icons opacity combination
For some apps the background is not displayed properly, showing
some kind of shawow around the app icon like for example firefox
or skype. This is due to an issue in combining alpha channels.
2023-03-09 15:05:58 +00:00
David Maciejak
d045ffcf7d Add a screenshot capture feature
This patch adds a feature to take screenshots directly from Window Maker.
Having the feature embeded direclty inside Window Maker allows us to take
advantage of how Window Maker is managing and handling Windows.
Three new actions can be bound to a key shortcut from WPrefs.
The screenshot files are saved in ~/GNUstep/Library/WindowMaker/Screenshots/
dir, with a "screenshot_%Y-%m-%d_at_%H:%M:%S" format followed by the
extension. Preferably as a PNG or JPG file if available.
Meaning, to work Window Maker via WRaster needs to support
at least one of those format.

"Capture the entire screen" is quite standard, it takes a screenshot
of the whole screen area (even in multiheads env).
"Capture a portion of the screen" requires the user to draw a rectangle which
will be captured.
Those two first are quite straightforward, just taking a live picture of
the screen.
The last one is "Capture a window" which works in best effort mode,
it catures the focused window. As Window Maker by default is not using
any compositor (like for example Xcompmgr) it can only dump the content
displayed on the screen.
If a window is minimized or out of the screen, there is high chance the
image will be split or some area greyed in case other windows overlapped it.
2023-03-07 17:30:59 +00:00
David Maciejak
7185af15cf Use wtokenfree whenever there is wtokensplit
Whenever wtokensplit is used to split into argv/argc, it's better to
use the built-in function wtokenfree() as a wfree call only on argv
is not freeing the memory properly.
2023-03-05 00:16:44 +00:00
David Maciejak
0ccc5bbde7 Coverity: fix wmspec dereference after null check 2023-03-02 17:04:48 +00:00
David Maciejak
0e00c6b605 Coverity: fix dialog dereference null return value
This patch is making sure defaultPath returns from FindImage() is not null
and freeing the variables.
2023-03-02 17:04:48 +00:00
David Maciejak
6c7266c338 Coverity: fix session resource leak 2023-03-02 17:04:48 +00:00
David Maciejak
b4bd6d0cad Coverity: fix xmodifier uninitialized scalar variable 2023-03-02 17:04:48 +00:00
David Maciejak
d831766572 Coverity: fix rootmenu structurally dead code 2023-03-02 17:04:48 +00:00
David Maciejak
1215680b6d Coverity: fix misc resource leak 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
8ca89f0141 Coverity: fix RContextAttributes uninitialized variable 2023-02-28 13:33:11 +00:00
David Maciejak
d2d5297a1e Coverity: fix potential buffer overflow 2023-02-28 13:33:11 +00:00
David Maciejak
9f8dc6f5dc Use W_KeycodeToKeysym instead of XkbKeycodeToKeysym
This patch replaces XkbKeycodeToKeysym by our
own function W_KeycodeToKeysym.
2023-02-27 23:05:27 +00:00
David Maciejak
2dd98666f1 Store window maximize state as hex value
As the maximize state is defined as a bit-field internally.
Better to store the flag in the WMSTATE file as hex value.
2023-02-27 22:37:44 +00:00
David Maciejak
64a8ecb390 Code cleaning: removing trailing space
The patch is removing trailing space(s) before
the semicolon ending line. .c and .h files were checked.
2023-02-27 22:37:44 +00:00
David Maciejak
1d8b38b6e0 Fix compiler warnings from texture.c v2
The patch fixes those 2 warnings below from texture.c.
It reverts the previous v1 patch and fixes the compiler warning
by updating the texture.h wTextureMakeIGradient header instead.

texture.c:205:81: warning: argument 3 of type 'const RColor[2]' with mismatched bound [-Warray-parameter=]
  205 | WTexIGradient *wTextureMakeIGradient(WScreen *scr, int thickness1, const RColor colors1[2],
      |                                                                    ~~~~~~~~~~~~~^~~~~~~~~~
In file included from texture.c:33:
texture.h:165:53: note: previously declared as 'const RColor[]'
  165 | WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
      |                                                     ^~~~~~~~~~~~~~
texture.c:206:67: warning: argument 5 of type 'const RColor[2]' with mismatched bound [-Warray-parameter=]
  206 |                                      int thickness2, const RColor colors2[2])
      |                                                      ~~~~~~~~~~~~~^~~~~~~~~~
texture.h:165:74: note: previously declared as 'const RColor[]'
  165 | WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
      |
2023-02-25 13:31:42 +00:00
David Maciejak
82ad19d420 Fix compiler warnings from texture.c
The patch fixes those 2 warnings below from texture.c

texture.c:205:81: warning: argument 3 of type 'const RColor[2]' with mismatched bound [-Warray-parameter=]
  205 | WTexIGradient *wTextureMakeIGradient(WScreen *scr, int thickness1, const RColor colors1[2],
      |                                                                    ~~~~~~~~~~~~~^~~~~~~~~~
In file included from texture.c:33:
texture.h:165:53: note: previously declared as 'const RColor[]'
  165 | WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
      |                                                     ^~~~~~~~~~~~~~
texture.c:206:67: warning: argument 5 of type 'const RColor[2]' with mismatched bound [-Warray-parameter=]
  206 |                                      int thickness2, const RColor colors2[2])
      |                                                      ~~~~~~~~~~~~~^~~~~~~~~~
texture.h:165:74: note: previously declared as 'const RColor[]'
  165 | WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
      |
2023-02-24 12:19:38 +00:00
David Maciejak
492b22d975 Fix compiler warning from menu.c
The patch fixes the compiler warning below

menu.c: In function 'restoreMenuRecurs':
menu.c:2450:47: warning: '%s' directive output may be truncated writing up to 510 bytes into a region of size between 509 and 1019 [-Wformat-truncation=]
 2450 |         snprintf(buffer, sizeof(buffer), "%s\\%s", path, menu->frame->title);
      |                                               ^~

The code is taking care of checking properly the string passed to the buffer,
so there is no issue, the change is just to make the compiler happy.
2023-02-24 12:19:38 +00:00
David Maciejak
62405fbb75 Detect and override illegal window size hints v2
The patch is trying to mitigate and properly address the issue described at
https://github.com/window-maker/wmaker/issues/26
A buggy application (in that example virtualbox) is requesting a window size creation
that is way too big and basically at the limit of X11 protocol
(width and height are defined as CARD16).
See details at https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html
During the tests, virtualbox has been seen requesting for window creation of size 843x65508.
Even xprop is reporting incorrect values.

There had been an attempt before with the commit
https://repo.or.cz/wmaker-crm.git?a=commit;h=6668715402a5d8e2ecda6702076a06bf8988721e

But the patch is broken and not implemented at the right place.
As described in the wWindowConfigure function header, the size passed by the client app
should not be trusted and should be vetted with a prior call to wWindowConstrainSize.
wWindowConstrainSize call was missing only once in the wClientConfigure function from client.c
What wWindowConstrainSize doing now is basically setting a failsafe window size fo 640x480
if both width and height are above the size of CARD16.
If only one dimension is oversized, it's setting a default 4/3 window ratio.
Oversized here has not been changed and it's defined in windowmaker as double the screen size.
2023-02-22 20:10:31 +00:00
David Maciejak
f1fef40f0d Make window maximize state persistent
Window maximize state is not persistent between windowmaker sessions.
This patch is updating the save and restore workspace state functions
to update the state in the WMSTATE file.
2023-02-21 18:16:35 +00:00
David Maciejak
2fb9308a67 Info Panel: Add libXRes info if supported
If windowmaker was compiled with libXRes,
add XRes info in the "Additional support" section.

Take also the chance to remove the mode +x on the source code file.
2023-02-20 23:07:02 +00:00
David Maciejak
d902477efd Set missing WM_COMMAND using pid given from libXRes
For apps which are not setting the window WM_COMMAND property like those old
apps using Motif toolkit (I am thinking of NEdit for example)
it's bringing some issues in windowmaker which is relying on it for a few interactions.
Especially,
*an app without WM_COMMAND will not be saved during the workspace state
(so session restore is not working for them)
*when added to the dock, the settings parameters are empty and need to be filled
*cannot autostart from the dock (even if the settings are manually filled and saved)
*right click on the app titlebar, and choosing Launch has no effect

Most of the time, those apps are also not setting the X11_NET_WM_PID property.
With the pid we could have a chance to find the running program.
To link a window to a pid, there is the X11 Resource extension library (libXRes).
After checking, gnome and xfce are also using the same method to handle such issues.

The patch is checking if the libXRes is present on the system (but it's not mandatory to compile).
Then, it adds a layer on top of wNETWMGetPidForWindow to not only check the window property
but if necessary to get the underlying pid from libXRes if available.
That's solving the points mentioned above.
2023-02-20 15:00:55 +00:00
David Maciejak
5ee19c2308 Allow WM_COMMAND-less app to autostart
For apps which are not setting the window WM_COMMAND property like those old
apps using Motif toolkit (I am thinking of NEdit for example)
it's bringing some issues in windowmaker which is relying on it for a few interactions.
Especially,
*an app without WM_COMMAND will not be saved during the workspace state
(so session restore is not working for them)
*when added to the dock, the settings parameters are empty and need to be filled
*cannot autostart from the dock (even if the settings are manually filled and saved)
*right click on the app titlebar, and choosing Launch has no effect

The patch below allows the workspace state to be saved for those apps without WM_COMMAND
that have been launched from the dock. We are just reusing what have been set in the
Application Path Settings of the dock app (and it does not require extra libs like libXRes).
2023-02-20 15:00:55 +00:00
David Maciejak
fabd4252ab Allow exit panel to be bound to a key shortcut
While debugging the save/restore workspace state, I found quite
useful to be able to exit windowmaker using a key shortcut.
2023-02-20 15:00:55 +00:00
David Maciejak
630e9292c2 Factorize duplicate run command code
Run command from the menu and run command from the key shortcut are from two different codes.
Merge them into one function instead.
2023-02-19 10:10:49 +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
David Maciejak
ac75047aef Fix mini workspace compiler warnings
The patch is to fix warnings like:
wsmap.c: In function "update_mini_workspace":
wsmap.c:451:55: warning: "%d" directive output may be truncated writing between 1 and 11 bytes into a region of size 10 [-Wformat-truncation=]
  451 |                         snprintf(name, sizeof(name), "%d", general_index);
2023-02-17 21:51:06 +00:00
David Maciejak
6d6f9f6ff5 Info Panel: Fix uninitialized posn variable 2023-02-16 11:34:54 +00:00
David Maciejak
370adc94e7 Ignore WM_NORMAL_HINTS resize increment for maximized windows
If you are trying to maximize old apps that are setting a resize increment
in term of WM_NORMAL_HINTS notion the window will not be maximized fully (by a few pixels).
It's easy to reproduce with xterm, ctrl double click on the title bar.
xprop extract sample is giving:
program specified resize increment: 6 by 13

For those maximized windows the patch is just ignoring the resize increment.
Seems the same issue happened on that project
https://github.com/paperwm/PaperWM/issues/106
2023-02-16 01:21:25 +00:00
David Maciejak
d7d38aa443 Info Panel: display more OS details
Rely on old utsname and os-release (http://0pointer.de/blog/projects/os-release) when available
to display more underlying OS details in the Info panel.
The idea is when someone creates a bug entry we can request them to copy/paste that screen
to give more info about the context that could help us debug the issue.
For example, on my current system it's displaying:
"Running on: Ubuntu 22.10 (x86_64)"
2023-02-15 09:37:06 +00:00
David Maciejak
a6209cc89b Set a better exit panel message
Replace the exit window manager generic message with Window Maker term instead.
2023-02-15 09:37:06 +00:00
David Maciejak
45ab72a78a InfoPanel: fix out of display text
When debug is enabled, the memory allocated details is supposed to display the free chunks
but as the text length is too long it's getting out of the display area.
This patch is increasing the window width to handle such case.
2023-02-13 13:10:14 +00:00
David Maciejak
437b76812d Info Panel: mallinfo is deprecated use mallinfo2 instead
Replacing mallinfo with mallinfo2.

The fields of the mallinfo structure that is returned by the
older mallinfo() function are typed as int.  However, because
some internal bookkeeping values may be of type long, the
reported values may wrap around zero and thus be inaccurate.
2023-02-11 10:35:23 +00:00
David Maciejak
e3ee459a78 Info Panel: use system time to get the current year
Use the system date to get the current year to insert inside the copyright line.
So no need to update that string anymore.
2023-02-11 10:33:22 +00:00