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

1700 Commits

Author SHA1 Message Date
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
David Maciejak
812930b7cd Fix icon.c unused variable compiler warning
Just to please the compiler as it's reporting:
icon.c: In function 'get_icon_cache_path':
icon.c:425:13: warning: unused variable 'len' [-Wunused-variable]
2023-02-11 10:30:02 +00:00
David Maciejak
2a14004fc3 SwitchPanel: make sure WMRetainColor and WMReleaseColor calls are even
The number of calls to WMRetainColor for a color in use should the same as the number of calls to WMReleaseColor
to free that color. In case of discrepancy, random crashes can happen and memory is not freed properly.
To debug that issue I checked the retained colors when the switchpanel is opened and then checked if those colors are properly released once the panel is closed.

This patch fixes the issue mentioned at https://github.com/window-maker/wmaker/issues/22
2023-02-10 11:24:55 +00:00
Torrance, Douglas
ddacfa5d63 Include screen.h in dialog.h for definition of WScreen 2023-01-26 10:15:58 +00:00
Torrance, Douglas
0718297e9a Correctly draw window snapping hints on multi-head systems
Previously, the transparent frames that were drawn prior to snapping a
window assumed that there was only one head, i.e., that the new
position and dimensions of the window would be based on the dimensions
of the entire screen.

However, this is not the case on multi-head systems, and so we now
base the transparent frame's position and dimensions on the current
head of the window.

We also refactor the code so that the new dimensions are computed in
the switch statement and finish with one final call to
drawTransparentFrame.
2023-01-20 11:54:07 +00:00
Torrance, Douglas
9cc16182d3 Use dock to determine whether drawer is on right side when swapping
Previously, we assumed that it always switched from left to right or
vice versa when calling swapDrawer.  However, now we may also call
swapDrawer when changing the value of "KeepDockOnPrimaryHead", which
wouldn't actually switch which side of the screen it's on.

So instead, we determine which side of the screen it should be on
based on the dock.
2023-01-20 10:34:36 +00:00
Torrance, Douglas
f6165d6e80 Use actual x position of dock when saving state
Previously, we either saved it as 0 or -ICON_SIZE, and then adjusted
it depending on the screen width when restoring the state.

But since the introduction of the "KeepDockOnPrimaryHead" option, the
state-restoring code has changed so that the dock will go on the left if the
x-coordinate of the position in WMState is to the left of the midpoint
of the screen and on the right otherwise.  But previously (unless the
user manually set the value in WMState) this would always send the
dock to the left, even if it had been on the right, since the x-coordinate
automatically saved to WMState in this case was negative.

We simplify things by saving the actual x position of the dock to WMState.
2023-01-20 10:34:36 +00:00
Torrance, Douglas
10c36d244e Use dock's position to determine position of dock menu
Previously, we assumed that if the dock was on the right, then the
menu should be on the far right of the entire screen, but this is no
longer the case with "KeepDockOnPrimaryHead" set to "YES".
2023-01-20 10:34:36 +00:00
Torrance, Douglas
515eb652c7 Update the dock position when "KeepDockOnPrimaryHead" is changed 2023-01-18 12:18:03 +00:00
Torrance, Douglas
8ed92efa3c Rename swapDock to wDockSwap and add to dock.h
We'll be calling it from defaults.c.
2023-01-18 12:18:03 +00:00
Torrance, Douglas
48d4820dee Support "KeepDockOnPrimaryHead" when restoring state
We use the new helper function getDockXPosition to determine where
to put the dock.  If WMState gives an x-coordinate less than the
center of the screen, we put it on the left, and otherwise we put it
on the right.
2023-01-18 12:18:03 +00:00
Torrance, Douglas
d4f5f3ec7f Support "KeepDockOnPrimaryHead" when initially creating dock
We use the new "getDockXPosition" helper function to find the x
position of the main icon, whose position is used in "wDockCreate" to
get the position of the entire dock.

Previously, "KeepDockOnPrimaryHead" was only taken into account
when *moving* the dock and not when creating it.
2023-01-18 12:18:03 +00:00
Torrance, Douglas
83f7fa43ce Add helper function for computing the dock's x position
Avoid code duplication since we'll need to make this computation in
several places.
2023-01-18 12:18:03 +00:00
Torrance, Douglas
55a816bdbc Keep dock on primary head if KeepDockOnPrimaryHead is YES
This implements a feature request [1] to allow the possibility of
keeping the dock on the primary head on a multi-head system.

In particular, if the new KeepDockOnPrimaryHead option is set to YES,
the dock will either be on the left- or right-hand side of the primary
screen.  If it is NO, then we get the current behavior, i.e., the dock
will either be on the left-hand side of the leftmost head or the
right-hand side of the rightmost head.

[1] https://github.com/window-maker/wmaker/issues/24

Closes: #24
2023-01-15 00:18:34 +00:00
Torrance, Douglas
326a67e18f Add new "KeepDockOnPrimaryHead" option
Once implemented, this will keep the dock on the primary head (when
there are multiple heads) when YES.  The default value is NO, the
current behavior, i.e., treat all monitors together as one large screen.
2023-01-15 00:18:34 +00:00
Petre Rodan
c089c6aea4 Fix segfault on right-click sweep of menu
bug description: after menu is displayed I get a segfault when trying to hover over the last menu
entry. it looks like under some circumstances menu->entries[] gets accessed past the last valid
value (off by one).

how to reproduce:
right-click desktop to show menu and keep right mouse button pressed
sweep mouse up-down the menu a few times - it crashes all the time between 1-5 sweeps

this commit fixes the unwanted behaviour, in active use since december 2021.
2023-01-06 12:47:22 +00:00
John D Pell
24f5b32469 Configure: Rename setting DEFSDATADIR to PKGCONFDIR
Directory /etc/WindowMaker is for global defaults configuration, it is not
a "data" folder which is $PREFIX/share/WindowMaker.

The name change make it more consistent with other names.
2021-08-10 09:42:43 +01:00
John D Pell
85169642ca WMaker: Store history in $XDG_STATE_HOME if defined
The FreeDesktop XDG standard suggests storing history in the directory
pointed by $XDG_STATE_HOME; so if we find it is defined we prefer to use
it over the default path. If undefined, keep the old behaviour.

This may introduce a loss of history for users that had some in the legacy
place but have the variable, we consider this very unlikely to be a problem
but if user complains we can suggest them to move the legacy file over the
empty new one.
2021-08-10 09:42:43 +01:00
John D Pell
bd38778bef Use wuserdatapath() everytime it is applicable
Replace calls to wusergnusteppath() which just append "/Library" by calls
to wuserdatapath().
Take opportunity to replace hardcoded "/WindowMaker" directories with
the existing PACKAGE_TARNAME macro (which comes from autotools).

The choice of 'TARNAME' is because it meant to be used in filename, thus
less likely to have problematic characters than PACKAGE_NAME (meant for
display purpose) and PACKAGE which is there for historical reason.
2021-08-10 09:42:43 +01:00
John D Pell
03ec24502d WMaker: Fix logical-not operator in framewin.c
As reported by clang, (!wPreferences.new_style == TS_NEW) inverts the
"wPreferences.new_style" and not the whole expression. Use the appropriate
comparison operator to avoid misunderstanding.
2021-08-10 09:42:43 +01:00
John D Pell
735651df55 WMaker: Use wdefaultspathfordomain() to get path for Defaults directory
Instead of constructing path to user's defaults directory with hard-coded
names, just query wdefaultspathfordomain with a blank domain: this returns
the equivalent of "~/GNUstep/Defaults/", yet avoiding problems related to
duplicating strings.
2021-08-10 09:42:43 +01:00
Christophe CURIS
ae78e88eef Repair compilation when Pango support is enabled
It seems there have been changes in the way Pango's header files are
installed in recent versions, probably to allow having multiple versions
together on a system.

Because one public header from WINGs has to include Pango's header, we must
include the search path provided by Pango into our WINGs search path that
are returned by pkg-config (the .pc file).

They are then also added to WindowMaker and WPrefs which use the header but
can't rely on the path from the .pc file which has not been installed yet.

Reported-by: Carlos R. Mafra <crmafra@gmail.com>
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-29 23:55:10 +01:00
Christophe CURIS
0e274dc979 WRaster: Fix incorrect use of macro USE_XSHM in installed header
The header "wraster.h" needs different behaviour depending on whether the
support for X Shared Memory extension was enabled or not; but the related
macro USE_XSHM is defined by WindowMaker's configure. After this header
have been installed, the macro is no more useable.

This patch makes the "wraster.h" a generated file, so it will be different
depending on USE_XSHM, but will not make use of the macro itself.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:50:43 +01:00
Christophe CURIS
fbec3a728f wmaker: Do not allocate memory for a temporary string for the Window Shortcut menu
When creating the list of possible shortcut for windows to populate the
window menu, a temporary buffer was allocated to hold that string.

As this allocation participates to memory fragmentation, this patch makes
use of storage on the stack instead which is also faster.

Took opportunity to include the shortcut number (%i) in the string to be
translated, because it is unlikely that adding that number at the end of
the string is right in all languages. Updated french translation because
it is the only one I am confident with.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
e828e1c074 Fix use-after-free error in wIconStore reported by Coverity
The function always returns the filename where the icon have been saved,
but in the case where the save operation failed we would free the memory
for that file name, yet still return this pointer like if it were valid.

Took opportunity to remove redundant free(path) which is done a couple
lines later, because redundancy is a source of problem for code
maintenance.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
97a9300aa4 Fix memory leak reported by Coverity
As reported in CID #331577, we re-use the variable 'tmp' without freeing
the previously allocated pointer.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
8aecba27d1 Fix usage of float constant reported by gcc
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Christophe CURIS
fc63d72032 WINGs: Fix incorrect use of macro USE_PANGO in installed header
The header "WINGsP.h" needs different behaviour depending on whether the
support for Pango was enabled or not. But the related macro USE_PANGO is
defined by WindowMaker's configure, and after this header have been
installed the macro is no more valid.

This patch makes the "WINGsP.h" a generated file, so it will be different
depending on USE_PANGO, but will not make use of the macro itself.

As a side effect of being now generated, the include paths in the makefile
have been updated to include build-dir too, because for users doing an
out-of-tree build the generated file (that is used during compilation) is
placed in the build-dir.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
2021-05-18 17:49:17 +01:00
Xander
eb2a9d97a2 Make dock dots scalable
This patch makes the three dots in the dock change their size when bigger icon size is used.
The logic here is such that the dots are scaled only when a certain icon size is reached;
for instance, the dots will remain unchanged if icon size is less than 128x128 px, and will
be twice as big if it's set to a value from 128x128 to 184x184 px. The get_dot_mult() func
calculates and returns the scale multiplier. In the draw_dot() func, XDrawLine() and
XDrawPoint() were replaced with XFillRectangle() because those funcs do not allow their
result to be scalable. This patch does not require additional icon size values (those bigger
than 96x96 px) to exist, but makes no use without them.
2021-05-07 18:03:19 +01: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
Diedrich Vorberg
a98680cd14 Patch for GetCommandForPid() in osdep_darwin.c
the function mentioned above caused segfaults on MacOS. The attached patch
seems to solve that.

Details: The functions provides an array of string pointers (the argument
vector) pointing to a buffer allocated and referred to by a static local
variable `args`. This buffer was used on each subsequent call. For one
thing this would overwrite old values and for another this caused segfaults.

My new implementation allocates a buffer for the argument vector plus the
actual string data on each call. The caller will wfree() the buffer, but
until then has available an independent copy of the strings.
2020-10-19 20:38:29 +01:00
Alexander Komarov
7d423a3a0f Added Expert option: "Close rootmenu when mouse (left or right) is clicked outside focus.
Common WindowMaker's rootmenu behavior if press right mouse button open menu and close only with same button.
It's uncomfortably, it patch  allows close menu by left or right is clicked outside focus.
Changed func "static WMenu*configureMenu(WScreen *scr, WMPropList *definition)" to non-static forglobal use.
Added new  OPTION_WMAKER for this Expert-option. Changed event.c: for correct work should use initialization
func configureMenu afterwMenuDestroy (this is a feature of the event implementation XEvent).
2020-09-13 16:56:09 +01:00
Alexander Komarov
6e2075f3df Double click on titlebar maximize a window to fullscreen 2020-08-10 12:15:01 +01:00
Doug Torrance
44bc9cc264 Fix various abs() issues.
The abs() function should take an int as argument, but there were
several instances in the code where it was taking an unsigned int or a
double.  In these case, we took one of the following approaches:

* If the argument was a double, use fabs() instead.
* If the argument was unsigned and was certainly going to be positive
  (i.e,. no subtraction), then drop abs() altogether.
* If the argument was unsigned as result of adding or subtracting signed
  and unsigned ints, then we cast all the unsigned ints to signed ints.
2020-04-18 19:49:26 +01: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
Doug Torrance
a17d131da3 Remove apostrophes from instances of possessive "its".
I noticed one instance of this while looking at the code the other day,
and after a quick grep, realized it happened a *lot*!  One of the many
frustrating things about the English language is that we use apostrophes
to make pretty much everything possessive *except* the pronoun "it".
In that case, we use "its".  "It's" is reserved for the contraction
meaning "it is" or "it has".
2020-04-09 09:05:50 +01:00
David Maciejak
909deea70c bump copyright year in Info Panel
bump copyright year in Info Panel
2020-03-25 10:08:17 +00:00
David Maciejak
984a992d0e Fix typo
Renamed isPointNearBoder() function
2020-03-25 10:05:02 +00:00
Jeremy Sowden
d9bc96e497 strncpy's third argument should be the length of the dest buffer, not the source. 2019-08-06 11:04:05 +01:00
Jeremy Sowden
a7baed6cf7 Fixed expression checking whether flag is set. 2019-08-06 11:04:05 +01:00
Jeremy Sowden
a12f0d453a Fixed buffer size. 2019-08-06 11:04:05 +01:00
Jeremy Sowden
41193bdacd Fixed function-pointer compatibility. 2019-08-06 11:04:05 +01:00
Jeremy Sowden
a7f8e990db Added explicit fall-through comments to pacify GCC. 2019-08-06 11:04:05 +01:00
Jeremy Sowden
b59273f199 Added missing function declaration. 2019-08-06 11:04:05 +01:00