1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-07-09 20:26:37 +02:00

Compare commits

..

104 Commits

Author SHA1 Message Date
Carlos R. Mafra 93b049356f Revert "WUtil: Be more strict about base directory for wmkdirhier()"
This reverts commit a0b283a60f,
as it breaks saving the history in ~GNUstep/.AppInfo/WindowMaker/History
by restricting modifications to either ~GNUstep/Defaults or ~GNUstep/Library.

Thanks to Paul Selig for reporting this issue.
2023-08-21 22:22:32 +01:00
Carlos R. Mafra 75f353bef4 Update .gitignore
Since

fc63d72032 (WINGs: Fix incorrect use of macro USE_PANGO in installed header)

and

0e274dc979 (WRaster: Fix incorrect use of macro USE_XSHM in installed header)

the files wrlib/wraster.h and WINGs/WINGs/WINGsP.h are generated by the compilation,
so add them to .gitignore
2023-08-21 21:35:30 +01:00
Christophe CURIS 2264ed9de6 Fix calculation of version number in the library mapfiles
As reported by Andreas Metzler, the latest API change in lib WRaster caused
a compatibility issue because the internal version number was increased.

To correctly handle this situation, this patch does 2 things:
 - do not discard the 2 last number in the "c:r:a" version, because we need them;
 - when calculating the version for the mapfile, use the formula that is
suggested in libtool's documentation.

The purpose of the formula is that when API is changed, if a new function
is added then the version is not incremented to reflect that we are still
compatible with current binaries, it will be incremented only when there
is a break in compatibility.
2023-08-12 21:53:52 +01:00
Carlos R. Mafra d0aa2cefcd Window Maker 0.96.0 2023-08-05 08:46:23 +01:00
David Maciejak a52d13c8b8 Fix autoconf obsolete macros
autogen.sh is reporting some warnings as below

./autogen.sh 2>&1 |grep "obsolete"
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:115: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:115: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:134: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:134: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:135: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:135: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:146: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:146: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:146: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:146: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:373: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:373: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:458: warning: The macro `AC_HEADER_TIME' is obsolete.
configure.ac:681: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:807: warning: The macro `AC_TRY_LINK' is obsolete.

As the minimum autoconf version required is v2.69,
we need to make sure to update obsolete macros as described at
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html
2023-04-14 23:45:00 +01:00
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 3344f2b040 NEWS: Hot corners feature description
Add an entry in the NEWS to describe the Hot Corners feature.
2023-03-26 10:35:33 +01:00
David Maciejak ecef2b2890 WPrefs: Hot corner preferences
Add a new "Hot Corner Shortcut Preferences" section to WPrefs
to configure the Hot Corners feature.
2023-03-26 10:35:33 +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 91e7f37074 WPrefs: fix keyboard shortcut sorting order
That patch is fixing some Actions entries that are not sorted properly.
One is using some upper/lower cases.
And the other one, is displaying numbers while alphabetic sorting is not
working properly on numbers. For example:
Shortcut for window 1
Shortcut for window 10
Shortcut for window 2
...
2023-03-21 15:20:19 +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 0a55facac0 wmiv: align version with wm
Use wm version for the wmiv util.
2023-03-13 15:32:19 +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 0526ddfc54 WINGs: Make the Extras examples to compile
There is a table view example which is not compiling cause
of a missing lib, also fixed some warnings.
2023-03-12 09:44:10 +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 038a3588d6 WINGs: W_KeycodeToKeysym remove unnecessary if test
min_kc value is always -1 at that point in the code, so need to test it
as it's always true.
2023-03-09 15:05:58 +00:00
David Maciejak 0b2fd6a8c8 WINGs: handle fixed size windows
According to the EWMH specs, windows can indicate that they are
non-resizable by setting minheight = maxheight and minwidth = maxwidth
in the ICCCM WM_NORMAL_HINTS property. That should be for example
the case for WPrefs app which is not resizable.
Window Maker currently is overwriting that flag in src/window.c for
apps that are exposing GNUstepHints instead.
This patch is making sure the apps created with WINGs is removing
the WMResizableWindowMask to hide the resizebar.
2023-03-09 15:05:58 +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 ac6d284269 NEWS: add entry for libXRes support 2023-03-09 15:05:58 +00:00
David Maciejak 83b94b1616 Update news and changelog files 2023-03-07 17:31:07 +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 6c69dc32a0 WINGs: Make the test examples to compile
Those examples are optional but currently cannot compile properly.
The compiler is reporting some unused variables and missing header file.
2023-03-07 17:24:41 +00:00
David Maciejak 3b1c00ad06 WINGs: comment out wtext unused NOTIFY macro
The compiler is reporting the warning below
wtext.c:171: warning: macro "NOTIFY" is not used [-Wunused-macros]

That macro is only used once within that C file, code which is commented
out already.
2023-03-06 20:16:07 +00:00
David Maciejak dd6fe27858 WPrefs: convert workspacename.xpm X11 color name to hex
On window maker built without libxpm, a simple build-in xpm support is used.
That component does not support X11 color name thus when trying to load
that image we are getting a file corrupted error.
Colors manually converted using ref at
https://www.ehdp.com/methods/x11-colors/x11-colors-rgb-values-05.htm
2023-03-05 00:16:44 +00:00
David Maciejak 45f3f5d0ae Util: fix wmgenmenu memory leak and help msg
Memory allocated from wstrconcat() calls are not freed properly.
Help msg is reporting the wrong directory where to install WMRootMenu.
2023-03-05 00:16:44 +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 80e8dd43f7 Convert tile.xpm X11 color name to hex
On window maker built without libxpm, a simple build-in xpm support is used.
That component does not support X11 color name thus when trying to load
that image we are getting a file corrupted error.
Colors manually converted using ref at
https://www.ehdp.com/methods/x11-colors/x11-colors-rgb-values-05.htm
2023-03-05 00:16:44 +00:00
David Maciejak a383074c99 WPrefs: sort alphabetically the key shortcut actions and expert options
There are too many entries now in key shortcut actions and expert options,
better to sort them dynamically.
2023-03-03 14:15:19 +00:00
David Maciejak 52a623729d Coverity: fix WRaster convert uninitialized scalar variable 2023-03-03 14:15:19 +00:00
David Maciejak d4ee17f0b5 Coverity: fix WPrefs workspace negative array index read 2023-03-03 14:15:19 +00:00
David Maciejak 7475bc5d0a Coverity: fix util wmsetbg resource leak 2023-03-03 14:15:19 +00:00
David Maciejak 35f87b5592 WRaster: add new file references for translation
This patch is adding the references for the two newly added files
save_jpeg.c and save_png.c for translation (even if those new
files are not adding any new strings to be translated).
2023-03-03 09:51:24 +00:00
David Maciejak 5e37d13eb6 Coverity: fix wmgenmenu resource leak 2023-03-02 17:04:48 +00:00
David Maciejak 4b1aee3e79 Coverity: fix wmmenugen resource leak 2023-03-02 17:04:48 +00:00
David Maciejak 0ccc5bbde7 Coverity: fix wmspec dereference after null check 2023-03-02 17:04:48 +00:00
David Maciejak 59a686d22e Coverity: fix WPrefs appearance negative array index read 2023-03-02 17:04:48 +00:00
David Maciejak 26d46f6e16 Coverity: fix WPrefs menu negative array index read 2023-03-02 17:04:48 +00:00
David Maciejak ceafbf0629 Coverity: fix WPrefs mousesettings menu negative array index read 2023-03-02 17:04:48 +00:00
David Maciejak cf178d011b Coverity: fix WPrefs preference negative array index read 2023-03-02 17:04:48 +00:00
David Maciejak 682c2767c2 Coverity: fix WPrefs texturepanel negative array index read 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 e9717ed719 Coverity: fix WPrefs appearance time of check time of use 2023-03-02 17:04:48 +00:00
David Maciejak 9e59d19507 Coverity: fix WPrefs editmenu uninitialized scalar variables 2023-03-02 17:04:48 +00:00
David Maciejak 94f98dcd25 Coverity: fix WRaster convert uninitialized scalar variable 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 c7f7c10d7c Coverity: fix wmsetbg string not null terminated 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 e2ecfbfd54 Coverity: fix wcolorpanel uninitialized scalar value 2023-03-02 17:04:48 +00:00
David Maciejak a8ec32d41a Coverity: fix setstyle resource leak 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 77df89396c Coverity: fix menuparser_macro uninitialized pointer read 2023-03-02 17:04:48 +00:00
David Maciejak c8883fdbb0 WRaster: add functions to save image on disk
This patch adds the RSaveTitledImage() function to the WRaster lib
to be able to save file on disk either as a PNG or a JPEG file.
Those two formats depends on optional external libs.
The function can take an optional title/comment which will
be save inside the file.

The WRaster lib and header versions are bumped.
2023-03-02 10:23:47 +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 76fa91d21e Coverity: fix wmiv resource leak 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 7b317a5fba wmiv: use W_KeycodeToKeysym instead of XkbKeycodeToKeysym
This patch replaces XkbKeycodeToKeysym in wmiv by our
own function W_KeycodeToKeysym.
2023-02-28 03:33:21 +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 bc56db0776 WPrefs: use W_KeycodeToKeysym instead of XkbKeycodeToKeysym
This patch replaces XKeycodeToKeysym and XkbKeycodeToKeysym
in WPrefs by our own function W_KeycodeToKeysym.
2023-02-27 23:05:27 +00:00
David Maciejak 15d06ff064 WINGs: Add W_KeycodeToKeysym to replace XKeycodeToKeysym/XkbKeycodeToKeysym calls
XKeycodeToKeysym was deprecated some time ago and we replaced
those function calls to XkbKeycodeToKeysym.
Usage of XkbKeycodeToKeysym is not the best as it appears
the XKEYBOARD can be disabled via xorg.conf (at least on Linux).
So just replacing XKeycodeToKeysym() with XkbKeycodeToKeysym()
could cause run-time errors on top of the compilation warning
we may have.
Better fix is to address the problem without introducing a
dependency on XKEYBOARD. W_KeycodeToKeysym is the equivalent
code for XKeycodeToKeysym/XkbKeycodeToKeysym using
XGetKeyboardMapping instead.

As a new function is added to the library WINGs library version
is bumped.
2023-02-27 22:37:44 +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 d1a7db8aea Compile by default with POSIX 7 revision
Compile by default with POSIX-2008 standard for Linux and FreeBSD.
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 a9e336256b Doc: add disable-res description 2023-02-26 11:02:46 +00:00
David Maciejak e9b20b51e9 WPrefs: check if captured keyboard shortcut is not in use
Make sure the captured keyboard shortcut is not already in use
by another action, if it's the case an error popup is shown and
the key is not kept.
2023-02-25 13:31:42 +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 14d1b8197a WRaster: Avoid undefined setjmp() behavior with libjpeg
Fix compiler warning:
load_jpeg.c: In function 'RLoadJPEG':
load_jpeg.c:100:17: warning: variable 'image' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]

As it was not working to only set the RImage *image as volatile,
I had to refactor the code by following the example from
https://github.com/libjpeg-turbo/libjpeg-turbo/commit/410c028f3396d1fa9bcc72608079ff4d3d76b03e#diff-e7cb632359a2be17c1008b50f9ec85691cd5d66834d5fe8f63ef65ceb06682ee
2023-02-19 10:10:41 +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 532acdc443 WRaster: Avoid types deprecated with libtiff 4.3
This patch is fixing compiler warnings like:

load_tiff.c:42:9: warning: 'uint16' is deprecated [-Wdeprecated-declarations]
load_tiff.c:43:9: warning: 'uint32' is deprecated [-Wdeprecated-declarations]

As starting from libtiff 4.3, released in April 2021, types were moved
from uint16 to uint16_t and uint32 to uint32_t respectively.

See https://libtiff.gitlab.io/libtiff/releases/v4.3.0.html
2023-02-15 11:24:09 +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 01bd523cee WINGs: allow keypad enter key to validate button
This patch allows the keypad enter key to validate the button click action.
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 d70b546f2e Fix wrong XKeycodeToKeysym index value
XKeycodeToKeysym was deprecated some time ago and wmaker code was patched to use the definition from XKBlib instead.
(https://repo.or.cz/wmaker-crm.git?a=commit;h=0382dd5dd7ecae2112a0c6366eaf9e6ab68ad354)

Before being deprecated,  XKeycodeToKeysym was prototyped at X11/Xlib.h as
KeySym XKeycodeToKeysym(display, keycode, index)

Now it's available in X11/XKBlib.h as
KeySym XkbKeycodeToKeysym(display, keycode, group, level)

Basically level now which is the 4th parameter is our old index variable (3rd parameter).

On systems which don't have xkb supported the value set for index is wrong.
As seen in old patch at https://repo.or.cz/wmaker-crm.git/blobdiff/139f912e618870cc7fd908099f203450547eb658..43c3526d2120712f72579398b73ef92283d9078b:/WPrefs.app/MouseSettings.c
we should pass the l value to old XKeycodeToKeysym function and not the 0 value which is used for the group in the new XkbKeycodeToKeysym definition.
2023-02-11 10:30:52 +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
David Maciejak 04e9f33437 WINGs: Fix incorrect findCloseColor exact flag value
In case the color cannot be allocated exactly by createRGBAColor function,
the findCloseColor function is used as a failover function to find a color close to the requested color.
By definition that color is then not exact.
createRGBAColor exact flag should be 1 while findCloseColor exact flag should be 0
2023-02-10 11:24:44 +00:00
David Maciejak 150816c687 Fix missing linefeed on the error message
Just to display the error message properly in case there is no display.
2023-02-08 00:14:48 +00:00
124 changed files with 2760 additions and 612 deletions
+2
View File
@@ -30,6 +30,8 @@ m4/ltversion.m4
m4/lt~obsolete.m4
src/wconfig.h
WINGs/WINGs/WINGsP.h
wrlib/wraster.h
# These files are generated by scripts
INSTALL-WMAKER
+47 -1
View File
@@ -1,7 +1,52 @@
NEWS for veteran Window Maker users
-----------------------------------
-- 0.95.10
-- 0.96.0
Hot Corners feature
--------------------------
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.
Hot Corners feature is disabled by default.
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.
Screenshot capture feature
--------------------------
In WPrefs "Keyboard Shortcut Preferences" tab, three new actions can
be configured: "Capture a portion of the screen", "Capture a window",
"Capture the entire screen". The file is saved in
~/GNUstep/Library/WindowMaker/Screenshots directory under a filename
format "screenshot_%Y-%m-%d_at_%H:%M:%S" followed by the extension.
Which can be png or jpg based on WRaster dependencies.
libXRes is now an optional dependency
-------------------------------------
XRes the resource extension for the X protocol is used to find the
underlying processes (and PIDs) responsible for displaying the windows.
Support for _NET_WM_FULLSCREEN_MONITORS hint
--------------------------------------------
That hint allows applications that support it to be set as fullscreen on multiple heads.
It depends on Xinerama extension support.
Keep dock on primary head
-------------------------
@@ -10,6 +55,7 @@ To keep the dock on the primary head in a multi-head setup, set the option
"KeepDockOnPrimaryHead" in ~/GNUstep/Defaults/WindowMaker to "YES" or click
"Keep dock on primary head" under the WPrefs "Expert User Preferences" tab.
-- 0.95.9
Configurable SwitchPanel
+6
View File
@@ -1,3 +1,9 @@
Changes since wmaker 0.96.0:
............................
- added W_KeycodeToKeysym to replace XKeycodeToKeysym/XkbKeycodeToKeysym calls
Changes since wmaker 0.92.0:
............................
+3 -3
View File
@@ -10,7 +10,7 @@ include_HEADERS = wtableview.h wtabledelegates.h
lib_LTLIBRARIES = libExtraWINGs.la
noinst_PROGRAMS = test
noinst_PROGRAMS = tableview
EXTRA_DIST =
@@ -25,6 +25,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
LDADD= $(top_builddir)/WINGs/libWINGs.la $(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/WINGs/libWUtil.la \
@XFT_LIBS@ @INTLIBS@
@XFT_LIBS@ @INTLIBS@ @XLIBS@
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)
tableview_LDADD = wtableview.o wtabledelegates.o $(LDADD)
@@ -19,13 +19,18 @@ static char *options[] = {
int numberOfRows(WMTableViewDelegate * self, WMTableView * table)
{
(void) self;
(void) table;
return 20;
}
void *valueForCell(WMTableViewDelegate * self, WMTableColumn * column, int row)
{
(void) self;
/*WMTableView *table = (WMTableView*)WMGetTableColumnTableView(column); */
int i;
if (col1[0] == 0) {
for (i = 0; i < 20; i++) {
char buf[128];
@@ -44,6 +49,8 @@ void *valueForCell(WMTableViewDelegate * self, WMTableColumn * column, int row)
void setValueForCell(WMTableViewDelegate * self, WMTableColumn * column, int row, void *data)
{
(void) self;
if ((uintptr_t)WMGetTableColumnId(column) == 1)
col1[row] = data;
else
@@ -59,6 +66,7 @@ static WMTableViewDelegate delegate = {
void clickedTable(WMWidget * w, void *self)
{
(void) w;
int row = WMGetTableViewClickedRow((WMTableView *) self);
WMEditTableViewRow(self, row);
+14 -8
View File
@@ -2,6 +2,8 @@
#include <WINGs/WINGsP.h>
#include <X11/cursorfont.h>
#include <stdint.h>
#include <math.h>
#include <float.h>
#include "wtableview.h"
@@ -274,7 +276,7 @@ static void adjustScrollers(WMTableView * table)
prop = 1.0;
} else {
oprop = WMGetScrollerKnobProportion(table->hscroll);
if (oprop == 0.0)
if (fabs(oprop) <= DBL_EPSILON)
oprop = 1.0;
ovalue = WMGetScrollerValue(table->hscroll);
@@ -290,7 +292,7 @@ static void adjustScrollers(WMTableView * table)
prop = 1.0;
} else {
oprop = WMGetScrollerKnobProportion(table->vscroll);
if (oprop == 0.0)
if (fabs(oprop) <= DBL_EPSILON)
oprop = 1.0;
ovalue = WMGetScrollerValue(table->vscroll);
@@ -332,7 +334,7 @@ static void doScroll(WMWidget * self, void *data)
case WSIncrementWheel:
case WSIncrementLine:
value += (float)table->rowHeight / size;
if (value > 1.0)
if (value > (float)1.0)
value = 1.0;
WMSetScrollerParameters(self, value, WMGetScrollerKnobProportion(self));
repaintTable(table);
@@ -344,7 +346,7 @@ static void doScroll(WMWidget * self, void *data)
case WSDecrementPage:
value -= vpsize / size;
if (value < 0.0)
if (value < (float)0.0)
value = 0.0;
WMSetScrollerParameters(self, value, WMGetScrollerKnobProportion(self));
repaintTable(table);
@@ -352,7 +354,7 @@ static void doScroll(WMWidget * self, void *data)
case WSIncrementPage:
value += vpsize / size;
if (value > 1.0)
if (value > (float)1.0)
value = 1.0;
WMSetScrollerParameters(self, value, WMGetScrollerKnobProportion(self));
repaintTable(table);
@@ -398,6 +400,7 @@ static void doScroll(WMWidget * self, void *data)
static void splitterHandler(XEvent * event, void *data)
{
(void) event;
WMTableColumn *column = (WMTableColumn *) data;
WMTableView *table = column->table;
int done = 0;
@@ -451,6 +454,8 @@ static void splitterHandler(XEvent * event, void *data)
static void realizeTable(void *data, WMNotification * notif)
{
(void) notif;
repaintTable(data);
}
@@ -790,7 +795,6 @@ void WMSetTableViewRowHeight(WMTableView * table, int height)
void WMScrollTableViewRowToVisible(WMTableView * table, int row)
{
WMScroller *scroller;
WMRange range;
WMRect rect;
int newY, tmp;
@@ -798,7 +802,6 @@ void WMScrollTableViewRowToVisible(WMTableView * table, int row)
rect = getVisibleRect(table);
range = rowsInRect(table, rect);
scroller = table->vscroll;
if (row < range.position) {
newY = row * table->rowHeight - rect.size.height / 2;
@@ -1157,6 +1160,8 @@ static void handleEvents(XEvent * event, void *data)
static void handleResize(W_ViewDelegate * self, WMView * view)
{
(void) self;
reorganizeInterior(view->self);
}
@@ -1167,7 +1172,8 @@ static void reorganizeInterior(WMTableView * table)
WMSize size = getTotalSize(table);
WMView *view = table->view;
int vw, vh;
int hsThickness, vsThickness;
int hsThickness = 0;
int vsThickness = 0;
if (table->vscroll)
vsThickness = WMWidgetWidth(table->vscroll);
+3 -1
View File
@@ -1,7 +1,9 @@
** API and ABI modifications since wmaker 0.92.0
** API and ABI modifications since wmaker 0.96.0
----------------------------------------------------
** libWINGs **
<WINGsP.h>
W_KeycodeToKeysym ADDED
struct W_DragDestinationInfo: new members added SIZE CHANGE
<WINGs.h>
+2 -1
View File
@@ -17,4 +17,5 @@ wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la
EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
AM_CPPFLAGS = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFT_CFLAGS@ @HEADER_SEARCH_PATH@
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFT_CFLAGS@ @HEADER_SEARCH_PATH@ \
@PANGO_CFLAGS@
+1
View File
@@ -64,6 +64,7 @@ static W_Class myWidgetClass = 0;
*/
W_Class InitMyWidget(WMScreen * scr)
{
(void)scr;
/* register our widget with WINGs and get our widget class ID */
if (!myWidgetClass) {
myWidgetClass = W_RegisterUserWidget();
+1 -1
View File
@@ -4,7 +4,7 @@
#include "mywidget.h"
void wAbort()
_Noreturn void wAbort(void)
{
exit(1);
}
+4 -7
View File
@@ -19,14 +19,14 @@
#include "logo.xpm"
void wAbort()
_Noreturn void wAbort(void)
{
exit(1);
}
char *ProgName;
void usage(void)
_Noreturn void usage(void)
{
fprintf(stderr,
"usage:\n"
@@ -53,13 +53,10 @@ int main(int argc, char **argv)
WMPixmap *pixmap;
WMOpenPanel *oPanel;
WMSavePanel *sPanel;
/* RImage *image; */
char *title = NULL;
char *initial = "/";
int ch;
int panelType = OPEN_PANEL_TYPE;
extern char *optarg;
extern int optind;
if (!dpy) {
puts("could not open display");
@@ -96,14 +93,14 @@ int main(int argc, char **argv)
if (panelType == SAVE_PANEL_TYPE) {
sPanel = WMGetSavePanel(scr);
if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial,
/*title */ NULL, NULL) == True)
title, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(sPanel));
else
printf("\n");
} else {
oPanel = WMGetOpenPanel(scr);
if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial,
/*title */ NULL, NULL) == True)
title, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(oPanel));
else
printf("\n");
+3 -5
View File
@@ -11,14 +11,14 @@
#include "logo.xpm"
void wAbort()
_Noreturn void wAbort(void)
{
exit(1);
exit(1);
}
char *ProgName;
void usage(void)
_Noreturn void usage(void)
{
fprintf(stderr,
"usage:\n"
@@ -45,8 +45,6 @@ int main(int argc, char **argv)
char *initial = NULL;
char *result = NULL;
int ch;
extern char *optarg;
extern int optind;
WMInitializeApplication("WMQuery", &argc, argv);
+13 -2
View File
@@ -14,7 +14,7 @@
* This will be called when the application will be terminated because
* of a fatal error (only for memory allocation failures ATM).
*/
void wAbort()
_Noreturn void wAbort(void)
{
exit(1);
}
@@ -25,6 +25,7 @@ int windowCount = 0;
void closeAction(WMWidget * self, void *data)
{
(void)data;
WMDestroyWidget(self);
windowCount--;
printf("window closed, window count = %d\n", windowCount);
@@ -165,10 +166,13 @@ void testBox(WMScreen * scr)
static void singleClick(WMWidget * self, void *data)
{
(void)self;
(void)data;
}
static void doubleClick(WMWidget * self, void *data)
{
(void)data;
WMSelectAllListItems((WMList *) self);
}
@@ -480,6 +484,7 @@ void testColorPanel(WMScreen * scr)
void sliderCallback(WMWidget * w, void *data)
{
(void)data;
printf("SLIDER == %i\n", WMGetSliderValue(w));
}
@@ -749,6 +754,8 @@ void testTabView(WMScreen * scr)
void splitViewConstrainProc(WMSplitView * sPtr, int indView, int *minSize, int *maxSize)
{
(void)sPtr;
switch (indView) {
case 0:
*minSize = 20;
@@ -782,6 +789,7 @@ static void resizeSplitView(XEvent * event, void *data)
void appendSubviewButtonAction(WMWidget * self, void *data)
{
(void)self;
WMSplitView *sPtr = (WMSplitView *) data;
char buf[64];
WMLabel *label = WMCreateLabel(sPtr);
@@ -796,6 +804,7 @@ void appendSubviewButtonAction(WMWidget * self, void *data)
void removeSubviewButtonAction(WMWidget * self, void *data)
{
(void)self;
WMSplitView *sPtr = (WMSplitView *) data;
int count = WMGetSplitViewSubviewsCount(sPtr);
@@ -808,12 +817,14 @@ void removeSubviewButtonAction(WMWidget * self, void *data)
void orientationButtonAction(WMWidget * self, void *data)
{
(void)self;
WMSplitView *sPtr = (WMSplitView *) data;
WMSetSplitViewVertical(sPtr, !WMGetSplitViewVertical(sPtr));
}
void adjustSubviewsButtonAction(WMWidget * self, void *data)
{
(void)self;
WMAdjustSplitViewSubviews((WMSplitView *) data);
}
@@ -902,7 +913,7 @@ void testSplitView(WMScreen * scr)
WMMapWidget(win);
}
void testUD()
void testUD(void)
{
WMUserDefaults *defs;
char str[32];
+1 -1
View File
@@ -26,7 +26,7 @@
#include <WINGs/WUtil.h>
#include <X11/Xlib.h>
#define WINGS_H_VERSION 20210726
#define WINGS_H_VERSION 20230226
#ifdef __cplusplus
+2
View File
@@ -494,6 +494,8 @@ void W_SetPreeditPositon(W_View *view, int x, int y);
int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer,
int buflen, KeySym *keysym, Status *status);
KeySym W_KeycodeToKeysym(Display *display, KeyCode keycode, int index);
/* ---[ wmisc.c ]--------------------------------------------------------- */
+2 -2
View File
@@ -612,10 +612,10 @@ static void menu_parser_condition_ifmacro(WMenuParser parser, Bool check_exists)
macro = menu_parser_find_macro(parser, macro_name);
parser->cond.stack[0].skip =
((check_exists) && (macro == NULL)) ||
((!check_exists) && (macro != NULL)) ;
((!check_exists) && (macro != NULL));
}
strcpy(parser->cond.stack[0].name, cmd_name);
strncpy(parser->cond.stack[0].name, cmd_name, sizeof(parser->cond.stack[0].name) - 1);
parser->cond.stack[0].line = parser->line_number;
}
+6 -2
View File
@@ -167,6 +167,7 @@ void menu_parser_define_macro(WMenuParser parser)
return;
}
macro = wmalloc(sizeof(*macro));
memset(arg_name, 0, MAX_MACRO_ARG_COUNT * sizeof(char *));
/* Isolate name of macro */
idx = 0;
@@ -279,7 +280,8 @@ WParserMacro *menu_parser_find_macro(WMenuParser parser, const char *name)
continue;
return macro;
check_next_macro: ;
check_next_macro:
;
}
return NULL;
}
@@ -391,6 +393,8 @@ void menu_parser_expand_macro(WMenuParser parser, WParserMacro *macro)
unsigned int size;
int i, space_left;
memset(arg_value, 0, MAX_MACRO_ARG_COUNT * sizeof(char *));
/* Skip the name of the macro, this was not done by caller */
for (i = 0; macro->name[i] != '\0'; i++)
parser->rd++;
@@ -692,7 +696,7 @@ static void w_create_macro(WMenuParser parser, const char *name, WParserMacroFun
WParserMacro *macro;
macro = wmalloc(sizeof(*macro));
strcpy(macro->name, name);
strncpy(macro->name, name, sizeof(macro->name) - 1);
macro->function = handler;
macro->arg_count = -1;
macro->next = parser->macros;
+1 -1
View File
@@ -1,5 +1,5 @@
# Translation into Western Frisian for Window Maker
# Copyright (C) 2015-2016 Window Maker Developers Team
# Copyright (C) 2015-2019 Window Maker Developers Team
# This file is distributed under the same license as the windowmaker package.
# Original by Alwin <translations@ziggo.nl>, 2015.
#
+1 -1
View File
@@ -1,5 +1,5 @@
# New translation into Dutch for Window Maker
# Copyright (C) 2014-2015 Window Maker Developers Team
# Copyright (C) 2014-2019 Window Maker Developers Team
# This file is distributed under the same license as the windowmaker package.
# Original by Alwin <translations@ziggo.nl>, 2014.
#
+9 -21
View File
@@ -1732,36 +1732,23 @@ Bool WMWritePropListToFile(WMPropList * plist, const char *path)
* file, and the last component is stripped off. the rest is the
* the hierarchy to be created.
*
* refuses to create anything outside $WMAKER_USER_ROOT/Defaults or $WMAKER_USER_ROOT/Library
* refuses to create anything outside $WMAKER_USER_ROOT
*
* returns 1 on success, 0 on failure
*/
int wmkdirhier(const char *path)
{
const char *libpath;
char *udefpath;
int cmp;
const char *t;
char *thePath = NULL, buf[1024];
size_t p, plen;
struct stat st;
/* Only create directories under $WMAKER_USER_ROOT/Defaults or $WMAKER_USER_ROOT/Library */
libpath = wuserdatapath();
if (strncmp(path, libpath, strlen(libpath)) == 0)
if (path[strlen(libpath)] == '/')
goto path_in_valid_tree;
/* Only create directories under $WMAKER_USER_ROOT */
if ((t = wusergnusteppath()) == NULL)
return 0;
if (strncmp(path, t, strlen(t)) != 0)
return 0;
udefpath = wdefaultspathfordomain("");
cmp = strncmp(path, udefpath, strlen(udefpath));
wfree(udefpath);
if (cmp == 0)
/* Note: by side effect, 'udefpath' already contains a final '/' */
goto path_in_valid_tree;
/* If we reach this point, the path is outside the allowed tree */
return 0;
path_in_valid_tree:
thePath = wstrdup(path);
/* Strip the trailing component if it is a file */
p = strlen(thePath);
@@ -1784,6 +1771,7 @@ int wmkdirhier(const char *path)
}
memset(buf, 0, sizeof(buf));
strncpy(buf, t, sizeof(buf) - 1);
p = strlen(buf);
plen = strlen(thePath);
@@ -1794,7 +1782,7 @@ int wmkdirhier(const char *path)
strncpy(buf, thePath, p);
if (mkdir(buf, 0777) == -1 && errno == EEXIST &&
stat(buf, &st) == 0 && !S_ISDIR(st.st_mode)) {
werror(_("Could not create path component %s"), buf);
werror(_("Could not create component %s"), buf);
wfree(thePath);
return 0;
}
+3 -3
View File
@@ -51,7 +51,7 @@ static WMColor *findCloseColor(WMScreen * scr, unsigned short red, unsigned shor
color->refCount = 1;
color->color = xcolor;
color->alpha = alpha;
color->flags.exact = 1;
color->flags.exact = 0;
color->gc = NULL;
return color;
@@ -91,7 +91,7 @@ WMColor *WMCreateRGBColor(WMScreen * scr, unsigned short red, unsigned short gre
color = findCloseColor(scr, red, green, blue, 0xffff);
}
if (!color)
color = WMBlackColor(scr);
color = scr->black;
return color;
}
@@ -117,7 +117,7 @@ WMColor *WMCreateRGBAColor(WMScreen * scr, unsigned short red, unsigned short gr
color = findCloseColor(scr, red, green, blue, alpha);
}
if (!color)
color = WMBlackColor(scr);
color = scr->black;
return color;
}
+3 -3
View File
@@ -2259,7 +2259,7 @@ static void wheelPositionSelectionOutBounds(W_ColorPanel * panel, int x, int y)
static void wheelUpdateBrightnessGradientFromLocation(W_ColorPanel * panel)
{
CPColor from;
CPColor from = {};
unsigned long ofs;
ofs = panel->coly * panel->wheelMtrx->width + panel->colx;
@@ -2604,7 +2604,7 @@ static void cmykTextFieldCallback(void *observerData, WMNotification * notificat
static void hsbSliderCallback(WMWidget * w, void *data)
{
CPColor cpColor;
CPColor cpColor = {};
int value[3];
char tmp[4];
W_ColorPanel *panel = (W_ColorPanel *) data;
@@ -2640,7 +2640,7 @@ static void hsbSliderCallback(WMWidget * w, void *data)
static void hsbTextFieldCallback(void *observerData, WMNotification * notification)
{
CPColor cpColor;
CPColor cpColor = {};
int value[3];
char tmp[12]; /* We only 4 bytes needed, but compilers cannot know that */
int n;
+3
View File
@@ -253,6 +253,9 @@ WMFrame *WMCreateFrame(WMWidget * parent)
static void destroyFrame(Frame * fPtr)
{
if (fPtr->textColor)
WMReleaseColor(fPtr->textColor);
if (fPtr->caption)
wfree(fPtr->caption);
+29
View File
@@ -213,3 +213,32 @@ int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer, int bufl
#endif
return XLookupString(event, buffer, buflen, keysym, (XComposeStatus *) status);
}
/*
* Map a keycode to the corresponding keysym
* To replace the deprecated X11 function XKeycodeToKeysym
*/
KeySym W_KeycodeToKeysym(Display *display, KeyCode keycode, int index)
{
static int min_kc = -1;
static int max_kc;
int num_syms;
KeySym *key_syms;
KeySym ks;
XDisplayKeycodes(display, &min_kc, &max_kc);
if (keycode < min_kc || keycode > max_kc || index < 0) {
return NoSymbol;
}
key_syms = XGetKeyboardMapping(display, keycode, 1, &num_syms);
if (index >= num_syms) {
XFree(key_syms);
return NoSymbol;
}
ks = key_syms[index];
XFree(key_syms);
return ks;
}
+3 -3
View File
@@ -25,7 +25,7 @@ static void handleKeyPress(XEvent * event, void *clientData)
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
if (ksym == XK_Return && panel->defBtn) {
if ((ksym == XK_Return || ksym == XK_KP_Enter) && panel->defBtn) {
WMPerformButtonClick(panel->defBtn);
} else if (ksym == XK_Escape) {
if (panel->altBtn || panel->othBtn) {
@@ -421,7 +421,7 @@ static void handleKeyPress2(XEvent * event, void *clientData)
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
if (ksym == XK_Return && panel->defBtn) {
if ((ksym == XK_Return || ksym == XK_KP_Enter) && panel->defBtn) {
WMPerformButtonClick(panel->defBtn);
} else if (ksym == XK_Escape) {
if (panel->altBtn) {
@@ -709,7 +709,7 @@ static void handleKeyPress3(XEvent * event, void *clientData)
XLookupString(&event->xkey, NULL, 0, &ksym, NULL);
if (ksym == XK_Return && panel->defBtn) {
if ((ksym == XK_Return || ksym == XK_KP_Enter) && panel->defBtn) {
WMPerformButtonClick(panel->defBtn);
} else if (ksym == XK_Escape) {
if (panel->altBtn) {
+4 -1
View File
@@ -166,12 +166,15 @@ typedef struct W_Text {
WMArray *xdndDestinationTypes;
} Text;
/* not used */
#if 0
#define NOTIFY(T,C,N,A) {\
WMNotification *notif = WMCreateNotification(N,T,A);\
if ((T)->delegate && (T)->delegate->C)\
(*(T)->delegate->C)((T)->delegate,notif);\
WMPostNotification(notif);\
WMReleaseNotification(notif);}
#endif
#define TYPETEXT 0
@@ -622,7 +625,7 @@ static void paintText(Text * tPtr)
TextBlock *tb;
WMFont *font;
const char *text;
int len, y, c, s, done = False, dir /* 1 = down */ ;
int len, y, c, s, done = False, dir; /* dir 1 = down */
WMScreen *scr = tPtr->view->screen;
Display *dpy = tPtr->view->screen->display;
Window win = tPtr->view->window;
+1 -1
View File
@@ -661,7 +661,7 @@ static void didResizeTextField(W_ViewDelegate * self, WMView * view)
tPtr->offsetWidth = WMAX((tPtr->view->size.height - WMFontHeight(tPtr->font)) / 2, 1);
tPtr->usableWidth = tPtr->view->size.width - 2 * tPtr->offsetWidth /*+ 2 */ ;
tPtr->usableWidth = tPtr->view->size.width - 2 * tPtr->offsetWidth;
}
static char *makeHiddenString(int length)
+4
View File
@@ -395,7 +395,11 @@ static void setWindowMakerHints(WMWindow * win)
memset(&attribs, 0, sizeof(GNUstepWMAttributes));
attribs.flags = GSWindowStyleAttr | GSWindowLevelAttr | GSExtraFlagsAttr;
if (win->minSize.width == win->maxSize.width && win->minSize.height == win->maxSize.height)
win->flags.style &= ~WMResizableWindowMask;
attribs.window_style = win->flags.style;
attribs.window_level = win->level;
if (win->flags.documentEdited)
attribs.extra_flags = GSDocumentEditedFlag;
+17 -5
View File
@@ -1076,6 +1076,8 @@ static void deleteTexture(WMWidget * w, void *data)
(void) w;
section = WMGetPopUpButtonSelectedItem(panel->secP);
if (section < 0)
return;
row = WMGetListSelectedItemRow(panel->texLs);
item = WMGetListItem(panel->texLs, row);
titem = (TextureListItem *) item->clientData;
@@ -1134,6 +1136,8 @@ static void changePage(WMWidget * w, void *data)
if (w) {
section = WMGetPopUpButtonSelectedItem(panel->secP);
if (section < 0)
return;
WMSelectListItem(panel->texLs, panel->textureIndex[section]);
@@ -1233,6 +1237,8 @@ static void textureDoubleClick(WMWidget * w, void *data)
/* unselect old texture */
section = WMGetPopUpButtonSelectedItem(panel->secP);
if (section < 0)
return;
item = WMGetListItem(panel->texLs, panel->textureIndex[section]);
titem = (TextureListItem *) item->clientData;
@@ -1261,7 +1267,7 @@ static void paintListItem(WMList * lPtr, int index, Drawable d, char *text, int
{
_Panel *panel = (_Panel *) WMGetHangedData(lPtr);
WMScreen *scr = WMWidgetScreen(lPtr);
int width, height, x, y;
int width, height, x, y, tmp;
Display *dpy = WMScreenDisplay(scr);
WMColor *back = (state & WLDSSelected) ? WMWhiteColor(scr) : WMGrayColor(scr);
WMListItem *item;
@@ -1290,7 +1296,8 @@ static void paintListItem(WMList * lPtr, int index, Drawable d, char *text, int
XCopyArea(dpy, titem->preview, d, WMColorGC(black), 0, 0,
TEXPREV_WIDTH, TEXPREV_HEIGHT, x + 5, y + 5);
if ((1 << WMGetPopUpButtonSelectedItem(panel->secP)) & titem->selectedFor)
tmp = WMGetPopUpButtonSelectedItem(panel->secP);
if ((tmp >= 0) && ((1 << tmp) & titem->selectedFor))
WMDrawPixmap(panel->onLed, d, x + TEXPREV_WIDTH + 10, y + 6);
else if (titem->selectedFor)
WMDrawPixmap(panel->offLed, d, x + TEXPREV_WIDTH + 10, y + 6);
@@ -1425,6 +1432,10 @@ static void changeColorPage(WMWidget * w, void *data)
WMScreen *scr = WMWidgetScreen(panel->box);
RContext *rc = WMScreenRContext(scr);
section = WMGetPopUpButtonSelectedItem(panel->colP);
if (section < 0)
return;
if (panel->preview) {
GC gc;
@@ -1436,7 +1447,6 @@ static void changeColorPage(WMWidget * w, void *data)
colorOptions[panel->oldcsection].hand.y);
}
if (w) {
section = WMGetPopUpButtonSelectedItem(panel->colP);
panel->oldcsection = section;
if (panel->preview)
@@ -1737,6 +1747,8 @@ static void colorWellObserver(void *self, WMNotification * n)
(void) n;
p = WMGetPopUpButtonSelectedItem(panel->colP);
if (p < 0)
return;
WMReleaseColor(panel->colors[p]);
@@ -1831,7 +1843,7 @@ static void createPanel(Panel * p)
panel->fprefix = wstrconcat(wuserdatapath(), "/" PACKAGE_TARNAME);
if (access(panel->fprefix, F_OK) != 0) {
if (mkdir(panel->fprefix, 0755) < 0) {
if (-1 == mkdir(panel->fprefix, 0755) && errno != EEXIST) {
werror("%s", panel->fprefix);
ok = False;
}
@@ -1841,7 +1853,7 @@ static void createPanel(Panel * p)
wfree(panel->fprefix);
panel->fprefix = tmp;
if (access(panel->fprefix, F_OK) != 0) {
if (mkdir(panel->fprefix, 0755) < 0) {
if (-1 == mkdir(panel->fprefix, 0755) && errno != EEXIST) {
werror("%s", panel->fprefix);
}
}
+20 -5
View File
@@ -2,8 +2,9 @@
*
* WPrefs - Window Maker Preferences Program
*
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2023 Window Maker Team
* Copyright (c) 1998-2003 Alfredo K. Kojima
* Copyright (c) 2009-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,7 +26,7 @@
/* This structure containts the list of all the check-buttons to display in the
* expert tab of the window with the corresponding information for effect
*/
static const struct {
static struct expert_option {
const char *label; /* Text displayed to user */
int def_state; /* True/False: the default value, if not defined in current config */
@@ -88,7 +89,7 @@ static const struct {
/* default: */ False, OPTION_WMAKER, "KbdModeLock" },
#endif /* XKB_MODELOCK */
{ N_("Maximize (snap) a window to edge or corner by dragging."),
{ N_("Snap a window to edge or corner by dragging."),
/* default: */ False, OPTION_WMAKER, "WindowSnapping" },
{ N_("Distance from edge to begin window snap."),
@@ -97,7 +98,7 @@ static const struct {
{ N_("Distance from corner to begin window snap."),
/* default: */ 10, OPTION_WMAKER_INT, "SnapCornerDetect" },
{ N_("Snapping a window to the top maximizes it to the full screen."),
{ N_("Snap a window to the top to maximize it to the full screen."),
/* default: */ False, OPTION_WMAKER, "SnapToTopMaximizesFullscreen" },
{ N_("Allow move half-maximized windows between multiple screens."),
@@ -115,7 +116,7 @@ static const struct {
{ N_("Wrap dock-attached icons around the screen edges."),
/* default: */ True, OPTION_WMAKER, "WrapAppiconsInDock" },
{ N_("Double click on titlebar maximize a window to full screen."),
{ N_("Double click on titlebar maximizes/minimizes a window to/from full screen."),
/* default: */ False, OPTION_WMAKER, "DbClickFullScreen" },
{ N_("Close rootmenu when mouse (left or right) is clicked outside focus."),
@@ -172,6 +173,19 @@ static void upButtonCallback(WMWidget *self, void *data)
changeIntTextfield(data, 1);
}
static int cmpExpertOptions(const void *v1, const void *v2)
{
int rc;
const struct expert_option *opt1 = (struct expert_option *)v1;
const struct expert_option *opt2 = (struct expert_option *)v2;
if ((rc = strcmp(opt1->label, opt2->label)) < 0)
return -1;
else if (rc > 0)
return 1;
return 0;
}
static void createPanel(Panel *p)
{
_Panel *panel = (_Panel *) p;
@@ -195,6 +209,7 @@ static void createPanel(Panel *p)
WMSetFrameRelief(f, WRFlat);
udb = WMGetStandardUserDefaults();
qsort(expert_options, wlengthof(expert_options), sizeof(expert_options[0]), cmpExpertOptions);
for (i = 0; i < wlengthof(expert_options); i++) {
if (expert_options[i].class != OPTION_WMAKER_INT) {
panel->swi[i] = WMCreateSwitchButton(f);
+465
View File
@@ -0,0 +1,465 @@
/* HotCornerShortcuts.c - screen corners actions
*
* WPrefs - Window Maker Preferences Program
*
* Copyright (c) 2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "WPrefs.h"
typedef struct _Panel {
WMBox *box;
char *sectionName;
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMPixmap *icon;
Pixmap quarter[4];
WMFrame *hcF;
WMButton *hcB;
WMFrame *hceF;
WMSlider *hceS;
WMLabel *hceL;
WMFrame *hcdescF;
WMLabel *hcdescL;
WMFrame *hcdelayF;
WMButton *hcdelayB[5];
WMTextField *hcdelayT;
WMLabel *hcdelayL;
WMLabel *icornerL;
WMFrame *hcactionsF;
WMTextField *hcactionsT[4];
char hotcornerDelaySelected;
} _Panel;
#define ICON_FILE "hotcorners"
#define DELAY_ICON "timer%i"
#define DELAY_ICON_S "timer%is"
static void edgeCallback(WMWidget * w, void *data)
{
_Panel *panel = (_Panel *) data;
char buffer[64];
int i;
/* Parameter not used, but tell the compiler that it is ok */
(void) w;
i = WMGetSliderValue(panel->hceS);
if (i == 0)
sprintf(buffer, _("OFF"));
else if (i == 1)
sprintf(buffer, _("1 pixel"));
else if (i <= 4)
/* 2-4 */
sprintf(buffer, _("%i pixels"), i);
else
/* >4 */
sprintf(buffer, _("%i pixels "), i); /* note space! */
WMSetLabelText(panel->hceL, buffer);
}
static void showData(_Panel * panel)
{
int i;
char buffer[32];
WMPropList *array;
if (!GetObjectForKey("HotCornerDelay"))
i = 250;
else
i = GetIntegerForKey("HotCornerDelay");
sprintf(buffer, "%i", i);
WMSetTextFieldText(panel->hcdelayT, buffer);
switch (i) {
case 0:
WMPerformButtonClick(panel->hcdelayB[0]);
break;
case 250:
WMPerformButtonClick(panel->hcdelayB[1]);
break;
case 500:
WMPerformButtonClick(panel->hcdelayB[2]);
break;
case 750:
WMPerformButtonClick(panel->hcdelayB[3]);
break;
case 1000:
WMPerformButtonClick(panel->hcdelayB[4]);
break;
}
i = GetIntegerForKey("HotCornerEdge");
i = i < 0 ? 2 : i;
i = i > 10 ? 10 : i;
WMSetSliderValue(panel->hceS, i);
edgeCallback(NULL, panel);
WMSetButtonSelected(panel->hcB, GetBoolForKey("HotCorners"));
array = GetObjectForKey("HotCornerActions");
if (array && (!WMIsPLArray(array) || WMGetPropListItemCount(array) != sizeof(panel->hcactionsT) / sizeof(WMTextField *))) {
wwarning(_("invalid data in option HotCornerActions."));
} else {
if (array) {
for (i = 0; i < sizeof(panel->hcactionsT) / sizeof(WMTextField *); i++)
if (strcasecmp(WMGetFromPLString(WMGetFromPLArray(array, i)), "None") != 0)
WMSetTextFieldText(panel->hcactionsT[i], WMGetFromPLString(WMGetFromPLArray(array, i)));
}
}
}
static void storeData(_Panel * panel)
{
WMPropList *list;
WMPropList *tmp;
char *str;
int i;
SetBoolForKey(WMGetButtonSelected(panel->hcB), "HotCorners");
str = WMGetTextFieldText(panel->hcdelayT);
if (sscanf(str, "%i", &i) != 1)
i = 0;
SetIntegerForKey(i, "HotCornerDelay");
free(str);
SetIntegerForKey(WMGetSliderValue(panel->hceS), "HotCornerEdge");
list = WMCreatePLArray(NULL, NULL);
for (i = 0; i < sizeof(panel->hcactionsT) / sizeof(WMTextField *); i++) {
str = WMGetTextFieldText(panel->hcactionsT[i]);
if (strlen(str) == 0)
str = "None";
tmp = WMCreatePLString(str);
WMAddToPLArray(list, tmp);
}
SetObjectForKey(list, "HotCornerActions");
}
static void pushDelayButton(WMWidget * w, void *data)
{
_Panel *panel = (_Panel *) data;
panel->hotcornerDelaySelected = 1;
if (w == panel->hcdelayB[0]) {
WMSetTextFieldText(panel->hcdelayT, "0");
} else if (w == panel->hcdelayB[1]) {
WMSetTextFieldText(panel->hcdelayT, "250");
} else if (w == panel->hcdelayB[2]) {
WMSetTextFieldText(panel->hcdelayT, "500");
} else if (w == panel->hcdelayB[3]) {
WMSetTextFieldText(panel->hcdelayT, "700");
} else if (w == panel->hcdelayB[4]) {
WMSetTextFieldText(panel->hcdelayT, "1000");
}
}
static void delayTextChanged(void *observerData, WMNotification * notification)
{
_Panel *panel = (_Panel *) observerData;
int i;
/* Parameter not used, but tell the compiler that it is ok */
(void) notification;
if (panel->hotcornerDelaySelected) {
for (i = 0; i < 5; i++) {
WMSetButtonSelected(panel->hcdelayB[i], False);
}
panel->hotcornerDelaySelected = 0;
}
}
static void createPanel(Panel * p)
{
_Panel *panel = (_Panel *) p;
int i;
char *buf1, *buf2;
WMColor *color;
WMFont *font;
char *path;
RImage *xis = NULL;
WMScreen *scr = WMWidgetScreen(panel->parent);
RContext *rc = WMScreenRContext(scr);
GC gc = XCreateGC(scr->display, WMWidgetXID(panel->parent), 0, NULL);
path = LocateImage(ICON_FILE);
if (path) {
xis = RLoadImage(rc, path, 0);
if (!xis) {
wwarning(_("could not load image file %s"), path);
}
wfree(path);
}
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/***************** Hot Corner lelf side frames *****************/
panel->hcF = WMCreateFrame(panel->box);
WMResizeWidget(panel->hcF, 240, 53);
WMMoveWidget(panel->hcF, 15, 17);
panel->hcB = WMCreateSwitchButton(panel->hcF);
WMResizeWidget(panel->hcB, 150, 30);
WMMoveWidget(panel->hcB, 15, 12);
WMSetButtonText(panel->hcB, _("Enable Hot Corners"));
WMMapSubwidgets(panel->hcF);
panel->hceF = WMCreateFrame(panel->box);
WMSetFrameTitle(panel->hceF, _("Hot Corner Edge"));
WMResizeWidget(panel->hceF, 240, 40);
WMMoveWidget(panel->hceF, 15, 77);
panel->hceS = WMCreateSlider(panel->hceF);
WMResizeWidget(panel->hceS, 80, 15);
WMMoveWidget(panel->hceS, 15, 18);
WMSetSliderMinValue(panel->hceS, 2);
WMSetSliderMaxValue(panel->hceS, 10);
WMSetSliderAction(panel->hceS, edgeCallback, panel);
panel->hceL = WMCreateLabel(panel->hceF);
WMResizeWidget(panel->hceL, 100, 15);
WMMoveWidget(panel->hceL, 105, 18);
WMMapSubwidgets(panel->hceF);
panel->hcdescF = WMCreateFrame(panel->box);
WMResizeWidget(panel->hcdescF, 240, 95);
WMMoveWidget(panel->hcdescF, 15, 130);
panel->hcdescL = WMCreateLabel(panel->hcdescF);
WMResizeWidget(panel->hcdescL, 200, 60);
WMMoveWidget(panel->hcdescL, 15, 10);
WMSetLabelText(panel->hcdescL,
_("Instructions:\n\n"
" - assign command to corner\n"
" - or leave it empty\n"));
WMMapSubwidgets(panel->hcdescF);
/***************** Hot Corner Action Delay *****************/
panel->hcdelayF = WMCreateFrame(panel->box);
WMResizeWidget(panel->hcdelayF, 245, 60);
WMMoveWidget(panel->hcdelayF, 265, 10);
WMSetFrameTitle(panel->hcdelayF, _("Hot Corner Delay"));
buf1 = wmalloc(strlen(DELAY_ICON) + 1);
buf2 = wmalloc(strlen(DELAY_ICON_S) + 1);
for (i = 0; i < 5; i++) {
char *path;
panel->hcdelayB[i] = WMCreateCustomButton(panel->hcdelayF, WBBStateChangeMask);
WMResizeWidget(panel->hcdelayB[i], 25, 25);
WMMoveWidget(panel->hcdelayB[i], 12 + (30 * i), 25);
WMSetButtonBordered(panel->hcdelayB[i], False);
WMSetButtonImagePosition(panel->hcdelayB[i], WIPImageOnly);
WMSetButtonAction(panel->hcdelayB[i], pushDelayButton, panel);
if (i > 0)
WMGroupButtons(panel->hcdelayB[0], panel->hcdelayB[i]);
sprintf(buf1, DELAY_ICON, i);
sprintf(buf2, DELAY_ICON_S, i);
path = LocateImage(buf1);
if (path) {
panel->icon = WMCreatePixmapFromFile(scr, path);
if (panel->icon) {
WMSetButtonImage(panel->hcdelayB[i], panel->icon);
WMReleasePixmap(panel->icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
path = LocateImage(buf2);
if (path) {
panel->icon = WMCreatePixmapFromFile(scr, path);
if (panel->icon) {
WMSetButtonAltImage(panel->hcdelayB[i], panel->icon);
WMReleasePixmap(panel->icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
}
wfree(buf1);
wfree(buf2);
panel->hcdelayT = WMCreateTextField(panel->hcdelayF);
WMResizeWidget(panel->hcdelayT, 36, 20);
WMMoveWidget(panel->hcdelayT, 165, 28);
WMAddNotificationObserver(delayTextChanged, panel, WMTextDidChangeNotification, panel->hcdelayT);
panel->hcdelayL = WMCreateLabel(panel->hcdelayF);
WMResizeWidget(panel->hcdelayL, 36, 16);
WMMoveWidget(panel->hcdelayL, 205, 32);
WMSetLabelText(panel->hcdelayL, _("ms"));
color = WMDarkGrayColor(scr);
font = WMSystemFontOfSize(scr, 10);
WMSetLabelTextColor(panel->hcdelayL, color);
WMSetLabelFont(panel->hcdelayL, font);
WMReleaseColor(color);
WMReleaseFont(font);
WMMapSubwidgets(panel->hcdelayF);
/***************** Set Hot Corner Actions ****************/
panel->hcactionsF = WMCreateFrame(panel->box);
WMSetFrameTitle(panel->hcactionsF, _("Hot Corner Actions"));
WMResizeWidget(panel->hcactionsF, 245, 148);
WMMoveWidget(panel->hcactionsF, 265, 77);
panel->icornerL = WMCreateLabel(panel->hcactionsF);
WMResizeWidget(panel->icornerL, 24, 24);
WMMoveWidget(panel->icornerL, 10, 18);
WMSetLabelImagePosition(panel->icornerL, WIPImageOnly);
CreateImages(scr, rc, xis, ICON_FILE, &panel->icon, NULL);
if (panel->icon)
{
WMPixmap *nicon;
panel->quarter[0] = XCreatePixmap(scr->display, WMWidgetXID(panel->parent), panel->icon->width/2, panel->icon->height/2, WMScreenDepth(scr));
XCopyArea(scr->display, WMGetPixmapXID(panel->icon), panel->quarter[0], gc, 0, 0, panel->icon->width/2, panel->icon->height/2, 0, 0);
nicon = WMCreatePixmapFromXPixmaps(scr, panel->quarter[0], WMGetPixmapMaskXID(panel->icon),
panel->icon->width/2, panel->icon->height/2, WMScreenDepth(scr));
WMSetLabelImage(panel->icornerL, nicon);
WMReleasePixmap(nicon);
}
panel->hcactionsT[0] = WMCreateTextField(panel->hcactionsF);
WMResizeWidget(panel->hcactionsT[0], 180, 20);
WMMoveWidget(panel->hcactionsT[0], 50, 20);
panel->icornerL = WMCreateLabel(panel->hcactionsF);
WMResizeWidget(panel->icornerL, 24, 24);
WMMoveWidget(panel->icornerL, 10, 48);
WMSetLabelImagePosition(panel->icornerL, WIPImageOnly);
if (panel->icon)
{
WMPixmap *nicon;
panel->quarter[1] = XCreatePixmap(scr->display, WMWidgetXID(panel->parent), panel->icon->width/2, panel->icon->height/2, WMScreenDepth(scr));
XCopyArea(scr->display, WMGetPixmapXID(panel->icon), panel->quarter[1], gc, panel->icon->width/2, 0, panel->icon->width/2, panel->icon->height/2, 0, 0);
nicon = WMCreatePixmapFromXPixmaps(scr, panel->quarter[1], WMGetPixmapMaskXID(panel->icon),
panel->icon->width/2, panel->icon->height/2, WMScreenDepth(scr));
WMSetLabelImage(panel->icornerL, nicon);
WMReleasePixmap(nicon);
}
panel->hcactionsT[1] = WMCreateTextField(panel->hcactionsF);
WMResizeWidget(panel->hcactionsT[1], 180, 20);
WMMoveWidget(panel->hcactionsT[1], 50, 50);
panel->icornerL = WMCreateLabel(panel->hcactionsF);
WMResizeWidget(panel->icornerL, 24, 24);
WMMoveWidget(panel->icornerL, 10, 78);
WMSetLabelImagePosition(panel->icornerL, WIPImageOnly);
if (panel->icon)
{
WMPixmap *nicon;
panel->quarter[2] = XCreatePixmap(scr->display, WMWidgetXID(panel->parent), panel->icon->width/2, panel->icon->height/2, WMScreenDepth(scr));
XCopyArea(scr->display, WMGetPixmapXID(panel->icon), panel->quarter[2], gc, 0, panel->icon->height/2, panel->icon->width/2, panel->icon->height/2, 0, 0);
nicon = WMCreatePixmapFromXPixmaps(scr, panel->quarter[2], WMGetPixmapMaskXID(panel->icon),
panel->icon->width/2, panel->icon->height/2, WMScreenDepth(scr));
WMSetLabelImage(panel->icornerL, nicon);
WMReleasePixmap(nicon);
}
panel->hcactionsT[2] = WMCreateTextField(panel->hcactionsF);
WMResizeWidget(panel->hcactionsT[2], 180, 20);
WMMoveWidget(panel->hcactionsT[2], 50, 80);
panel->icornerL = WMCreateLabel(panel->hcactionsF);
WMResizeWidget(panel->icornerL, 24, 24);
WMMoveWidget(panel->icornerL, 10, 108);
WMSetLabelImagePosition(panel->icornerL, WIPImageOnly);
if (panel->icon)
{
WMPixmap *nicon;
panel->quarter[3] = XCreatePixmap(scr->display, WMWidgetXID(panel->parent), panel->icon->width/2, panel->icon->height/2, WMScreenDepth(scr));
XCopyArea(scr->display, WMGetPixmapXID(panel->icon), panel->quarter[3], gc, panel->icon->width/2, panel->icon->height/2, panel->icon->width/2, panel->icon->height/2, 0, 0);
nicon = WMCreatePixmapFromXPixmaps(scr, panel->quarter[3], WMGetPixmapMaskXID(panel->icon),
panel->icon->width/2, panel->icon->height/2, WMScreenDepth(scr));
WMSetLabelImage(panel->icornerL, nicon);
WMReleasePixmap(nicon);
}
panel->hcactionsT[3] = WMCreateTextField(panel->hcactionsF);
WMResizeWidget(panel->hcactionsT[3], 180, 20);
WMMoveWidget(panel->hcactionsT[3], 50, 107);
WMMapSubwidgets(panel->hcactionsF);
if (xis)
RReleaseImage(xis);
XFreeGC(scr->display, gc);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
showData(panel);
}
static void prepareForClose(_Panel *panel)
{
int i;
WMScreen *scr = WMWidgetScreen(panel->parent);
WMReleasePixmap(panel->icon);
for (i = 0; i < sizeof(panel->quarter) / sizeof(Pixmap); i++)
XFreePixmap(scr->display, panel->quarter[i]);
}
Panel *InitHotCornerShortcuts(WMWidget *parent)
{
_Panel *panel;
panel = wmalloc(sizeof(_Panel));
panel->sectionName = _("Hot Corner Shortcut Preferences");
panel->description = _("Choose actions to perform when you move the\n"
"mouse pointer to the screen corners.");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
panel->callbacks.prepareForClose = prepareForClose;
AddSection(panel, ICON_FILE);
return panel;
}
+81 -20
View File
@@ -65,7 +65,7 @@ typedef struct _Panel {
* First parameter is the internal keyword known by WMaker
* Second is the text displayed to the user
*/
static const struct {
static struct keyOption {
const char *key;
const char *title;
} keyOptions[] = {
@@ -84,11 +84,12 @@ static const struct {
{ "RHMaximizeKey", N_("Maximize active window right half") },
{ "THMaximizeKey", N_("Maximize active window top half") },
{ "BHMaximizeKey", N_("Maximize active window bottom half") },
{ "LTCMaximizeKey", N_("Maximize active window left top corner") },
{ "RTCMaximizeKey", N_("Maximize active window right top corner") },
{ "LBCMaximizeKey", N_("Maximize active window left bottom corner") },
{ "RBCMaximizeKey", N_("Maximize active window right bottom corner") },
{ "MaximusKey", N_("Maximus: Tiled maximization ") },
{ "TLCMaximizeKey", N_("Maximize active window top left corner") },
{ "TRCMaximizeKey", N_("Maximize active window top right corner") },
{ "BLCMaximizeKey", N_("Maximize active window bottom left corner") },
{ "BRCMaximizeKey", N_("Maximize active window bottom right corner") },
{ "MaximusKey", N_("Tile active window") },
{ "CenterKey", N_("Center active window") },
{ "KeepOnTopKey", N_("Toggle window on top status") },
{ "KeepAtBottomKey",N_("Toggle window at bottom status") },
{ "OmnipresentKey", N_("Toggle window omnipresent status") },
@@ -154,10 +155,14 @@ static const struct {
/* Misc. */
{ "WindowRelaunchKey", N_("Launch new instance of application") },
{ "ScreenSwitchKey", N_("Switch to Next Screen/Monitor") },
{ "ScreenSwitchKey", N_("Switch to next screen/monitor") },
{ "RunKey", N_("Run application") },
{ "ExitKey", N_("Exit Window Maker") },
{ "DockRaiseLowerKey", N_("Raise/Lower Dock") },
{ "ClipRaiseLowerKey", N_("Raise/Lower Clip") }
{ "ClipRaiseLowerKey", N_("Raise/Lower Clip") },
{ "ScreenCaptureKey", N_("Capture the entire screen") },
{ "WindowCaptureKey", N_("Capture a window") },
{ "PartialCaptureKey", N_("Capture a portion of the screen") }
#ifdef XKB_MODELOCK
,{ "ToggleKbdModeKey", N_("Toggle keyboard language") }
#endif /* XKB_MODELOCK */
@@ -316,11 +321,8 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case)
if (ev.type == KeyPress && ev.xkey.keycode != 0) {
numlock_mask = NumLockMask(dpy);
if (xext_xkb_supported)
/* conditional mask check to get numeric keypad keys */
ksym = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, ev.xkey.state & numlock_mask?1:0);
else
ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, 0);
/* conditional mask check to get numeric keypad keys */
ksym = W_KeycodeToKeysym(dpy, ev.xkey.keycode, ev.xkey.state & numlock_mask?1:0);
if (!IsModifierKey(ksym)) {
if (convert_case) {
@@ -368,6 +370,36 @@ char *capture_shortcut(Display *dpy, Bool *capturing, Bool convert_case)
return wstrdup(buffer);
}
/*
* check if the keystr entered is already set to another action
* if found it returns the position in the keyOptions
*/
static int isKeySet(_Panel *panel, char *keystr)
{
int i;
char *str;
for (i = 0; i < panel->actionCount; i++) {
str = NULL;
if (panel->shortcuts[i]) {
str = wtrimspace(panel->shortcuts[i]);
if (strlen(str) == 0) {
wfree(str);
str = NULL;
}
}
if (str) {
if (strcmp(keystr, str) == 0) {
wfree(str);
return i;
}
wfree(str);
}
}
return -1;
}
static void captureClick(WMWidget * w, void *data)
{
_Panel *panel = (_Panel *) data;
@@ -382,17 +414,31 @@ static void captureClick(WMWidget * w, void *data)
XGrabKeyboard(dpy, WMWidgetXID(panel->parent), True, GrabModeAsync, GrabModeAsync, CurrentTime);
shortcut = capture_shortcut(dpy, &panel->capturing, 1);
if (shortcut) {
int key_idx = -1;
int row = WMGetListSelectedItemRow(panel->actLs);
WMSetTextFieldText(panel->shoT, shortcut);
if (row >= 0) {
if (panel->shortcuts[row])
wfree(panel->shortcuts[row]);
panel->shortcuts[row] = shortcut;
key_idx = isKeySet(panel, shortcut);
if (key_idx >= 0 && (key_idx != row)) {
char *msg;
WMRedisplayWidget(panel->actLs);
} else {
msg = wstrconcat(_("Key shortcut already in use by the "), _(keyOptions[key_idx].title));
WMRunAlertPanel(WMWidgetScreen(w), GetWindow(),
_("Error"),
msg,
_("OK"), NULL, NULL);
wfree(msg);
wfree(shortcut);
} else {
WMSetTextFieldText(panel->shoT, shortcut);
if (row >= 0) {
if (panel->shortcuts[row])
wfree(panel->shortcuts[row]);
panel->shortcuts[row] = shortcut;
WMRedisplayWidget(panel->actLs);
} else {
wfree(shortcut);
}
}
}
}
@@ -499,6 +545,20 @@ static void paintItem(WMList * lPtr, int index, Drawable d, char *text, int stat
WMDrawString(scr, d, panel->black, panel->font, x + 20, y, text, strlen(text));
}
static int cmpKeyOptions(const void *v1, const void *v2)
{
int rc;
const struct keyOption *opt1 = (struct keyOption *)v1;
const struct keyOption *opt2 = (struct keyOption *)v2;
if ((rc = strncmp(opt1->title, opt2->title, 20)) < 0)
return -1;
else if (rc > 0)
return 1;
return 0;
}
static void createPanel(Panel * p)
{
_Panel *panel = (_Panel *) p;
@@ -538,6 +598,7 @@ static void createPanel(Panel * p)
WMSetListUserDrawProc(panel->actLs, paintItem);
WMHangData(panel->actLs, panel);
qsort(keyOptions, wlengthof(keyOptions), sizeof(keyOptions[0]), cmpKeyOptions);
for (i = 0; i < wlengthof(keyOptions); i++) {
WMAddListItem(panel->actLs, _(keyOptions[i].title));
}
+1
View File
@@ -35,6 +35,7 @@ WPrefs_SOURCES = \
Expert.c \
Focus.c \
FontSimple.c \
HotCornerShortcuts.c \
Icons.c \
KeyboardShortcuts.c \
Menu.c \
+2
View File
@@ -291,6 +291,8 @@ static void changedItemPad(WMWidget * w, void *data)
_Panel *panel = (_Panel *) data;
int padn = WMGetPopUpButtonSelectedItem(w);
if (padn < 0)
return;
WMUnmapWidget(panel->itemPad[panel->currentPad]);
WMMapWidget(panel->itemPad[padn]);
+3 -4
View File
@@ -381,10 +381,7 @@ static void fillModifierPopUp(WMPopUpButton * pop)
if (mapping->modifiermap[idx] != 0) {
int l;
for (l = 0; l < 4; l++) {
if (xext_xkb_supported)
ksym = XkbKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0, l);
else
ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], 0);
ksym = W_KeycodeToKeysym(dpy, mapping->modifiermap[idx], l);
if (ksym != NoSymbol)
break;
}
@@ -751,6 +748,8 @@ static void storeData(_Panel * panel)
int action;
action = WMGetPopUpButtonSelectedItem(panel->mouse_action[i].popup);
if (action < 0)
continue;
if (button_list[i].type == T_BUTTON)
db_value = button_actions[action].db_value;
else
+4
View File
@@ -196,9 +196,13 @@ static void storeData(_Panel * panel)
int i;
i = WMGetPopUpButtonSelectedItem(panel->sizeP);
if (i < 0)
return;
SetStringForKey(resize_display[i].db_value, "ResizeDisplay");
i = WMGetPopUpButtonSelectedItem(panel->posiP);
if (i < 0)
return;
SetStringForKey(move_display[i].db_value, "MoveDisplay");
lr = WMGetButtonSelected(panel->lrB);
+1 -1
View File
@@ -689,7 +689,7 @@ static void changeTypeCallback(WMWidget *w, void *data)
int i;
newType = WMGetPopUpButtonSelectedItem(w);
if (newType == panel->currentType)
if (newType < 0 || newType == panel->currentType)
return;
if (panel->currentType >= 0) {
+1
View File
@@ -575,6 +575,7 @@ void Initialize(WMScreen * scr)
InitKeyboardSettings(WPrefs.banner);
#endif
InitKeyboardShortcuts(WPrefs.banner);
InitHotCornerShortcuts(WPrefs.banner);
InitMouseSettings(WPrefs.banner);
InitAppearance(WPrefs.banner);
+2 -1
View File
@@ -33,6 +33,7 @@
#include <wraster.h>
#include <WINGs/WINGs.h>
#include <WINGs/WINGsP.h>
/* Needed for HAVE_LIBINTL_H and EXTENDED_WINDOWSHORTCUT */
#include "../src/wconfig.h"
@@ -54,7 +55,6 @@
/****/
extern char *NOptionValueChanged;
extern Bool xext_xkb_supported;
typedef struct _Panel Panel;
@@ -155,6 +155,7 @@ Panel *InitDocks(WMWidget *parent);
Panel *InitExpert(WMWidget *parent);
Panel *InitFocus(WMWidget *parent);
Panel *InitFontSimple(WMWidget *parent);
Panel *InitHotCornerShortcuts(WMWidget *parent);
Panel *InitIcons(WMWidget *parent);
Panel *InitKeyboardShortcuts(WMWidget *parent);
Panel *InitMenu(WMWidget *parent);
+5 -2
View File
@@ -207,12 +207,15 @@ static void createPanel(Panel * p)
static void storeData(_Panel * panel)
{
int tmp = WMGetPopUpButtonSelectedItem(panel->posP);
if (tmp < 0)
return;
SetBoolForKey(!WMGetButtonSelected(panel->linkB), "DontLinkWorkspaces");
SetBoolForKey(WMGetButtonSelected(panel->cyclB), "CycleWorkspaces");
SetBoolForKey(WMGetButtonSelected(panel->newB), "AdvanceToNewWorkspace");
SetStringForKey(WSNamePositions[WMGetPopUpButtonSelectedItem(panel->posP)],
"WorkspaceNameDisplayPosition");
SetStringForKey(WSNamePositions[tmp], "WorkspaceNameDisplayPosition");
}
Panel *InitWorkspace(WMWidget *parent)
+1 -1
View File
@@ -1150,7 +1150,7 @@ static void dragItem(WEditMenu * menu, WEditMenuItem * item, Bool copy)
static XColor back = { 0, 0xffff, 0xffff, 0xffff, DoRed | DoGreen | DoBlue, 0 };
Display *dpy = W_VIEW_DISPLAY(menu->view);
WMScreen *scr = W_VIEW_SCREEN(menu->view);
int x, y;
int x = 0, y = 0;
int dx, dy;
Bool done = False;
Window blaw;
-4
View File
@@ -35,8 +35,6 @@
#endif
char *NOptionValueChanged = "NOptionValueChanged";
Bool xext_xkb_supported = False;
#define MAX_DEATHS 64
@@ -157,8 +155,6 @@ int main(int argc, char **argv)
exit(0);
}
xext_xkb_supported = XkbQueryExtension(dpy, NULL, NULL, NULL, NULL, NULL);
WMPLSetCaseSensitive(False);
Initialize(scr);
+1
View File
@@ -14,6 +14,7 @@ POTFILES = \
$(top_srcdir)/WPrefs.app/Expert.c \
$(top_srcdir)/WPrefs.app/Focus.c \
$(top_srcdir)/WPrefs.app/FontSimple.c \
$(top_srcdir)/WPrefs.app/HotCornerShortcuts.c \
$(top_srcdir)/WPrefs.app/Icons.c \
$(top_srcdir)/WPrefs.app/KeyboardShortcuts.c \
$(top_srcdir)/WPrefs.app/Menu.c \
+1
View File
@@ -15,6 +15,7 @@ dist_tiffdata_DATA = \
ergonomic.tiff \
expert.tiff \
fonts.tiff \
hotcorners.tiff \
iconprefs.tiff \
keyboard.tiff \
keyboardprefs.tiff \
Binary file not shown.
+1 -4
View File
@@ -171,10 +171,7 @@ static void x_reset_modifier_mapping(Display * display)
KeySym sym;
if (code) {
if (xext_xkb_supported)
sym = XkbKeycodeToKeysym(display, code, 0, column);
else
sym = XKeycodeToKeysym(display, code, column);
sym = W_KeycodeToKeysym(display, code, column);
} else {
sym = NoSymbol;
}
+1
View File
@@ -15,6 +15,7 @@ dist_xpmdata_DATA = \
ergonomic.xpm \
expert.xpm \
fonts.xpm \
hotcorners.xpm \
iconprefs.xpm \
keyboard.xpm \
keyboardprefs.xpm \
+137
View File
@@ -0,0 +1,137 @@
/* XPM */
static char * hotcorners_xpm[] = {
"48 48 86 1",
" c #2C2C2C",
". c #FEFEFE",
"+ c #505075",
"@ c #4E4E74",
"# c #515176",
"$ c #4B4B72",
"% c #494971",
"& c #515175",
"* c #4F4F74",
"= c #4C4C73",
"- c #696984",
"; c #545477",
"> c #5E5E7D",
", c #676783",
"' c #58587A",
") c #5B5B7C",
"! c #B1B1BB",
"~ c #A5A5B1",
"{ c #A1A1AE",
"] c #AEAEB9",
"^ c #79798F",
"/ c #5C5C7C",
"( c #D5D5DA",
"_ c #E6E6E9",
": c #E8E8EB",
"< c #EDEDEF",
"[ c #E7E7EA",
"} c #FDFDFD",
"| c #FFFFFF",
"1 c #EBEBEC",
"2 c #7F7F93",
"3 c #484871",
"4 c #7B7B85",
"5 c #EFEFEF",
"6 c #A6A6A6",
"7 c #292959",
"8 c #464670",
"9 c #8C8C96",
"0 c #F4F4F4",
"a c #F5F5F6",
"b c #F2F2F2",
"c c #9797A6",
"d c #474770",
"e c #4D4D73",
"f c #9393A3",
"g c #F4F4F5",
"h c #F3F3F3",
"i c #EBEBEE",
"j c #6D6D87",
"k c #9D9DAB",
"l c #F9F9F9",
"m c #F1F1F1",
"n c #A5A5A5",
"o c #EAEAEA",
"p c #6A6A86",
"q c #D3D3D6",
"r c #717171",
"s c #848484",
"t c #9F9FA3",
"u c #47476F",
"v c #323256",
"w c #9B9B9A",
"x c #888889",
"y c #000012",
"z c #6B6B6D",
"A c #757587",
"B c #46466D",
"C c #3B3B47",
"D c #2E2E50",
"E c #242447",
"F c #838383",
"G c #919191",
"H c #202041",
"I c #4F4F73",
"J c #4E4E72",
"K c #232343",
"L c #4F4F4F",
"M c #252548",
"N c #505074",
"O c #3A3A57",
"P c #404060",
"Q c #505076",
"R c #49496B",
"S c #31314E",
"T c #2F2F49",
"U c #434362",
" .",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++@#$%&*=+++++++++++++++++++++++++++%-;>,')@++.",
" ++)!~{]]^@++++++++++++++++++++++++++/(_:<[!#++.",
" ++'[.}|12*++++++++++++++++++++++++++345||.~$++.",
" ++,<||}67+++++++++++++++++++++++++++890||}{%++a",
" ++>:|||bcd+++++++++++++++++++++++++efg||}|]&++.",
" ++;_5h||ij+++++++++++++++++++++++++@kl|mno]*++.",
" ++pqrshltu++++++++++++++++++++++++++vwoxyzAe++.",
" ++BCDEFGHI++++++++++++++++++++++++++JKLMNOP+++.",
" ++QR+*STJ++++++++++++++++++++++++++++JU*++++++.",
" +++++++*++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++QR+*STJ++++++++++++++++++++++++++++JTS*+RQ++.",
" ++BCDEFGHI++++++++++++++++++++++++++IHGFEDCB++.",
" ++pqrshltu++++++++++++++++++++++++++utlhsrqp++.",
" ++;_5h||ij++++++++++++++++++++++++++ji||h5_;++.",
" ++>:|||bcd++++++++++++++++++++++++++dcb|||:>++.",
" ++,<||}67++++++++++++++++++++++++++++76}||<,++.",
" ++'[.}|12*++++++++++++++++++++++++++*21|}.['++.",
" ++)!~{]]^@++++++++++++++++++++++++++@^]]{~!)++.",
" ++@#$%&*=++++++++++++++++++++++++++++=*&%$#@++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
" ++++++++++++++++++++++++++++++++++++++++++++++.",
"................................................"};
+16 -16
View File
@@ -2,9 +2,9 @@
static char *magick[] = {
/* columns rows colors chars-per-pixel */
"50 40 95 2",
" c Gray0",
" c #000000",
". c #010101",
"X c Gray2",
"X c #050505",
"o c #040406",
"O c #070707",
"+ c #0a0a0d",
@@ -20,14 +20,14 @@ static char *magick[] = {
": c #4e4e4e",
"> c #505055",
", c #585858",
"< c Gray37",
"< c #5e5e5e",
"1 c #494d62",
"2 c #545066",
"3 c #57556f",
"4 c #5d627c",
"5 c #604e42",
"6 c Gray39",
"7 c Gray41",
"6 c #636363",
"7 c #696969",
"8 c #646475",
"9 c #7e6a63",
"0 c #75746d",
@@ -67,36 +67,36 @@ static char *magick[] = {
"D c #989799",
"F c #9b9b9b",
"G c #999e98",
"H c Gray62",
"H c #9e9e9e",
"J c #9e9f9f",
"K c #8d8cba",
"L c #9995a0",
"P c #a2a2a3",
"I c #a7a7a8",
"U c Gray66",
"U c #a8a8a8",
"Y c #acacac",
"T c Gray68",
"R c Gray69",
"T c #adadad",
"R c #b0b0b0",
"E c #b2b2b2",
"W c #b4b4b4",
"Q c Gray71",
"Q c #b5b5b5",
"! c #b9b9b9",
"~ c Gray73",
"~ c #bababa",
"^ c #bbbbbb",
"/ c #a7a7c5",
"( c #acadcf",
") c #c0c0c0",
"_ c #c3c3c3",
"` c #c8c8c8",
"' c Gray79",
"] c Gray80",
"' c #c9c9c9",
"] c #cccccc",
"[ c #dfdfdf",
"{ c #e2e2e2",
"} c Gray91",
"} c #e8e8e8",
"| c #e9e9e9",
" . c Gray95",
" . c #f2f2f2",
".. c #fbfbfb",
"X. c Gray100",
"X. c #ffffff",
/* pixels */
"$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ } ",
"$ 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 } } } } } } } } ",
+8 -4
View File
@@ -171,10 +171,10 @@
RHMaximizeKey = None;
THMaximizeKey = None;
BHMaximizeKey = None;
LTCMaximizeKey = None;
RTCMaximizeKey = None;
LBCMaximizeKey = None;
RBCMaximizeKey = None;
TLCMaximizeKey = None;
TRCMaximizeKey = None;
BLCMaximizeKey = None;
BRCMaximizeKey = None;
MaximusKey = None;
KeepOnTopKey = None;
KeepAtBottomKey = None;
@@ -232,6 +232,10 @@
WindowRelaunchKey = None;
ScreenSwitchKey = None;
RunKey = None;
ExitKey = None;
ScreenCaptureKey = Print;
WindowCaptureKey = None;
PartialCaptureKey = None;
NormalCursor = (builtin, left_ptr);
ArrowCursor = (builtin, top_left_arrow);
MoveCursor = (builtin, fleur);
+3 -3
View File
@@ -6,9 +6,9 @@ static char *magick[] = {
". c #ededee",
"X c #e7e7e7",
"o c #e2e2e2",
"O c gray87",
"+ c gray85",
"@ c gray76",
"O c #dedede",
"+ c #d9d9d9",
"@ c #c2c2c2",
"# c #010101",
"$ c #4d505a",
"% c #e0e0e6",
+21 -10
View File
@@ -2,7 +2,7 @@ dnl ============================================================================
dnl
dnl Window Maker autoconf input
dnl
AC_COPYRIGHT([Copyright (c) 2001-2015 The Window Maker Team])
AC_COPYRIGHT([Copyright (c) 2001-2023 The Window Maker Team])
dnl
dnl ============================================================================
dnl
@@ -34,7 +34,7 @@ AC_PREREQ([2.69])
dnl Configuration for Autoconf and Automake
dnl =======================================
AC_INIT([WindowMaker],[0.95.9],[wmaker-dev@googlegroups.com],[WindowMaker],[http://www.windowmaker.org/])
AC_INIT([WindowMaker],[0.96.0],[wmaker-dev@googlegroups.com],[WindowMaker],[http://www.windowmaker.org/])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
@@ -71,16 +71,16 @@ dnl 6. If any interfaces have been removed or changed since the last
dnl public release, then set age to 0.
dnl
dnl libwraster
WRASTER_CURRENT=6
WRASTER_CURRENT=7
WRASTER_REVISION=0
WRASTER_AGE=0
WRASTER_AGE=1
WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
AC_SUBST(WRASTER_VERSION)
dnl
dnl libWINGs
WINGS_CURRENT=4
WINGS_CURRENT=5
WINGS_REVISION=0
WINGS_AGE=1
WINGS_AGE=2
WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
AC_SUBST(WINGS_VERSION)
dnl
@@ -270,8 +270,8 @@ supported_gfx=""
dnl Platform-specific Makefile setup
dnl ================================
AS_CASE(["$host"],
[*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
[*-*-freebsd*|*-k*bsd-gnu*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
[*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700"],
[*-*-freebsd*|*-k*bsd-gnu*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700 -DFREEBSD"],
[*-*-netbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
[*-*-openbsd*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
[*-*-dragonfly*], [WM_OSDEP="bsd" ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
@@ -387,7 +387,7 @@ AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
WM_FUNC_SECURE_GETENV
AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
setsid mallinfo mkstemp sysconf)
setsid mallinfo2 mkstemp sysconf)
AC_SEARCH_LIBS([strerror], [cposix])
dnl nanosleep is generally available in standard libc, although not always the
@@ -455,7 +455,6 @@ AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])]
dnl Checks for header files
dnl =======================
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
string.h strings.h)
@@ -580,6 +579,18 @@ AS_IF([test "x$enable_wmreplace" = "xyes"],
[define to support ICCCM protocol for window manager replacement])
supported_xext="$supported_xext WMReplace"])
dnl XRes support
dnl ==============
m4_divert_push([INIT_PREPARE])dnl
AC_ARG_ENABLE([res],
[AS_HELP_STRING([--disable-res], [disable resource window extension support])],
[AS_CASE(["$enableval"],
[yes|no], [],
[AC_MSG_ERROR([bad value $enableval for --enable-res]) ]) ],
[enable_res=auto])
m4_divert_pop([INIT_PREPARE])dnl
WM_XEXT_CHECK_XRES
dnl XShape support
dnl ==============
+4
View File
@@ -551,6 +551,10 @@ Disable use of the @emph{MIT shared memory} extension.
This will slow down texture generation a little bit, but in some cases it seems to be necessary due
to a bug that manifests as messed icons and textures.
@item --disable-res
Disables support for @emph{XRes} resource window extension support.
Which is used to find the underlying processes (and PIDs) displaying the windows.
@item --disable-shape
Disables support for @emph{shaped} windows (for @command{oclock}, @command{xeyes}, etc.).
+8 -8
View File
@@ -80,14 +80,14 @@ AS_VAR_PUSHDEF([VAR],[ax_cv_cflags_gcc_option_$2])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
VAR,[VAR="no, unknown"
AC_LANG_SAVE
AC_LANG_C
AC_LANG(C)
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
@@ -116,14 +116,14 @@ AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_gcc_option_$2])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
VAR,[VAR="no, unknown"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_LANG(C++)
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
@@ -151,14 +151,14 @@ AS_VAR_PUSHDEF([VAR],[ax_cv_cflags_gcc_option_$1])dnl
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
VAR,[VAR="no, unknown"
AC_LANG_SAVE
AC_LANG_C
AC_LANG(C)
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
@@ -187,14 +187,14 @@ AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_gcc_option_$1])dnl
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
VAR,[VAR="no, unknown"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_LANG(C++)
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_TRY_COMPILE([],[return 0;],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
+3 -2
View File
@@ -47,14 +47,15 @@ AC_DEFUN([WM_CHECK_XFT_VERSION],
AC_CACHE_CHECK([whether libXft is at least version $1], [ac_cv_lib_xft_version_ok],
[CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $XFT_CFLAGS $inc_search_path"
AC_TRY_LINK([
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
], [
#if !defined(XFT_VERSION) || XFT_VERSION < ]XFT_REQUIRED_VERSION[
#error libXft on this system is too old. Consider upgrading to at least $1
#endif
], [ac_cv_lib_xft_version_ok=yes], [ac_cv_lib_xft_version_ok=no])
])], [ac_cv_lib_xft_version_ok=yes], [ac_cv_lib_xft_version_ok=no])
CPPFLAGS="$CPPFLAGS_save"])
m4_undefine([XFT_REQUIRED_VERSION])dnl
AS_IF([test "x$ac_cv_lib_xft_version_ok" != "xyes"], [$3], [$2])dnl
+1 -1
View File
@@ -1,7 +1,7 @@
# wm_i18n.m4 - Macros to check and enable translations in WindowMaker
#
# Copyright (c) 2014-2015 Christophe CURIS
# Copyright (c) 2015 The Window Maker Tean
# Copyright (c) 2015-2021 The Window Maker Tean
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+3 -3
View File
@@ -198,9 +198,9 @@ AC_DEFUN_ONCE([WM_IMGFMT_CHECK_WEBP],
dnl a symbol without first using the header to handle it
wm_save_LIBS="$LIBS"
LIBS="$LIBS -lwebp"
AC_TRY_LINK(
[@%:@include <webp/decode.h>],
[WebPGetFeatures(NULL, 1024, NULL);],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([@%:@include <webp/decode.h>],
[WebPGetFeatures(NULL, 1024, NULL);])],
[wm_cv_imgfmt_webp="-lwebp"])
LIBS="$wm_save_LIBS"
AS_IF([test "x$enable_webp$wm_cv_imgfmt_webp" = "xyesno"],
+1 -1
View File
@@ -1,6 +1,6 @@
# wm_libexif.m4 - Macros to check proper libexif
#
# Copyright (c) 2014 Window Maker Team
# Copyright (c) 2014-2015 Window Maker Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+27
View File
@@ -16,6 +16,33 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# WM_XEXT_CHECK_XRES
# --------------------
#
# Check for the X Resource Window extension
# The check depends on variable 'enable_xshape' being either:
# yes - detect, fail if not found
# no - do not detect, disable support
# auto - detect, disable if not found
#
# When found, append appropriate stuff in XLIBS, and append info to
# the variable 'supported_xext'
# When not found, append info to variable 'unsupported'
AC_DEFUN_ONCE([WM_XEXT_CHECK_XRES],
[WM_LIB_CHECK([XRes], [-lXRes], [XResQueryClientIds], [$XLIBS],
[wm_save_CFLAGS="$CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
@%:@include <X11/extensions/XRes.h>
], [dnl
XResQueryClientIds(NULL, 0, NULL, NULL, NULL);])]
[],
[AC_MSG_ERROR([found $CACHEVAR but cannot compile using XRes header])])
CFLAGS="$wm_save_CFLAGS"],
[supported_xext], [XLIBS], [enable_res], [-])dnl
]) dnl AC_DEFUN
# WM_XEXT_CHECK_XSHAPE
# --------------------
#
+1 -1
View File
@@ -1,5 +1,5 @@
# Translation into Western Frisian for Window Maker
# Copyright (C) 2015-2016 Window Maker Developers Team
# Copyright (C) 2015-2020 Window Maker Developers Team
# This file is distributed under the same license as the windowmaker package.
# Original by Alwin <translations@ziggo.nl>, 2015.
#
+1 -1
View File
@@ -1,5 +1,5 @@
# New translation into Dutch for Window Maker
# Copyright (C) 2014-2016 Window Maker Developers Team
# Copyright (C) 2014-2020 Window Maker Developers Team
# This file is distributed under the same license as the windowmaker package.
# Original by Alwin <translations@ziggo.nl>, 2014.
#
+13 -6
View File
@@ -4,7 +4,7 @@
# Window Maker window manager
#
# Copyright (c) 2014 Christophe CURIS
# Copyright (c) 2014 Window Maker Team
# Copyright (c) 2014-2015 Window Maker Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -77,10 +77,8 @@ while [ $# -gt 0 ]; do
-v)
shift
# Version may be 'x:y:z', we keep only 'x'
version="`echo "$1" | sed -e 's,:.*$,,' `"
# the version should only be a number
echo "$version" | grep '^[1-9][0-9]*$' > /dev/null || \
version="$1"
echo "$version" | grep -E '^[1-9][0-9]*(:[0-9]+(:[0-9]+)?)?$' > /dev/null || \
arg_error "version \"$1\" is not valid"
;;
@@ -109,9 +107,18 @@ fi
# generate the rest of the script so that other symbols will not be kept.
awk '
BEGIN {
# Version number here uses only 1 number from the full version used in libtool
libversion="'"$version"'";
if (split(libversion, subversions, ":") > 1) {
# Calculate [CURRENT - AGE], the goal is that the number will not
# change when functions are added to the API, but it will be incremented
# when functions are removed or argument change (which breaks compat)
libversion = subversions[1] - subversions[3];
}
print "/* Generated version-script for ld */";
print "";
print "'"$libname$version"'";
print "'"$libname"'" libversion;
print "{";
print " global:";
}
+1 -1
View File
@@ -4,7 +4,7 @@
# Window Maker window manager
#
# Copyright (c) 2014-2015 Christophe CURIS
# Copyright (c) 2015 Window Maker Team
# Copyright (c) 2015-2019 Window Maker Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+7 -1
View File
@@ -2,7 +2,7 @@
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -119,6 +119,7 @@ typedef enum {
WCUR_QUESTION,
WCUR_TEXT,
WCUR_SELECT,
WCUR_CAPTURE,
WCUR_ROOT,
WCUR_EMPTY,
@@ -473,6 +474,11 @@ extern struct WPreferences {
char show_clip_title;
char hot_corners; /* let corners execute actions */
int hot_corner_delay; /* Delay after which the hot corner is triggered */
int hot_corner_edge; /* Hot corner edge size */
char *hot_corner_actions[4]; /* Action of each corner */
struct {
#ifdef USE_ICCCM_WMREPLACE
unsigned int replace:1; /* replace existing window manager */
+96 -7
View File
@@ -4,7 +4,7 @@
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 1998-2003 Dan Pascu
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -404,7 +404,7 @@ void wMaximizeWindow(WWindow *wwin, int directions, int head)
usableArea = wGetUsableAreaForHead(scr, head, &totalArea, True);
/* Only save directions, not kbd or xinerama hints */
directions &= (MAX_HORIZONTAL | MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS);
directions &= (MAX_HORIZONTAL | MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS | MAX_CENTRAL);
if (WFLAGP(wwin, full_maximize))
usableArea = totalArea;
@@ -431,12 +431,31 @@ void wMaximizeWindow(WWindow *wwin, int directions, int head)
wwin->maximus_y = new_y;
wwin->flags.old_maximized |= MAX_MAXIMUS;
} else {
/* center the window if can fit, if not sticking it to the screen edges */
if (directions & MAX_CENTRAL) {
if (wwin->frame->core->height > (usableArea.y2 - usableArea.y1)) {
new_y = usableArea.y1;
new_height = usableArea.y2 - usableArea.y1 - adj_size;
} else {
new_height = (wwin->old_geometry.height) ? wwin->old_geometry.height : wwin->frame->core->height;
new_height += wwin->frame->top_width + wwin->frame->bottom_width;
new_y = half_scr_height - new_height / 2;
}
if (wwin->frame->core->width > (usableArea.x2 - usableArea.x1)) {
new_x = usableArea.x1;
new_width = usableArea.x2 - usableArea.x1 - adj_size;
}
else {
new_width = (wwin->old_geometry.width) ? wwin->old_geometry.width : wwin->frame->core->width;
new_x = half_scr_width - new_width / 2;
}
}
/* set default values if no option set then */
if (!(directions & (MAX_HORIZONTAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS))) {
if (!(directions & (MAX_HORIZONTAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS | MAX_CENTRAL))) {
new_width = (wwin->old_geometry.width) ? wwin->old_geometry.width : wwin->frame->core->width;
new_x = (wwin->old_geometry.x) ? wwin->old_geometry.x : wwin->frame_x;
}
if (!(directions & (MAX_VERTICAL | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS))) {
if (!(directions & (MAX_VERTICAL | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS| MAX_CENTRAL))) {
new_height = (wwin->old_geometry.height) ? wwin->old_geometry.height : wwin->frame->core->height;
new_y = (wwin->old_geometry.y) ? wwin->old_geometry.y : wwin->frame_y;
}
@@ -445,17 +464,26 @@ void wMaximizeWindow(WWindow *wwin, int directions, int head)
if (directions & MAX_LEFTHALF) {
new_width = half_scr_width - adj_size;
new_x = usableArea.x1;
if (directions & MAX_CENTRAL) {
new_y = half_scr_height - wwin->old_geometry.height / 2;
}
} else if (directions & MAX_RIGHTHALF) {
new_width = half_scr_width - adj_size;
new_x = usableArea.x1 + half_scr_width;
if (directions & MAX_CENTRAL)
new_y = half_scr_height - wwin->old_geometry.height / 2;
}
/* top|bottom position */
if (directions & MAX_TOPHALF) {
new_height = half_scr_height - adj_size;
new_y = usableArea.y1;
if (directions & MAX_CENTRAL)
new_x = half_scr_width - wwin->old_geometry.width / 2;
} else if (directions & MAX_BOTTOMHALF) {
new_height = half_scr_height - adj_size;
new_y = usableArea.y1 + half_scr_height;
if (directions & MAX_CENTRAL)
new_x = half_scr_width - wwin->old_geometry.width / 2;
}
/* vertical|horizontal position */
@@ -494,7 +522,7 @@ void wMaximizeWindow(WWindow *wwin, int directions, int head)
void handleMaximize(WWindow *wwin, int directions)
{
int current = wwin->flags.maximized;
int requested = directions & (MAX_HORIZONTAL | MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS);
int requested = directions & (MAX_HORIZONTAL | MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS | MAX_CENTRAL);
int effective = requested ^ current;
int flags = directions & ~requested;
int head = wGetHeadForWindow(wwin);
@@ -625,11 +653,24 @@ void handleMaximize(WWindow *wwin, int directions)
head);
else {
if ((requested == (MAX_HORIZONTAL | MAX_VERTICAL)) ||
(requested == MAX_MAXIMUS))
effective = requested;
else {
if (requested & MAX_LEFTHALF) {
if (requested & MAX_CENTRAL) {
effective |= MAX_CENTRAL;
if (current & (MAX_HORIZONTAL | MAX_VERTICAL))
effective &= ~(MAX_HORIZONTAL | MAX_VERTICAL);
else if (current & MAX_TOPHALF && current & MAX_LEFTHALF)
effective &= ~(MAX_TOPHALF | MAX_LEFTHALF);
else if (current & MAX_TOPHALF && current & MAX_RIGHTHALF)
effective &= ~(MAX_TOPHALF | MAX_RIGHTHALF);
else if (current & MAX_BOTTOMHALF && current & MAX_LEFTHALF)
effective &= ~(MAX_BOTTOMHALF | MAX_LEFTHALF);
else if (current & MAX_BOTTOMHALF && current & MAX_RIGHTHALF)
effective &= ~(MAX_BOTTOMHALF | MAX_RIGHTHALF);
} else if (requested & MAX_LEFTHALF) {
if (!(requested & (MAX_TOPHALF | MAX_BOTTOMHALF)))
effective |= MAX_VERTICAL;
else
@@ -912,6 +953,54 @@ void wUnmaximizeWindow(WWindow *wwin)
WMPostNotificationName(WMNChangedState, wwin, "maximize");
}
#ifdef USE_XINERAMA
void wFullscreenMonitorsWindow(WWindow *wwin, unsigned long top, unsigned long bottom,
unsigned long left, unsigned long right)
{
int i;
long monitor;
WMRect rect1, rect2;
if ((int)top < wwin->screen_ptr->xine_info.count &&
(int)bottom < wwin->screen_ptr->xine_info.count &&
(int)left < wwin->screen_ptr->xine_info.count &&
(int)right < wwin->screen_ptr->xine_info.count) {
wwin->flags.fullscreen_monitors[0] = top;
wwin->flags.fullscreen_monitors[1] = bottom;
wwin->flags.fullscreen_monitors[2] = left;
wwin->flags.fullscreen_monitors[3] = right;
} else {
wwin->flags.fullscreen_monitors[0] = -1;
return;
}
wwin->flags.fullscreen = True;
wWindowConfigureBorders(wwin);
ChangeStackingLevel(wwin->frame->core, WMFullscreenLevel);
wwin->bfs_geometry.x = wwin->frame_x;
wwin->bfs_geometry.y = wwin->frame_y;
wwin->bfs_geometry.width = wwin->frame->core->width;
wwin->bfs_geometry.height = wwin->frame->core->height;
i = 0;
monitor = wwin->flags.fullscreen_monitors[i];
rect1 = wwin->screen_ptr->xine_info.screens[monitor];
for (i = 1; i <= 3; i++) {
monitor = wwin->flags.fullscreen_monitors[i];
rect2 = wwin->screen_ptr->xine_info.screens[monitor];
wGetRectUnion(&rect1, &rect2, &rect1);
}
wWindowConfigure(wwin, rect1.pos.x, rect1.pos.y, rect1.size.width, rect1.size.height);
wwin->screen_ptr->bfs_focused_window = wwin->screen_ptr->focused_window;
wSetFocusTo(wwin->screen_ptr, wwin);
WMPostNotificationName(WMNChangedState, wwin, "fullscreen");
}
#endif
void wFullscreenWindow(WWindow *wwin)
{
int head;
@@ -2167,7 +2256,7 @@ void wMakeWindowVisible(WWindow *wwin)
}
}
void movePionterToWindowCenter(WWindow *wwin)
void movePointerToWindowCenter(WWindow *wwin)
{
if (!wPreferences.pointer_with_half_max_windows)
return;
+7 -3
View File
@@ -30,8 +30,9 @@
#define MAX_TOPHALF (1 << 4)
#define MAX_BOTTOMHALF (1 << 5)
#define MAX_MAXIMUS (1 << 6)
#define MAX_IGNORE_XINERAMA (1 << 7)
#define MAX_KEYBOARD (1 << 8)
#define MAX_CENTRAL (1 << 7)
#define MAX_IGNORE_XINERAMA (1 << 8)
#define MAX_KEYBOARD (1 << 9)
#define SAVE_GEOMETRY_X (1 << 0)
#define SAVE_GEOMETRY_Y (1 << 1)
@@ -75,13 +76,16 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll);
void wMakeWindowVisible(WWindow *wwin);
void wFullscreenMonitorsWindow(WWindow *wwin, unsigned long top, unsigned long bottom,
unsigned long left, unsigned long right);
void wFullscreenWindow(WWindow *wwin);
void wUnfullscreenWindow(WWindow *wwin);
void animateResize(WScreen *scr, int x, int y, int w, int h, int fx, int fy, int fw, int fh);
void update_saved_geometry(WWindow *wwin);
void movePionterToWindowCenter(WWindow *wwin);
void movePointerToWindowCenter(WWindow *wwin);
void moveBetweenHeads(WWindow *wwin, int direction);
#endif
+1 -1
View File
@@ -2,7 +2,7 @@
* Window Maker window manager
*
* Copyright (c) 1998-2003 Alfredo K. Kojima
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2016 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+3 -2
View File
@@ -240,10 +240,11 @@ void wClientConfigure(WWindow * wwin, XConfigureRequestEvent * xcre)
return;
if (nwidth != wwin->old_geometry.width)
wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS);
wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS | MAX_CENTRAL);
if (nheight != wwin->old_geometry.height)
wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS | MAX_CENTRAL);
wWindowConstrainSize(wwin, (unsigned int *)&nwidth, (unsigned int *)&nheight);
wWindowConfigure(wwin, nx, ny, nwidth, nheight);
wwin->old_geometry.x = nx;
wwin->old_geometry.y = ny;
+49
View File
@@ -25,7 +25,56 @@ static unsigned char MENU_SHADE_INDICATOR_XBM_DATA[] = {
0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
#define MENU_SNAP_INDICATOR_W_XBM_SIZE 10
#define MENU_SNAP_INDICATOR_H_XBM_SIZE 9
static unsigned char MENU_SNAP_V_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x1d, 0x02, 0x1d, 0x02, 0x1d, 0x02, 0x1d, 0x02, 0x1d, 0x02,
0x1d, 0x02, 0x1d, 0x02, 0xff, 0x03 };
static unsigned char MENU_SNAP_H_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x01, 0x02, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0x01, 0x02,
0x01, 0x02, 0x01, 0x02, 0xff, 0x03 };
static unsigned char MENU_CENTRAL_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x01, 0x02, 0x79, 0x02, 0x79, 0x02, 0x79, 0x02, 0x79, 0x02,
0x79, 0x02, 0x01, 0x02, 0xff, 0x03 };
static unsigned char MENU_SNAP_RH_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x01, 0x02, 0xe1, 0x02, 0xe1, 0x02, 0xe1, 0x02, 0xe1, 0x02,
0xe1, 0x02, 0x01, 0x02, 0xff, 0x03 };
static unsigned char MENU_SNAP_LH_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x01, 0x02, 0x1d, 0x02, 0x1d, 0x02, 0x1d, 0x02, 0x1d, 0x02,
0x1d, 0x02, 0x01, 0x02, 0xff, 0x03 };
static unsigned char MENU_SNAP_TH_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x01, 0x02, 0xfd, 0x02, 0xfd, 0x02, 0xfd, 0x02, 0x01, 0x02,
0x01, 0x02, 0x01, 0x02, 0xff, 0x03 };
static unsigned char MENU_SNAP_BH_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0xfd, 0x02, 0xfd, 0x02,
0xfd, 0x02, 0x01, 0x02, 0xff, 0x03 };
static unsigned char MENU_SNAP_TL_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x1f, 0x02, 0x1f, 0x02, 0x1f, 0x02, 0x01, 0x02, 0x01, 0x02,
0x01, 0x02, 0x01, 0x02, 0xff, 0x03 };
static unsigned char MENU_SNAP_TR_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0xe1, 0x03, 0xe1, 0x03, 0xe1, 0x03, 0x01, 0x02, 0x01, 0x02,
0x01, 0x02, 0x01, 0x02, 0xff, 0x03 };
static unsigned char MENU_SNAP_BL_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x1f, 0x02,
0x1f, 0x02, 0x1f, 0x02, 0xff, 0x03 };
static unsigned char MENU_SNAP_BR_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0xe1, 0x03,
0xe1, 0x03, 0xe1, 0x03, 0xff, 0x03 };
static unsigned char MENU_SNAP_TILED_INDICATOR_XBM_DATA[] = {
0xff, 0x03, 0x1f, 0x02, 0x1f, 0x02, 0x1f, 0x02, 0x1f, 0x02, 0x1f, 0x02,
0xdf, 0x03, 0xdf, 0x03, 0xff, 0x03 };
/* button pixmaps */
/* the first one is for normal state, the second is for when
+64 -6
View File
@@ -4,7 +4,7 @@
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 1998-2003 Dan Pascu
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
@@ -151,10 +151,11 @@ static WDECallbackUpdate setSwPOptions;
static WDECallbackUpdate updateUsableArea;
static WDECallbackUpdate setModifierKeyLabels;
static WDECallbackUpdate setHotCornerActions;
static WDECallbackConvert getCursor;
static WDECallbackUpdate setCursor;
static WDECallbackUpdate updateDock ;
static WDECallbackUpdate updateDock;
/*
* Tables to convert strings to enumeration values.
@@ -525,6 +526,14 @@ WDefaultEntry optionList[] = {
{"KeepDockOnPrimaryHead", "NO", NULL,
&wPreferences.keep_dock_on_primary_head, getBool, updateDock,
NULL, NULL},
{"HotCorners", "NO", NULL,
&wPreferences.hot_corners, getBool, NULL, NULL, NULL},
{"HotCornerDelay", "250", (void *)&wPreferences.hot_corner_delay,
&wPreferences.hot_corner_delay, getInt, NULL, NULL, NULL},
{"HotCornerEdge", "2", (void *)&wPreferences.hot_corner_edge,
&wPreferences.hot_corner_edge, getInt, NULL, NULL, NULL},
{"HotCornerActions", "(\"None\", \"None\", \"None\", \"None\")", &wPreferences,
NULL, getPropList, setHotCornerActions, NULL, NULL},
/* style options */
@@ -662,16 +671,18 @@ WDefaultEntry optionList[] = {
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE,
{"TLCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE,
{"TRCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE,
{"BLCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE,
{"BRCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"MaximusKey", "None", (void*)WKBD_MAXIMUS,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"CenterKey", "None", (void *)WKBD_CENTRAL,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"KeepOnTopKey", "None", (void *)WKBD_KEEP_ON_TOP,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"KeepAtBottomKey", "None", (void *)WKBD_KEEP_AT_BOTTOM,
@@ -788,6 +799,14 @@ WDefaultEntry optionList[] = {
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"RunKey", "None", (void *)WKBD_RUN,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"ExitKey", "None", (void *)WKBD_EXIT,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"ScreenCaptureKey", "None", (void *)WKBD_PRINTS,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"WindowCaptureKey", "None", (void *)WKBD_PRINTW,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"PartialCaptureKey", "None", (void *)WKBD_PRINTP,
NULL, getKeybind, setKeyGrab, NULL, NULL},
#ifdef KEEP_XKB_LOCK_STATUS
{"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE,
@@ -824,6 +843,8 @@ WDefaultEntry optionList[] = {
NULL, getCursor, setCursor, NULL, NULL},
{"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT,
NULL, getCursor, setCursor, NULL, NULL},
{"CaptureCursor", "(builtin, crosshair)", (void *)WCUR_CAPTURE,
NULL, getCursor, setCursor, NULL, NULL},
{"DialogHistoryLines", "500", NULL,
&wPreferences.history_lines, getInt, NULL, NULL, NULL},
{"CycleActiveHeadOnly", "NO", NULL,
@@ -3451,6 +3472,43 @@ static int setModifierKeyLabels(WScreen * scr, WDefaultEntry * entry, void *tdat
return 0;
}
static int setHotCornerActions(WScreen * scr, WDefaultEntry * entry, void *tdata, void *foo)
{
WMPropList *array = tdata;
int i;
struct WPreferences *prefs = foo;
if (!WMIsPLArray(array) || WMGetPropListItemCount(array) != 4) {
wwarning(_("Value for option \"%s\" must be an array of 4 strings"), entry->key);
WMReleasePropList(array);
return 0;
}
DestroyWindowMenu(scr);
for (i = 0; i < 4; i++) {
if (prefs->hot_corner_actions[i])
wfree(prefs->hot_corner_actions[i]);
if (WMIsPLString(WMGetFromPLArray(array, i))) {
const char *val;
val = WMGetFromPLString(WMGetFromPLArray(array, i));
if (strcasecmp(val, "NONE") != 0)
prefs->hot_corner_actions[i] = wstrdup(val);
else
prefs->hot_corner_actions[i] = NULL;
} else {
wwarning(_("Invalid argument for option \"%s\" item %d"), entry->key, i);
prefs->hot_corner_actions[i] = NULL;
}
}
WMReleasePropList(array);
return 0;
}
static int setDoubleClick(WScreen *scr, WDefaultEntry *entry, void *tdata, void *foo)
{
int *value = tdata;
+113 -20
View File
@@ -4,7 +4,7 @@
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 1998-2003 Dan Pascu
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,6 +36,8 @@
#include <dirent.h>
#include <limits.h>
#include <errno.h>
#include <time.h>
#include <sys/utsname.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
@@ -1101,14 +1103,16 @@ Bool wIconChooserDialog(WScreen *scr, char **file, const char *instance, const c
} else {
defaultPath = FindImage(wPreferences.icon_path, *file);
wantedPath = WMGetTextFieldText(panel->fileField);
/* if the file is not the default, use full path */
if (strcmp(wantedPath, defaultPath) != 0) {
*file = wantedPath;
} else {
*file = wstrdup(*file);
wfree(wantedPath);
if (defaultPath) {
/* if the file is not the default, use full path */
if (strcmp(wantedPath, defaultPath) != 0) {
*file = wstrdup(wantedPath);
} else {
*file = wstrdup(*file);
}
wfree(defaultPath);
}
wfree(defaultPath);
wfree(wantedPath);
}
} else {
*file = NULL;
@@ -1153,7 +1157,7 @@ typedef struct {
#define COPYRIGHT_TEXT \
"Copyright \xc2\xa9 1997-2006 Alfredo K. Kojima\n"\
"Copyright \xc2\xa9 1998-2006 Dan Pascu\n"\
"Copyright \xc2\xa9 2013-2020 Window Maker Developers Team"
"Copyright \xc2\xa9 2013-%hu Window Maker Developers Team"
static InfoPanel *infoPanel = NULL;
@@ -1171,6 +1175,57 @@ static void destroyInfoPanel(WCoreWindow *foo, void *data, XEvent *event)
infoPanel = NULL;
}
char *getPrettyOSName(void)
{
char line[200];
char *token;
char *posn = NULL;
const char s[2] = "=";
FILE *fp;
fp = fopen("/etc/os-release", "r");
if (!fp) {
fp = fopen("/usr/lib/os-release", "r");
if (!fp) {
wwarning(_("no os-release file on the system"));
return NULL;
}
}
while (fgets(line, sizeof(line), fp) != NULL) {
if (strncmp(line, "PRETTY_NAME", strlen("PRETTY_NAME")) == 0) {
line[strcspn(line, "\r\n")] = 0;
token = strtok(line, s);
if (token) {
//get straight to the second part of the line
token = strtok(NULL, s);
if (token) {
//removing potential quotes
char *dst = token;
char *src = token;
char c;
while ((c = *src++) != '\0') {
if (c == '\\') {
*dst++ = c;
if ((c = *src++) == '\0')
break;
*dst++ = c;
} else if (c != '"' && c != '\'')
*dst++ = c;
}
*dst = '\0';
posn = wmalloc(strlen(token) + 1);
strcpy(posn, token);
}
}
break;
}
}
fclose(fp);
return posn;
}
void wShowInfoPanel(WScreen *scr)
{
InfoPanel *panel;
@@ -1194,6 +1249,17 @@ void wShowInfoPanel(WScreen *scr)
};
int wmScaleWidth, wmScaleHeight;
int pwidth, pheight;
int current_year = 2020;
time_t s;
struct tm *current_time;
struct utsname uts;
s = time(NULL);
if (s) {
current_time = localtime(&s);
if (current_time->tm_year > (current_year - 1900))
current_year = current_time->tm_year + 1900;
}
if (infoPanel) {
if (infoPanel->scr == scr) {
@@ -1209,8 +1275,12 @@ void wShowInfoPanel(WScreen *scr)
panel->win = WMCreateWindow(scr->wmscreen, "info");
WMGetScaleBaseFromSystemFont(scr->wmscreen, &wmScaleWidth, &wmScaleHeight);
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2) && defined(DEBUG)
pwidth = WMScaleX(412);
#else
pwidth = WMScaleX(382);
pheight = WMScaleY(250);
#endif
pheight = WMScaleY(270);
WMResizeWidget(panel->win, pwidth, pheight);
logo = WMCreateApplicationIconBlendedPixmap(scr->wmscreen, (RColor *) NULL);
@@ -1274,9 +1344,11 @@ void wShowInfoPanel(WScreen *scr)
panel->copyrL = WMCreateLabel(panel->win);
WMResizeWidget(panel->copyrL, WMScaleX(360), WMScaleY(60));
WMMoveWidget(panel->copyrL, WMScaleX(15), WMScaleY(190));
WMMoveWidget(panel->copyrL, WMScaleX(15), WMScaleY(210));
WMSetLabelTextAlignment(panel->copyrL, WALeft);
WMSetLabelText(panel->copyrL, COPYRIGHT_TEXT);
snprintf(buffer, sizeof(buffer), COPYRIGHT_TEXT, current_year);
WMSetLabelText(panel->copyrL, buffer);
font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));
if (font) {
WMSetLabelFont(panel->copyrL, font);
@@ -1285,9 +1357,19 @@ void wShowInfoPanel(WScreen *scr)
}
strbuf = NULL;
if (uname(&uts) != -1) {
char *posn = getPrettyOSName();
if (posn) {
snprintf(buffer, sizeof(buffer), _("Running on: %s (%s)\n"), posn, uts.machine);
free(posn);
}
else
snprintf(buffer, sizeof(buffer), _("Running on: %s (%s)\n"), uts.sysname, uts.machine);
strbuf = wstrappend(strbuf, buffer);
}
snprintf(buffer, sizeof(buffer), _("Using visual 0x%x: %s %ibpp "),
(unsigned)scr->w_visual->visualid, visuals[scr->w_visual->class], scr->w_depth);
strbuf = wstrappend(strbuf, buffer);
switch (scr->w_depth) {
@@ -1301,20 +1383,24 @@ void wShowInfoPanel(WScreen *scr)
case 32:
strbuf = wstrappend(strbuf, _("(16 million colors)\n"));
break;
case 30:
case 40:
strbuf = wstrappend(strbuf, _("(1 billion colors)\n"));
break;
default:
snprintf(buffer, sizeof(buffer), _("(%d colors)\n"), 1 << scr->w_depth);
strbuf = wstrappend(strbuf, buffer);
break;
}
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2)
{
struct mallinfo ma = mallinfo();
struct mallinfo2 ma = mallinfo2();
snprintf(buffer, sizeof(buffer),
#ifdef DEBUG
_("Total memory allocated: %i kB (in use: %i kB, %d free chunks).\n"),
_("Total memory allocated: %lu kB (in use: %lu kB, %lu free chunks)\n"),
#else
_("Total memory allocated: %i kB (in use: %i kB).\n"),
_("Total memory allocated: %lu kB (in use: %lu kB)\n"),
#endif
(ma.arena + ma.hblkhd) / 1024,
(ma.uordblks + ma.hblkhd) / 1024
@@ -1353,6 +1439,10 @@ void wShowInfoPanel(WScreen *scr)
strbuf = wstrappend(strbuf, ", XDnD");
#endif
#ifdef USE_XRES
strbuf = wstrappend(strbuf, ", XRes");
#endif
#ifdef USE_MAGICK
strbuf = wstrappend(strbuf, ", ImageMagick");
#endif
@@ -1365,7 +1455,7 @@ void wShowInfoPanel(WScreen *scr)
strbuf = wstrappend(strbuf, _("Xinerama: "));
{
char tmp[128];
snprintf(tmp, sizeof(tmp) - 1, _("%d head(s) found."), scr->xine_info.count);
snprintf(tmp, sizeof(tmp) - 1, _("%d head(s) found"), scr->xine_info.count);
strbuf = wstrappend(strbuf, tmp);
}
#endif
@@ -1377,11 +1467,14 @@ void wShowInfoPanel(WScreen *scr)
strbuf = wstrappend(strbuf, _("supported"));
else
strbuf = wstrappend(strbuf, _("unsupported"));
strbuf = wstrappend(strbuf, ".");
#endif
panel->infoL = WMCreateLabel(panel->win);
WMResizeWidget(panel->infoL, WMScaleX(350), WMScaleY(80));
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO2) && defined(DEBUG)
WMResizeWidget(panel->infoL, WMScaleX(380), WMScaleY(100));
#else
WMResizeWidget(panel->infoL, WMScaleX(350), WMScaleY(100));
#endif
WMMoveWidget(panel->infoL, WMScaleX(15), WMScaleY(115));
WMSetLabelText(panel->infoL, strbuf);
font = WMSystemFontOfSize(scr->wmscreen, WMScaleY(11));
+12 -2
View File
@@ -4,6 +4,7 @@
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 1998-2003 Dan Pascu
* Copyright (c) 2009-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -3038,7 +3039,6 @@ void wDockSwap(WDock *dock)
WAppIcon *btn;
int x, i;
x = getDockXPosition(scr, dock->on_right_side);
swapDrawers(scr, x);
dock->x_pos = x;
@@ -4619,7 +4619,10 @@ static void swapDrawer(WDock *drawer, int new_x)
ai = drawer->icon_array[i];
if (ai == NULL)
continue;
ai->xindex *= -1; /* so A B C becomes C B A */
if (drawer->on_right_side)
ai->xindex = -abs(ai->xindex);
else
ai->xindex = abs(ai->xindex);
ai->x_pos = new_x + ai->xindex * ICON_SIZE;
/* Update drawer's tile */
@@ -4923,6 +4926,13 @@ static WDock * drawerRestoreState(WScreen *scr, WMPropList *drawer_state)
drawer->icon_array[drawer->icon_count] = aicon;
if (aicon) {
/* don't trust the stored direction sign as the dock is
* dynamically positioned depending on the screen size
*/
if (drawer->screen_ptr->dock->on_right_side)
aicon->xindex = -abs(aicon->xindex);
else
aicon->xindex = abs(aicon->xindex);
aicon->dock = drawer;
aicon->x_pos = drawer->x_pos + (aicon->xindex * ICON_SIZE);
aicon->y_pos = drawer->y_pos + (aicon->yindex * ICON_SIZE);
+129 -33
View File
@@ -3,7 +3,7 @@
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1512,7 +1512,15 @@ static void handleKeyPress(XEvent * event)
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_HORIZONTAL | MAX_KEYBOARD);
movePionterToWindowCenter(wwin);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_CENTRAL:
if (ISMAPPED(wwin) && ISFOCUSED(wwin) && IS_RESIZABLE(wwin)) {
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_CENTRAL | MAX_KEYBOARD);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_LHMAXIMIZE:
@@ -1520,7 +1528,7 @@ static void handleKeyPress(XEvent * event)
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_VERTICAL | MAX_LEFTHALF | MAX_KEYBOARD);
movePionterToWindowCenter(wwin);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_RHMAXIMIZE:
@@ -1528,7 +1536,7 @@ static void handleKeyPress(XEvent * event)
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_VERTICAL | MAX_RIGHTHALF | MAX_KEYBOARD);
movePionterToWindowCenter(wwin);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_THMAXIMIZE:
@@ -1536,7 +1544,7 @@ static void handleKeyPress(XEvent * event)
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_HORIZONTAL | MAX_TOPHALF | MAX_KEYBOARD);
movePionterToWindowCenter(wwin);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_BHMAXIMIZE:
@@ -1544,7 +1552,7 @@ static void handleKeyPress(XEvent * event)
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_HORIZONTAL | MAX_BOTTOMHALF | MAX_KEYBOARD);
movePionterToWindowCenter(wwin);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_LTCMAXIMIZE:
@@ -1552,7 +1560,7 @@ static void handleKeyPress(XEvent * event)
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_LEFTHALF | MAX_TOPHALF | MAX_KEYBOARD);
movePionterToWindowCenter(wwin);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_RTCMAXIMIZE:
@@ -1560,7 +1568,7 @@ static void handleKeyPress(XEvent * event)
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_RIGHTHALF | MAX_TOPHALF | MAX_KEYBOARD);
movePionterToWindowCenter(wwin);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_LBCMAXIMIZE:
@@ -1568,7 +1576,7 @@ static void handleKeyPress(XEvent * event)
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_LEFTHALF | MAX_BOTTOMHALF | MAX_KEYBOARD);
movePionterToWindowCenter(wwin);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_RBCMAXIMIZE:
@@ -1576,7 +1584,7 @@ static void handleKeyPress(XEvent * event)
CloseWindowMenu(scr);
handleMaximize(wwin, MAX_RIGHTHALF | MAX_BOTTOMHALF | MAX_KEYBOARD);
movePionterToWindowCenter(wwin);
movePointerToWindowCenter(wwin);
}
break;
case WKBD_MAXIMUS:
@@ -1852,21 +1860,32 @@ static void handleKeyPress(XEvent * event)
case WKBD_RUN:
{
char *cmdline;
ExecuteInputCommand(scr, _("exec %A(Run, Type command:)"));
break;
}
cmdline = ExpandOptions(scr, _("exec %A(Run,Type command to run:)"));
case WKBD_EXIT:
{
/* quick mode is not allowed to prevent inadvertently call */
ExecuteExitCommand(scr, 0);
break;
}
if (cmdline) {
XGrabPointer(dpy, scr->root_win, True, 0,
GrabModeAsync, GrabModeAsync, None, wPreferences.cursor[WCUR_WAIT], CurrentTime);
XSync(dpy, False);
case WKBD_PRINTS:
{
ScreenCapture(scr, PRINT_SCREEN);
break;
}
ExecuteShellCommand(scr, cmdline);
wfree(cmdline);
case WKBD_PRINTW:
{
ScreenCapture(scr, PRINT_WINDOW);
break;
}
XUngrabPointer(dpy, CurrentTime);
XSync(dpy, False);
}
case WKBD_PRINTP:
{
ScreenCapture(scr, PRINT_PARTIAL);
break;
}
@@ -1917,27 +1936,104 @@ static void handleKeyPress(XEvent * event)
}
}
static void handleMotionNotify(XEvent * event)
{
WScreen *scr = wScreenForRootWindow(event->xmotion.root);
#define CORNER_NONE 0
#define CORNER_TOPLEFT 1
#define CORNER_TOPRIGHT 2
#define CORNER_BOTTOMLEFT 3
#define CORNER_BOTTOMRIGHT 4
if (wPreferences.scrollable_menus) {
static int get_corner(WMRect rect, WMPoint p)
{
if (p.x <= (rect.pos.x + wPreferences.hot_corner_edge) && p.y <= (rect.pos.y + wPreferences.hot_corner_edge))
return CORNER_TOPLEFT;
if (p.x >= (rect.pos.x + rect.size.width - wPreferences.hot_corner_edge) && p.y <= (rect.pos.y + wPreferences.hot_corner_edge))
return CORNER_TOPRIGHT;
if (p.x <= (rect.pos.x + wPreferences.hot_corner_edge) && p.y >= (rect.pos.y + rect.size.height - wPreferences.hot_corner_edge))
return CORNER_BOTTOMLEFT;
if (p.x >= (rect.pos.x + rect.size.width - wPreferences.hot_corner_edge) && p.y >= (rect.pos.y + rect.size.height - wPreferences.hot_corner_edge))
return CORNER_BOTTOMRIGHT;
return CORNER_NONE;
}
static void hotCornerDelay(void *data)
{
WScreen *scr = (WScreen *) data;
if (scr->flags.in_hot_corner && wPreferences.hot_corner_actions[scr->flags.in_hot_corner - 1])
ExecuteShellCommand(scr, wPreferences.hot_corner_actions[scr->flags.in_hot_corner - 1]);
WMDeleteTimerHandler(scr->hot_corner_timer);
scr->hot_corner_timer = NULL;
}
static void handleMotionNotify(XEvent *event)
{
if (wPreferences.scrollable_menus || wPreferences.hot_corners) {
WScreen *scr = wScreenForRootWindow(event->xmotion.root);
WMPoint p = wmkpoint(event->xmotion.x_root, event->xmotion.y_root);
WMRect rect = wGetRectForHead(scr, wGetHeadForPoint(scr, p));
if (scr->flags.jump_back_pending ||
p.x <= (rect.pos.x + 1) ||
p.x >= (rect.pos.x + rect.size.width - 2) ||
p.y <= (rect.pos.y + 1) || p.y >= (rect.pos.y + rect.size.height - 2)) {
WMenu *menu;
if (wPreferences.hot_corners) {
if (!scr->flags.in_hot_corner) {
scr->flags.in_hot_corner = get_corner(rect, p);
if (scr->flags.in_hot_corner && !scr->hot_corner_timer)
scr->hot_corner_timer = WMAddTimerHandler(wPreferences.hot_corner_delay, hotCornerDelay, scr);
} else {
int out_hot_corner = 0;
menu = wMenuUnderPointer(scr);
if (menu != NULL)
wMenuScroll(menu);
switch (scr->flags.in_hot_corner) {
case CORNER_TOPLEFT:
if ((p.x > (rect.pos.x + wPreferences.hot_corner_edge)) ||
(p.y > (rect.pos.y + wPreferences.hot_corner_edge)))
out_hot_corner = 1;
break;
case CORNER_TOPRIGHT:
if ((p.x < (rect.pos.x + rect.size.width - wPreferences.hot_corner_edge)) ||
(p.y > (rect.pos.y + wPreferences.hot_corner_edge)))
out_hot_corner = 1;
break;
case CORNER_BOTTOMLEFT:
if ((p.x > (rect.pos.x + wPreferences.hot_corner_edge)) ||
(p.y < (rect.pos.y + rect.size.height - wPreferences.hot_corner_edge)))
out_hot_corner = 1;
break;
case CORNER_BOTTOMRIGHT:
if ((p.x < (rect.pos.x + rect.size.width - wPreferences.hot_corner_edge)) ||
(p.y < (rect.pos.y + rect.size.height - wPreferences.hot_corner_edge)))
out_hot_corner = 1;
break;
}
if (out_hot_corner) {
scr->flags.in_hot_corner = CORNER_NONE;
if (scr->hot_corner_timer) {
WMDeleteTimerHandler(scr->hot_corner_timer);
scr->hot_corner_timer = NULL;
}
}
}
}
if (wPreferences.scrollable_menus) {
if (scr->flags.jump_back_pending ||
p.x <= (rect.pos.x + 1) ||
p.x >= (rect.pos.x + rect.size.width - 2) ||
p.y <= (rect.pos.y + 1) || p.y >= (rect.pos.y + rect.size.height - 2)) {
WMenu *menu;
menu = wMenuUnderPointer(scr);
if (menu != NULL)
wMenuScroll(menu);
}
}
}
}
#undef CORNER_NONE
#undef CORNER_TOPLEFT
#undef CORNER_TOPRIGHT
#undef CORNER_BOTTOMLEFT
#undef CORNER_BOTTOMRIGHT
static void handleVisibilityNotify(XEvent * event)
{
WWindow *wwin;
+1 -1
View File
@@ -422,7 +422,7 @@ static char *get_icon_cache_path(void)
{
const char *prefix;
char *path;
int len, ret;
int ret;
prefix = wuserdatapath();
path = wstrconcat(prefix, CACHE_ICON_PATH "/");
+14 -1
View File
@@ -2,7 +2,7 @@
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -76,6 +76,7 @@ enum {
WKBD_FOCUSPREV,
WKBD_GROUPNEXT,
WKBD_GROUPPREV,
WKBD_CENTRAL,
/* window, menu */
WKBD_CLOSE,
@@ -145,6 +146,18 @@ enum {
/* open "run" dialog */
WKBD_RUN,
/* open "exit" dialog */
WKBD_EXIT,
/* screen print */
WKBD_PRINTS,
/* window print */
WKBD_PRINTW,
/* partial print */
WKBD_PRINTP,
#ifdef KEEP_XKB_LOCK_STATUS
WKBD_TOGGLE,
#endif
+15 -5
View File
@@ -56,6 +56,7 @@
#include "dialog.h"
#include "main.h"
#include "monitor.h"
#include "misc.h"
#include <WINGs/WUtil.h>
@@ -354,11 +355,19 @@ Bool RelaunchWindow(WWindow *wwin)
char **argv;
int argc;
char *command = NULL;
if (! XGetCommand(dpy, wwin->client_win, &argv, &argc) || argc == 0 || argv == NULL) {
command = GetCommandForWindow(wwin->client_win);
if (!command) {
#ifdef USE_XRES
werror("cannot relaunch the application because no associated process found");
#else
werror("cannot relaunch the application because no WM_COMMAND property is set");
#endif
return False;
}
} else
wtokensplit(command, &argv, &argc);
pid_t pid = fork();
@@ -384,18 +393,19 @@ Bool RelaunchWindow(WWindow *wwin)
} else if (pid < 0) {
werror("cannot fork a new process");
XFreeStringList(argv);
wtokenfree(argv, argc);
wfree(command);
return False;
} else {
_tuple *data = wmalloc(sizeof(_tuple));
data->scr = wwin->screen_ptr;
data->command = wtokenjoin(argv, argc);
data->command = command;
/* not actually a shell command */
wAddDeathHandler(pid, shellCommandHandler, data);
XFreeStringList(argv);
wtokenfree(argv, argc);
}
return True;
+64 -24
View File
@@ -724,9 +724,12 @@ static void paintEntry(WMenu * menu, int index, int selected)
/* draw indicator */
if (entry->flags.indicator && entry->flags.indicator_on) {
int iw, ih;
WPixmap *indicator;
WPixmap *indicator = NULL;
switch (entry->flags.indicator_type) {
case MI_DIAMOND:
indicator = scr->menu_radio_indicator;
break;
case MI_CHECK:
indicator = scr->menu_check_indicator;
break;
@@ -739,35 +742,72 @@ static void paintEntry(WMenu * menu, int index, int selected)
case MI_SHADED:
indicator = scr->menu_shade_indicator;
break;
case MI_DIAMOND:
case MI_SNAP_V:
indicator = scr->menu_snap_vertical_indicator;
break;
case MI_SNAP_H:
indicator = scr->menu_snap_horizontal_indicator;
break;
case MI_CENTRAL:
indicator = scr->menu_central_indicator;
break;
case MI_SNAP_RH:
indicator = scr->menu_snap_rh_indicator;
break;
case MI_SNAP_LH:
indicator = scr->menu_snap_lh_indicator;
break;
case MI_SNAP_TH:
indicator = scr->menu_snap_th_indicator;
break;
case MI_SNAP_BH:
indicator = scr->menu_snap_bh_indicator;
break;
case MI_SNAP_TL:
indicator = scr->menu_snap_tl_indicator;
break;
case MI_SNAP_TR:
indicator = scr->menu_snap_tr_indicator;
break;
case MI_SNAP_BL:
indicator = scr->menu_snap_bl_indicator;
break;
case MI_SNAP_BR:
indicator = scr->menu_snap_br_indicator;
break;
case MI_SNAP_TILED:
indicator = scr->menu_snap_tiled_indicator;
break;
case MI_NONE:
default:
indicator = scr->menu_radio_indicator;
break;
}
iw = indicator->width;
ih = indicator->height;
XSetClipMask(dpy, scr->copy_gc, indicator->mask);
XSetClipOrigin(dpy, scr->copy_gc, 5, y + (h - ih) / 2);
if (selected) {
if (entry->flags.enabled) {
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->select_text_color));
if (indicator) {
iw = indicator->width;
ih = indicator->height;
XSetClipMask(dpy, scr->copy_gc, indicator->mask);
XSetClipOrigin(dpy, scr->copy_gc, 5, y + (h - ih) / 2);
if (selected) {
if (entry->flags.enabled) {
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->select_text_color));
} else {
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->dtext_color));
}
} else {
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->dtext_color));
}
} else {
if (entry->flags.enabled) {
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->mtext_color));
} else {
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->dtext_color));
if (entry->flags.enabled) {
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->mtext_color));
} else {
XSetForeground(dpy, scr->copy_gc, WMColorPixel(scr->dtext_color));
}
}
XFillRectangle(dpy, win, scr->copy_gc, 5, y + (h - ih) / 2, iw, ih);
/*
XCopyArea(dpy, indicator->image, win, scr->copy_gc, 0, 0,
iw, ih, 5, y+(h-ih)/2);
*/
XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
}
XFillRectangle(dpy, win, scr->copy_gc, 5, y + (h - ih) / 2, iw, ih);
/*
XCopyArea(dpy, indicator->image, win, scr->copy_gc, 0, 0,
iw, ih, 5, y+(h-ih)/2);
*/
XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
}
/* draw right text */
@@ -2440,7 +2480,7 @@ static int restoreMenu(WScreen *scr, WMPropList *menu)
static int restoreMenuRecurs(WScreen *scr, WMPropList *menus, WMenu *menu, const char *path)
{
WMPropList *key, *entry;
char buffer[512];
char buffer[1024];
int i, x, y, res;
Bool lowered;
+19 -6
View File
@@ -23,11 +23,24 @@
#include "wcore.h"
#define MI_DIAMOND 0
#define MI_CHECK 1
#define MI_MINIWINDOW 2
#define MI_HIDDEN 3
#define MI_SHADED 4
#define MI_NONE 0
#define MI_DIAMOND 1
#define MI_CHECK 2
#define MI_MINIWINDOW 3
#define MI_HIDDEN 4
#define MI_SHADED 5
#define MI_SNAP_V 6
#define MI_SNAP_H 7
#define MI_SNAP_RH 8
#define MI_SNAP_LH 9
#define MI_SNAP_TH 10
#define MI_SNAP_BH 11
#define MI_SNAP_TL 12
#define MI_SNAP_TR 13
#define MI_SNAP_BL 14
#define MI_SNAP_BR 15
#define MI_SNAP_TILED 16
#define MI_CENTRAL 17
typedef struct WMenuEntry {
int order;
@@ -44,7 +57,7 @@ typedef struct WMenuEntry {
unsigned int enabled:1; /* entry is selectable */
unsigned int indicator:1; /* left indicator */
unsigned int indicator_on:1;
unsigned int indicator_type:3;
unsigned int indicator_type:5;
unsigned int editable:1;
} flags;
} WMenuEntry;
+62 -1
View File
@@ -38,6 +38,7 @@
#include <X11/XKBlib.h>
#include <WINGs/WUtil.h>
#include <WINGs/WINGsP.h>
#include <wraster.h>
#include "window.h"
@@ -53,6 +54,7 @@
#include "xmodifier.h"
#include "main.h"
#include "event.h"
#include "shutdown.h"
#define ICON_SIZE wPreferences.icon_size
@@ -679,6 +681,64 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
return NULL;
}
void ExecuteExitCommand(WScreen *scr, long quickmode)
{
static int inside = 0;
int result;
/* prevent reentrant calls */
if (inside)
return;
inside = 1;
#define R_CANCEL 0
#define R_EXIT 1
result = R_CANCEL;
if (quickmode == M_QUICK) {
result = R_EXIT;
} else {
int r, oldSaveSessionFlag;
oldSaveSessionFlag = wPreferences.save_session_on_exit;
r = wExitDialog(scr, _("Exit"),
_("Are you sure you want to quit Window Maker?"), _("Exit"), _("Cancel"), NULL);
if (r == WAPRDefault) {
result = R_EXIT;
} else if (r == WAPRAlternate) {
/* Don't modify the "save session on exit" flag if the
* user canceled the operation. */
wPreferences.save_session_on_exit = oldSaveSessionFlag;
}
}
if (result == R_EXIT)
Shutdown(WSExitMode);
#undef R_EXIT
#undef R_CANCEL
inside = 0;
}
void ExecuteInputCommand(WScreen *scr, const char *cmdline)
{
char *cmd;
cmd = ExpandOptions(scr, cmdline);
if (cmd) {
XGrabPointer(dpy, scr->root_win, True, 0,
GrabModeAsync, GrabModeAsync, None, wPreferences.cursor[WCUR_WAIT], CurrentTime);
XSync(dpy, False);
ExecuteShellCommand(scr, cmd);
wfree(cmd);
XUngrabPointer(dpy, CurrentTime);
XSync(dpy, False);
}
}
void ParseWindowName(WMPropList *value, char **winstance, char **wclass, const char *where)
{
char *name;
@@ -739,6 +799,7 @@ char *GetShortcutString(const char *shortcut)
*k = 0;
mod = wXModifierFromKey(text);
if (mod < 0) {
wfree(buffer);
return wstrdup("bug");
}
lbl = wXModifierToShortcutLabel(mod);
@@ -781,7 +842,7 @@ char *GetShortcutKey(WShortKey key)
}
}
key_name = XKeysymToString(XkbKeycodeToKeysym(dpy, key.keycode, 0, 0));
key_name = XKeysymToString(W_KeycodeToKeysym(dpy, key.keycode, 0));
if (!key_name)
return NULL;
+5 -1
View File
@@ -2,7 +2,7 @@
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 2013 Window Maker Team
* Copyright (c) 2013-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,6 +25,8 @@
#include "keybind.h"
#include "appicon.h"
#define M_QUICK 1
Bool wFetchName(Display *dpy, Window win, char **winname);
Bool wGetIconName(Display *dpy, Window win, char **iconname);
Bool UpdateDomainFile(WDDomain * domain);
@@ -45,6 +47,8 @@ void SendHelperMessage(WScreen *scr, char type, int workspace, const char *msg);
char *ShrinkString(WMFont *font, const char *string, int width);
char *FindImage(const char *paths, const char *file);
char *ExpandOptions(WScreen * scr, const char *cmdline);
void ExecuteInputCommand(WScreen *scr, const char *cmdline);
void ExecuteExitCommand(WScreen *scr, long quickmode);
char *GetShortcutString(const char *text);
char *GetShortcutKey(WShortKey key);
char *EscapeWM_CLASS(const char *name, const char *class);
+2 -2
View File
@@ -62,7 +62,7 @@ typedef struct {
long functions;
long decorations;
long inputMode;
long unknown;
long status;
} MWMHints;
static Atom _XA_MOTIF_WM_HINTS;
@@ -180,7 +180,7 @@ static int getMWMHints(Window window, MWMHints *mwmhints)
mwmhints->decorations = data[2];
mwmhints->inputMode = data[3];
if (count > 5)
mwmhints->unknown = data[4];
mwmhints->status = data[4];
}
XFree(data);
+4 -4
View File
@@ -1665,10 +1665,10 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
}
} else {
if (ww != original_w)
wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS);
wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS | MAX_CENTRAL);
if (wh != original_h)
wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS | MAX_CENTRAL);
wWindowConfigure(wwin, src_x + off_x, src_y + off_y, ww, wh - vert_border);
wWindowSynthConfigureNotify(wwin);
@@ -2283,10 +2283,10 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev)
XUngrabServer(dpy);
if (fw != original_fw)
wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS);
wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS | MAX_CENTRAL);
if (fh != original_fh)
wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS | MAX_CENTRAL);
wWindowConfigure(wwin, fx, fy, fw, fh - vert_border);
wWindowSynthConfigureNotify(wwin);
+1 -1
View File
@@ -3,7 +3,7 @@
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 2013 Window Maker Team
* Copyright (c) 2013-2016 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+3 -54
View File
@@ -4,7 +4,7 @@
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 1998-2003 Dan Pascu
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -142,66 +142,17 @@ static Shortcut *shortcutList = NULL;
*
*/
#define M_QUICK 1
/* menu commands */
static void execCommand(WMenu * menu, WMenuEntry * entry)
{
char *cmdline;
cmdline = ExpandOptions(menu->frame->screen_ptr, (char *)entry->clientdata);
XGrabPointer(dpy, menu->frame->screen_ptr->root_win, True, 0,
GrabModeAsync, GrabModeAsync, None, wPreferences.cursor[WCUR_WAIT], CurrentTime);
XSync(dpy, 0);
if (cmdline) {
ExecuteShellCommand(menu->frame->screen_ptr, cmdline);
wfree(cmdline);
}
XUngrabPointer(dpy, CurrentTime);
XSync(dpy, 0);
ExecuteInputCommand(menu->frame->screen_ptr, (char *)entry->clientdata);
}
static void exitCommand(WMenu * menu, WMenuEntry * entry)
{
static int inside = 0;
int result;
ExecuteExitCommand(menu->frame->screen_ptr, (long)entry->clientdata);
/* prevent reentrant calls */
if (inside)
return;
inside = 1;
#define R_CANCEL 0
#define R_EXIT 1
result = R_CANCEL;
if ((long)entry->clientdata == M_QUICK) {
result = R_EXIT;
} else {
int r, oldSaveSessionFlag;
oldSaveSessionFlag = wPreferences.save_session_on_exit;
r = wExitDialog(menu->frame->screen_ptr, _("Exit"),
_("Exit window manager?"), _("Exit"), _("Cancel"), NULL);
if (r == WAPRDefault) {
result = R_EXIT;
} else if (r == WAPRAlternate) {
/* Don't modify the "save session on exit" flag if the
* user canceled the operation. */
wPreferences.save_session_on_exit = oldSaveSessionFlag;
}
}
if (result == R_EXIT)
Shutdown(WSExitMode);
#undef R_EXIT
#undef R_CANCEL
inside = 0;
}
static void shutdownCommand(WMenu * menu, WMenuEntry * entry)
@@ -1087,8 +1038,6 @@ static WMenu *readMenu(WScreen *scr, const char *flat_file, FILE *file)
freeline(title, command, params, shortcut);
break;
}
freeline(title, command, params, shortcut);
}
WMenuParserDelete(parser);
+276 -37
View File
@@ -24,6 +24,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -54,10 +58,12 @@
#include "geomview.h"
#include "wmspec.h"
#include "rootmenu.h"
#include "misc.h"
#include "xinerama.h"
#include <WINGs/WUtil.h>
#include <WINGs/WINGsP.h>
#include "defaults.h"
@@ -478,45 +484,34 @@ static void createPixmaps(WScreen * scr)
WPixmap *pix;
/* load pixmaps */
pix = wPixmapCreateFromXBMData(scr, (char *)MENU_RADIO_INDICATOR_XBM_DATA,
(char *)MENU_RADIO_INDICATOR_XBM_DATA,
MENU_RADIO_INDICATOR_XBM_SIZE,
MENU_RADIO_INDICATOR_XBM_SIZE, scr->black_pixel, scr->white_pixel);
if (pix != NULL)
pix->shared = 1;
scr->menu_radio_indicator = pix;
#define LOADPIXMAPINDICATOR(XBM,W,I) {\
pix = wPixmapCreateFromXBMData(scr, (char *)XBM, (char *)XBM,\
W, MENU_SNAP_INDICATOR_H_XBM_SIZE,\
scr->black_pixel, scr->white_pixel);\
if (pix != NULL)\
pix->shared = 1;\
scr->I = pix;}
pix = wPixmapCreateFromXBMData(scr, (char *)MENU_CHECK_INDICATOR_XBM_DATA,
(char *)MENU_CHECK_INDICATOR_XBM_DATA,
MENU_CHECK_INDICATOR_XBM_SIZE,
MENU_CHECK_INDICATOR_XBM_SIZE, scr->black_pixel, scr->white_pixel);
if (pix != NULL)
pix->shared = 1;
scr->menu_check_indicator = pix;
LOADPIXMAPINDICATOR(MENU_RADIO_INDICATOR_XBM_DATA, MENU_RADIO_INDICATOR_XBM_SIZE, menu_radio_indicator)
LOADPIXMAPINDICATOR(MENU_CHECK_INDICATOR_XBM_DATA, MENU_CHECK_INDICATOR_XBM_SIZE, menu_check_indicator)
LOADPIXMAPINDICATOR(MENU_MINI_INDICATOR_XBM_DATA, MENU_MINI_INDICATOR_XBM_SIZE, menu_mini_indicator)
LOADPIXMAPINDICATOR(MENU_HIDE_INDICATOR_XBM_DATA, MENU_HIDE_INDICATOR_XBM_SIZE, menu_hide_indicator)
LOADPIXMAPINDICATOR(MENU_SHADE_INDICATOR_XBM_DATA, MENU_SHADE_INDICATOR_XBM_SIZE, menu_shade_indicator)
pix = wPixmapCreateFromXBMData(scr, (char *)MENU_MINI_INDICATOR_XBM_DATA,
(char *)MENU_MINI_INDICATOR_XBM_DATA,
MENU_MINI_INDICATOR_XBM_SIZE,
MENU_MINI_INDICATOR_XBM_SIZE, scr->black_pixel, scr->white_pixel);
if (pix != NULL)
pix->shared = 1;
scr->menu_mini_indicator = pix;
LOADPIXMAPINDICATOR(MENU_SNAP_V_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_vertical_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_H_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_horizontal_indicator)
LOADPIXMAPINDICATOR(MENU_CENTRAL_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_central_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_RH_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_rh_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_LH_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_lh_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_TH_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_th_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_BH_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_bh_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_TL_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_tl_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_TR_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_tr_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_BL_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_bl_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_BR_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_br_indicator)
LOADPIXMAPINDICATOR(MENU_SNAP_TILED_INDICATOR_XBM_DATA, MENU_SNAP_INDICATOR_W_XBM_SIZE, menu_snap_tiled_indicator)
pix = wPixmapCreateFromXBMData(scr, (char *)MENU_HIDE_INDICATOR_XBM_DATA,
(char *)MENU_HIDE_INDICATOR_XBM_DATA,
MENU_HIDE_INDICATOR_XBM_SIZE,
MENU_HIDE_INDICATOR_XBM_SIZE, scr->black_pixel, scr->white_pixel);
if (pix != NULL)
pix->shared = 1;
scr->menu_hide_indicator = pix;
pix = wPixmapCreateFromXBMData(scr, (char *)MENU_SHADE_INDICATOR_XBM_DATA,
(char *)MENU_SHADE_INDICATOR_XBM_DATA,
MENU_SHADE_INDICATOR_XBM_SIZE,
MENU_SHADE_INDICATOR_XBM_SIZE, scr->black_pixel, scr->white_pixel);
if (pix != NULL)
pix->shared = 1;
scr->menu_shade_indicator = pix;
#undef LOADPIXMAPINDICATOR
create_logo_image(scr);
@@ -593,6 +588,7 @@ static void createInternalWindows(WScreen * scr)
scr->workspace_name =
XCreateWindow(dpy, scr->root_win, 0, 0, 10, 10, 0, scr->w_depth,
CopyFromParent, scr->w_visual, vmask, &attribs);
scr->mini_screenshot_timeout = 0;
}
/*
@@ -617,7 +613,7 @@ WScreen *wScreenInit(int screen_number)
{
WScreen *scr;
XIconSize icon_size[1];
RContextAttributes rattr;
RContextAttributes rattr = {};
long event_mask;
XErrorHandler oldHandler;
int i;
@@ -1126,3 +1122,246 @@ int wScreenKeepInside(WScreen * scr, int *x, int *y, int width, int height)
return moved;
}
static XImage *imageCaptureArea(WScreen *scr)
{
XEvent event;
int quit = 0;
int xp = -1;
int yp = -1;
int w = 0, h = 0;
int x = xp, y = yp;
if (XGrabPointer(dpy, scr->root_win, False, ButtonMotionMask
| ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
GrabModeAsync, None, wPreferences.cursor[WCUR_CAPTURE], CurrentTime) != Success) {
return NULL;
}
XGrabServer(dpy);
while (!quit) {
WMMaskEvent(dpy, ButtonReleaseMask | PointerMotionMask | ButtonPressMask | KeyPressMask, &event);
switch (event.type) {
case ButtonPress:
if (event.xbutton.button == Button1) {
xp = event.xbutton.x_root;
yp = event.xbutton.y_root;
}
break;
case ButtonRelease:
if (event.xbutton.button == Button1) {
quit = 1;
if (w > 0 && h > 0) {
XDrawRectangle(dpy, scr->root_win, scr->frame_gc, x, y, w, h);
XUngrabServer(dpy);
XUngrabPointer(dpy, CurrentTime);
return XGetImage(dpy, scr->root_win, x, y, w, h, AllPlanes, ZPixmap);
}
}
break;
case MotionNotify:
XDrawRectangle(dpy, scr->root_win, scr->frame_gc, x, y, w, h);
x = event.xmotion.x_root;
if (x < xp) {
w = xp - x;
} else {
w = x - xp;
x = xp;
}
y = event.xmotion.y_root;
if (y < yp) {
h = yp - y;
} else {
h = y - yp;
y = yp;
}
XDrawRectangle(dpy, scr->root_win, scr->frame_gc, x, y, w, h);
break;
case KeyPress:
if (W_KeycodeToKeysym(dpy, event.xkey.keycode, 0) == XK_Escape)
quit = 1;
break;
default:
WMHandleEvent(&event);
break;
}
}
XUngrabServer(dpy);
XUngrabPointer(dpy, CurrentTime);
return NULL;
}
static void hideMiniScreenshot(void *data)
{
WScreen *scr = (WScreen *) data;
if (time(NULL) < scr->mini_screenshot_timeout) {
scr->mini_screenshot_timer = WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideMiniScreenshot, scr);
} else {
XWindowAttributes attr;
WMDeleteTimerHandler(scr->mini_screenshot_timer);
if (XGetWindowAttributes(dpy, scr->mini_screenshot, &attr))
slide_window(scr->mini_screenshot, attr.x, attr.y, attr.x + attr.width, attr.y);
XUnmapWindow(dpy, scr->mini_screenshot);
XDestroyWindow(dpy, scr->mini_screenshot);
scr->mini_screenshot_timeout = 0;
}
}
static void showMiniScreenshot(WScreen *scr, RImage *img)
{
Pixmap pix;
int x = scr->scr_width - img->width - 20;
int y = scr->scr_height - img->height - 20;
if (!scr->mini_screenshot_timeout) {
Window win;
win = XCreateSimpleWindow(dpy, scr->root_win, x, y,
img->width, img->height, scr->frame_border_width, 0, 0);
scr->mini_screenshot = win;
}
RConvertImage(scr->rcontext, img, &pix);
XMapWindow(dpy, scr->mini_screenshot);
XCopyArea(dpy, pix, scr->mini_screenshot, scr->rcontext->copy_gc, 0, 0, img->width, img->height, 0, 0);
XFlush(dpy);
scr->mini_screenshot_timeout = time(NULL) + 2;
scr->mini_screenshot_timer = WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideMiniScreenshot, scr);
}
void ScreenCapture(WScreen *scr, int mode)
{
time_t s;
short i = 0;
struct tm *tm_info;
char index_str[12] = "";
char filename_date_part[60];
char filename[60];
char *filepath;
char *screenshot_dir;
RImage *img = NULL;
RImage *scale_img = NULL;
#ifdef USE_PNG
char *filetype = ".png";
#else
#ifdef USE_JPEG
char *filetype = ".jpg";
#else
char *filetype = NULL;
#endif
#endif
if (!filetype) {
werror(_("Unable to find a proper screenshot image format"));
return;
}
screenshot_dir = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/Screenshots/");
if (-1 == mkdir(screenshot_dir, 0700) && errno != EEXIST) {
wfree(screenshot_dir);
werror(_("Unable to create screenshot directory: %s"), strerror(errno));
return;
}
s = time(NULL);
tm_info = localtime(&s);
strftime(filename_date_part, sizeof(filename_date_part), "screenshot_%Y-%m-%d_at_%H:%M:%S", tm_info);
strcpy(filename, filename_date_part);
filepath = wstrconcat(screenshot_dir, strcat(filename, filetype));
while (access(filepath, F_OK) == 0 && i < 600) {
i++;
strcpy(filename, filename_date_part);
sprintf(index_str, "_%d", i);
strncat(filename, index_str, sizeof(filename) - strlen(filename) - 1);
wfree(filepath);
filepath = wstrconcat(screenshot_dir, strcat(filename, filetype));
}
/* cannot generate an available filename ?! */
if (i == 600) {
wfree(filepath);
wfree(screenshot_dir);
werror(_("Could not generate a free screenshot filename"));
return;
}
switch (mode) {
WWindow *wwin;
XImage *pimg;
case PRINT_WINDOW:
wwin = scr->focused_window;
if (wwin && !wwin->flags.shaded) {
/*
* check if hint WM_TAKE_FOCUS is set, if it's the case
* we can take screenshot of the out of screen window
*/
if (wwin->focus_mode >= WFM_LOCALLY_ACTIVE) {
img = RCreateImageFromDrawable(scr->rcontext, wwin->client_win, None);
}
else {
/* we will only capture the visible window part */
int x_crop = 0;
int y_crop = 0;
int w_crop = wwin->client.width;
int h_crop = wwin->client.height;
if (wwin->client.x > 0)
x_crop = wwin->client.x;
if (wwin->client.y > 0)
y_crop = wwin->client.y;
if (wwin->client.x + wwin->client.width > scr->scr_width)
w_crop = scr->scr_width - wwin->client.x;
if (wwin->client.y + wwin->client.height > scr->scr_height)
h_crop = scr->scr_height - wwin->client.y;
pimg = XGetImage(dpy, scr->root_win, x_crop, y_crop,
(wwin->client.x > 0)?w_crop:w_crop + wwin->client.x,
(wwin->client.y > 0)?h_crop:h_crop + wwin->client.y,
AllPlanes, ZPixmap);
if (pimg) {
img = RCreateImageFromXImage(scr->rcontext, pimg, None);
XDestroyImage(pimg);
}
}
}
break;
case PRINT_PARTIAL:
pimg = imageCaptureArea(scr);
if (pimg) {
img = RCreateImageFromXImage(scr->rcontext, pimg, None);
XDestroyImage(pimg);
}
break;
default:
/* PRINT_SCREEN*/
img = RCreateImageFromDrawable(scr->rcontext, scr->root_win, None);
}
if (img) {
#ifdef USE_PNG
if (RSaveTitledImage(img, filepath, (char *)(filetype + 1), "Screenshot from Window Maker")) {
#else
if (RSaveTitledImage(img, filepath, (char *)(filetype + 1), "Screenshot from Window Maker")) {
#endif
scale_img = RSmoothScaleImage(img, scr->scr_width / 10, scr->scr_height / 10);
showMiniScreenshot(scr, scale_img);
RReleaseImage(scale_img);
#ifdef DEBUG
wmessage("screenshot filepath: %s", filepath);
#endif
}
RReleaseImage(img);
}
wfree(filepath);
wfree(screenshot_dir);
}
+25 -1
View File
@@ -27,6 +27,9 @@
#include <WINGs/WUtil.h>
#define PRINT_SCREEN 1
#define PRINT_WINDOW 2
#define PRINT_PARTIAL 3
typedef struct {
WMRect *screens;
@@ -211,6 +214,19 @@ typedef struct _WScreen {
struct WPixmap *menu_mini_indicator; /* for miniwindow */
struct WPixmap *menu_hide_indicator; /* for hidden window */
struct WPixmap *menu_shade_indicator; /* for shaded window */
struct WPixmap *menu_snap_vertical_indicator; /* for vertical snap window */
struct WPixmap *menu_snap_horizontal_indicator; /* for horizontal snap window */
struct WPixmap *menu_snap_rh_indicator; /* for righ half snap window */
struct WPixmap *menu_snap_lh_indicator; /* for left half snap window */
struct WPixmap *menu_snap_th_indicator; /* for top half snap window */
struct WPixmap *menu_snap_bh_indicator; /* for bottom half snap window */
struct WPixmap *menu_snap_tl_indicator; /* for top left snap window */
struct WPixmap *menu_snap_tr_indicator; /* for top rigt snap window */
struct WPixmap *menu_snap_bl_indicator; /* for bottom left snap window */
struct WPixmap *menu_snap_br_indicator; /* for bottom right snap window */
struct WPixmap *menu_snap_tiled_indicator; /* for tiled window */
struct WPixmap *menu_central_indicator; /* for central window */
int app_menu_x, app_menu_y; /* position for application menus */
struct WMenu *root_menu; /* root window menu */
@@ -271,10 +287,17 @@ typedef struct _WScreen {
WMHandlerID *workspace_name_timer;
struct WorkspaceNameData *workspace_name_data;
/* mini screenshot data */
Window mini_screenshot;
time_t mini_screenshot_timeout;
WMHandlerID *mini_screenshot_timer;
/* for raise-delay */
WMHandlerID *autoRaiseTimer;
Window autoRaiseWindow; /* window that is scheduled to be
* raised */
/* for hot-corners delay */
WMHandlerID *hot_corner_timer;
/* for window shortcuts */
WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
@@ -303,6 +326,7 @@ typedef struct _WScreen {
unsigned int doing_alt_tab:1;
unsigned int jump_back_pending:1;
unsigned int ignore_focus_events:1;
unsigned int in_hot_corner:3;
} flags;
} WScreen;
@@ -314,7 +338,7 @@ void wScreenRestoreState(WScreen *scr);
int wScreenBringInside(WScreen *scr, int *x, int *y, int width, int height);
int wScreenKeepInside(WScreen *scr, int *x, int *y, int width, int height);
void ScreenCapture(WScreen *scr, int mode);
/* in startup.c */
WScreen *wScreenWithNumber(int i);
+37 -6
View File
@@ -93,6 +93,7 @@ static WMPropList *sHost;
static WMPropList *sWorkspace;
static WMPropList *sShaded;
static WMPropList *sMiniaturized;
static WMPropList *sMaximized;
static WMPropList *sHidden;
static WMPropList *sGeometry;
static WMPropList *sShortcutMask;
@@ -112,6 +113,7 @@ static void make_keys(void)
sWorkspace = WMCreatePLString("Workspace");
sShaded = WMCreatePLString("Shaded");
sMiniaturized = WMCreatePLString("Miniaturized");
sMaximized = WMCreatePLString("Maximized");
sHidden = WMCreatePLString("Hidden");
sGeometry = WMCreatePLString("Geometry");
sDock = WMCreatePLString("Dock");
@@ -166,6 +168,22 @@ static unsigned getInt(WMPropList * value)
return n;
}
static unsigned getHex(WMPropList * value)
{
char *val;
unsigned n;
if (!WMIsPLString(value))
return 0;
val = WMGetFromPLString(value);
if (!val)
return 0;
if (sscanf(val, "0x%04X", &n) != 1)
return 0;
return n;
}
static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
{
WScreen *scr = wwin->screen_ptr;
@@ -174,7 +192,7 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
unsigned mask;
char *class, *instance, *command = NULL, buffer[512];
WMPropList *win_state, *cmd, *name, *workspace;
WMPropList *shaded, *miniaturized, *hidden, *geometry;
WMPropList *shaded, *miniaturized, *maximized, *hidden, *geometry;
WMPropList *dock, *shortcut;
if (wwin->orig_main_window != None && wwin->orig_main_window != wwin->client_win)
@@ -183,8 +201,13 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
win = wwin->client_win;
command = GetCommandForWindow(win);
if (!command)
return NULL;
if (!command) {
if (wapp->app_icon && wapp->app_icon->command) {
command = wmalloc(strlen(wapp->app_icon->command) + 1);
strcpy(command, wapp->app_icon->command);
} else
return NULL;
}
if (PropGetWMClass(win, &class, &instance)) {
if (class && instance)
@@ -202,6 +225,8 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
shaded = wwin->flags.shaded ? sYes : sNo;
miniaturized = wwin->flags.miniaturized ? sYes : sNo;
snprintf(buffer, sizeof(buffer), "0x%04X", wwin->flags.maximized);
maximized = WMCreatePLString(buffer);
hidden = wwin->flags.hidden ? sYes : sNo;
snprintf(buffer, sizeof(buffer), "%ix%i+%i+%i",
wwin->client.width, wwin->client.height, wwin->frame_x, wwin->frame_y);
@@ -221,12 +246,14 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
sWorkspace, workspace,
sShaded, shaded,
sMiniaturized, miniaturized,
sMaximized, maximized,
sHidden, hidden,
sShortcutMask, shortcut, sGeometry, geometry, NULL);
WMReleasePropList(name);
WMReleasePropList(cmd);
WMReleasePropList(workspace);
WMReleasePropList(maximized);
WMReleasePropList(geometry);
WMReleasePropList(shortcut);
if (wapp && wapp->app_icon && wapp->app_icon->dock) {
@@ -344,6 +371,7 @@ static pid_t execCommand(WScreen *scr, char *command)
wtokensplit(command, &argv, &argc);
if (!argc) {
wfree(argv);
return 0;
}
@@ -364,9 +392,7 @@ static pid_t execCommand(WScreen *scr, char *command)
execvp(argv[0], args);
exit(111);
}
while (argc > 0)
wfree(argv[--argc]);
wfree(argv);
wtokenfree(argv, argc);
return pid;
}
@@ -403,6 +429,11 @@ static WSavedState *getWindowState(WScreen * scr, WMPropList * win_state)
if (value != NULL)
state->miniaturized = getBool(value);
value = WMGetFromPLDictionary(win_state, sMaximized);
if (value != NULL) {
state->maximized = getHex(value);
}
value = WMGetFromPLDictionary(win_state, sHidden);
if (value != NULL)
state->hidden = getBool(value);
+1
View File
@@ -493,6 +493,7 @@ void StartUp(Bool defaultScreenOnly)
wPreferences.cursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
wPreferences.cursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name??? */
wPreferences.cursor[WCUR_SELECT] = XCreateFontCursor(dpy, XC_cross);
wPreferences.cursor[WCUR_CAPTURE] = XCreateFontCursor(dpy, XC_crosshair);
Pixmap cur = XCreatePixmap(dpy, DefaultRootWindow(dpy), 16, 16, 1);
GC gc = XCreateGC(dpy, cur, 0, NULL);
+9 -5
View File
@@ -61,6 +61,7 @@ struct SwitchPanel {
WMFont *font;
WMColor *white;
WMColor *gray;
};
/* these values will be updated whenever the switch panel
@@ -154,11 +155,10 @@ static void changeImage(WSwitchPanel *panel, int idecks, int selected, Bool dim,
border_space + pos.y, back->width, back->height, 0, 0);
} else {
RColor color;
WMScreen *wscr = WMWidgetScreen(icon);
color.red = 255;
color.red = WMRedComponentOfColor(WMGrayColor(wscr)) >> 8;
color.green = WMGreenComponentOfColor(WMGrayColor(wscr)) >> 8;
color.blue = WMBlueComponentOfColor(WMGrayColor(wscr)) >> 8;
color.red = WMRedComponentOfColor(panel->gray) >> 8;
color.green = WMGreenComponentOfColor(panel->gray) >> 8;
color.blue = WMBlueComponentOfColor(panel->gray) >> 8;
color.alpha = 255;
RFillImage(back, &color);
}
@@ -454,6 +454,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, Bool class_only)
}
panel->white = WMWhiteColor(scr->wmscreen);
panel->gray = WMGrayColor(scr->wmscreen);
panel->font = WMBoldSystemFontOfSize(scr->wmscreen, WMScaleY(12));
panel->icons = WMCreateArray(count);
panel->images = WMCreateArray(count);
@@ -589,6 +590,9 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
if (panel->white)
WMReleaseColor(panel->white);
if (panel->gray)
WMReleaseColor(panel->gray);
wfree(panel);
}
+1 -1
View File
@@ -162,7 +162,7 @@ WTexSolid *wTextureMakeSolid(WScreen*, XColor*);
WTexGradient *wTextureMakeGradient(WScreen*, int, const RColor*, const RColor*);
WTexMGradient *wTextureMakeMGradient(WScreen*, int, RColor**);
WTexTGradient *wTextureMakeTGradient(WScreen*, int, const RColor*, const RColor*, const char *, int);
WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[], int, const RColor[]);
WTexIGradient *wTextureMakeIGradient(WScreen*, int, const RColor[2], int, const RColor[2]);
WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, const char *pixmap_file,
XColor *color);
void wTextureDestroy(WScreen*, WTexture*);
+99 -46
View File
@@ -3,6 +3,7 @@
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 2008-2023 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,6 +30,9 @@
#ifdef KEEP_XKB_LOCK_STATUS
#include <X11/XKBlib.h>
#endif /* KEEP_XKB_LOCK_STATUS */
#ifdef USE_XRES
#include <X11/extensions/XRes.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -475,6 +479,41 @@ Bool wWindowObscuresWindow(WWindow *wwin, WWindow *obscured)
return True;
}
/* Get the corresponding Process Identification Number of the active window */
static pid_t getWindowPid(Window win)
{
pid_t pid = -1;
pid = wNETWMGetPidForWindow(win);
#ifdef USE_XRES
if (pid > 0)
return pid;
else {
XResClientIdSpec spec;
int status;
long i, num_ids = 0;
XResClientIdValue *client_ids = NULL;
spec.client = win;
spec.mask = XRES_CLIENT_ID_PID_MASK;
status = XResQueryClientIds(dpy, 1, &spec, &num_ids, &client_ids);
if (status != Success)
return -1;
for (i = 0; i < num_ids; i++) {
if (client_ids[i].spec.mask == XRES_CLIENT_ID_PID_MASK) {
pid = XResGetClientPid(&client_ids[i]);
break;
}
}
XResClientIdsDestroy(num_ids, client_ids);
}
#endif
return pid;
}
static void fixLeaderProperties(WWindow *wwin)
{
XClassHint *classHint;
@@ -487,7 +526,7 @@ static void fixLeaderProperties(WWindow *wwin)
classHint = XAllocClassHint();
clientHints = XGetWMHints(dpy, wwin->client_win);
pid = wNETWMGetPidForWindow(wwin->client_win);
pid = getWindowPid(wwin->client_win);
if (pid > 0)
haveCommand = GetCommandForPid(pid, &argv, &argc);
else
@@ -688,6 +727,9 @@ WWindow *wManageWindow(WScreen *scr, Window window)
XChangeWindowAttributes(dpy, window, CWEventMask | CWDontPropagate | CWSaveUnder, &attribs);
XSetWindowBorderWidth(dpy, window, 0);
if (wwin->wm_class != NULL && strcmp(wwin->wm_class, "DockApp") != 0)
wwin->flags.fullscreen_monitors[0] = -1;
/* get hints from GNUstep app */
if (wwin->wm_class != NULL && strcmp(wwin->wm_class, "GNUstep") == 0)
wwin->flags.is_gnustep = 1;
@@ -878,6 +920,9 @@ WWindow *wManageWindow(WScreen *scr, Window window)
if (win_state->state->miniaturized > 0 && !WFLAGP(wwin, no_miniaturizable))
wwin->flags.miniaturized = win_state->state->miniaturized;
if (win_state->state->maximized > 0)
wwin->flags.maximized = win_state->state->maximized;
if (!IS_OMNIPRESENT(wwin)) {
int w = wDefaultGetStartWorkspace(scr, wwin->wm_instance,
wwin->wm_class);
@@ -1691,9 +1736,8 @@ void wWindowSingleFocus(WWindow *wwin)
/* bring window back to visible area */
move = wScreenBringInside(scr, &x, &y, wwin->frame->core->width, wwin->frame->core->height);
if (move) {
if (move)
wWindowConfigure(wwin, x, y, wwin->client.width, wwin->client.height);
}
}
void wWindowFocusPrev(WWindow *wwin, Bool inSameWorkspace)
@@ -1858,12 +1902,19 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
int baseH = 0;
if (wwin->normal_hints) {
winc = wwin->normal_hints->width_inc;
hinc = wwin->normal_hints->height_inc;
minW = wwin->normal_hints->min_width;
minH = wwin->normal_hints->min_height;
maxW = wwin->normal_hints->max_width;
maxH = wwin->normal_hints->max_height;
if (!wwin->flags.maximized) {
winc = wwin->normal_hints->width_inc;
hinc = wwin->normal_hints->height_inc;
}
if (wwin->normal_hints->min_width > minW)
minW = wwin->normal_hints->min_width;
if (wwin->normal_hints->min_height > minH)
minH = wwin->normal_hints->min_height;
if (wwin->normal_hints->max_width < maxW)
maxW = wwin->normal_hints->max_width;
if (wwin->normal_hints->max_height < maxH)
maxH = wwin->normal_hints->max_height;
if (wwin->normal_hints->flags & PAspect) {
minAX = wwin->normal_hints->min_aspect.x;
minAY = wwin->normal_hints->min_aspect.y;
@@ -1875,15 +1926,22 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
baseH = wwin->normal_hints->base_height;
}
/* trust the mins provided by the client but not the maxs */
if (width < minW)
width = minW;
if (height < minH)
height = minH;
if (width > maxW)
width = maxW;
if (height > maxH)
height = maxH;
/* if only one dimension is over the top, set a default 4/3 ratio */
if (width > maxW && height < maxH)
width = height * 4 / 3;
else if(height > maxH && width < maxW)
height = width * 3 / 4;
else if(width > maxW && height > maxH) {
/* if both are over the top, set size to almost fullscreen */
height = wwin->screen_ptr->scr_height - 2 * wPreferences.icon_size;
width = wwin->screen_ptr->scr_width - 2 * wPreferences.icon_size;
}
/* aspect ratio code borrowed from olwm */
if (minAX > 0) {
@@ -1922,15 +1980,17 @@ void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nhe
}
}
if (baseW != 0)
width = (((width - baseW) / winc) * winc) + baseW;
else
width = (((width - minW) / winc) * winc) + minW;
if (!wwin->flags.maximized) {
if (baseW != 0)
width = (((width - baseW) / winc) * winc) + baseW;
else
width = (((width - minW) / winc) * winc) + minW;
if (baseH != 0)
height = (((height - baseH) / hinc) * hinc) + baseH;
else
height = (((height - minH) / hinc) * hinc) + minH;
if (baseH != 0)
height = (((height - baseH) / hinc) * hinc) + baseH;
else
height = (((height - minH) / hinc) * hinc) + minH;
}
/* broken stupid apps may cause preposterous values for these.. */
if (width > 0)
@@ -2087,21 +2147,7 @@ void wWindowConfigure(WWindow *wwin, int req_x, int req_y, int req_width, int re
int synth_notify = False;
int resize;
/* if window size is guaranteed to fail - fix it to some reasonable
* defaults */
if (req_height > SHRT_MAX)
req_height = 480;
if (req_width > SHRT_MAX)
req_height = 640;
resize = (req_width != wwin->client.width || req_height != wwin->client.height);
/*
* if the window is being moved but not resized then
* send a synthetic ConfigureNotify
*/
if ((req_x != wwin->frame_x || req_y != wwin->frame_y) && !resize)
synth_notify = True;
if (WFLAGP(wwin, dont_move_off))
wScreenBringInside(wwin->screen_ptr, &req_x, &req_y, req_width, req_height);
@@ -2138,10 +2184,17 @@ void wWindowConfigure(WWindow *wwin, int req_x, int req_y, int req_width, int re
wwin->client.width = req_width;
wwin->client.height = req_height;
} else {
wwin->client.x = req_x;
wwin->client.y = req_y + wwin->frame->top_width;
XMoveWindow(dpy, wwin->frame->core->window, req_x, req_y);
if (req_x != wwin->frame_x || req_y != wwin->frame_y) {
wwin->client.x = req_x;
wwin->client.y = req_y + wwin->frame->top_width;
XMoveWindow(dpy, wwin->frame->core->window, req_x, req_y);
}
/*
* if the window is being moved but not resized
* or if we change nothing then
* send a synthetic ConfigureNotify
*/
synth_notify = True;
}
wwin->frame_x = req_x;
wwin->frame_y = req_y;
@@ -2649,7 +2702,7 @@ void wWindowUpdateGNUstepAttr(WWindow * wwin, GNUstepWMAttributes * attr)
}
WMagicNumber wWindowAddSavedState(const char *instance, const char *class,
const char *command, pid_t pid, WSavedState * state)
const char *command, pid_t pid, WSavedState *state)
{
WWindowState *wstate;
@@ -2860,17 +2913,18 @@ static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event)
}
}
if (wPreferences.double_click_fullscreen){
if (wPreferences.double_click_fullscreen) {
int dir = 0;
if (event->xbutton.state == 0) {
/* maximize window full screen*/
dir |= (MAX_VERTICAL|MAX_HORIZONTAL);
int ndir = dir ^ wwin->flags.maximized;
if (ndir != 0)
wMaximizeWindow(wwin, ndir, wGetHeadForWindow(wwin));
}
else
wUnmaximizeWindow(wwin);
}
} else {
int dir = 0;
@@ -2884,7 +2938,6 @@ static void titlebarDblClick(WCoreWindow *sender, void *data, XEvent *event)
}
/* maximize window */
if (dir != 0 && IS_RESIZABLE(wwin)) {
int ndir = dir ^ wwin->flags.maximized;
+4 -3
View File
@@ -251,9 +251,10 @@ typedef struct WWindow {
unsigned int miniaturized:1;
unsigned int hidden:1;
unsigned int shaded:1;
unsigned int maximized:7;
unsigned int old_maximized:7;
unsigned int maximized:10;
unsigned int old_maximized:10;
unsigned int fullscreen:1;
long fullscreen_monitors[4];
unsigned int omnipresent:1;
unsigned int semi_focused:1;
/* window type flags */
@@ -308,9 +309,9 @@ typedef struct WWindow {
typedef struct WSavedState {
int workspace;
int miniaturized;
int maximized;
int shaded;
int hidden;
int maximized;
int x; /* original geometry of the */
int y; /* window if it's maximized */
unsigned int w;
+24 -14
View File
@@ -119,21 +119,23 @@ static const char *const menu_options_entries[] = {
* Defines the menu entries for the Other maximization sub-menu
*/
static const struct {
unsigned int indicator;
const char *label;
unsigned int shortcut_idx;
int maxim_direction;
} menu_maximize_entries[] = {
{ N_("Maximize vertically"), WKBD_VMAXIMIZE, MAX_VERTICAL },
{ N_("Maximize horizontally"), WKBD_HMAXIMIZE, MAX_HORIZONTAL },
{ N_("Maximize left half"), WKBD_LHMAXIMIZE, MAX_VERTICAL | MAX_LEFTHALF },
{ N_("Maximize right half"), WKBD_RHMAXIMIZE, MAX_VERTICAL | MAX_RIGHTHALF },
{ N_("Maximize top half"), WKBD_THMAXIMIZE, MAX_HORIZONTAL | MAX_TOPHALF },
{ N_("Maximize bottom half"), WKBD_BHMAXIMIZE, MAX_HORIZONTAL | MAX_BOTTOMHALF },
{ N_("Maximize left top corner"), WKBD_LTCMAXIMIZE, MAX_LEFTHALF | MAX_TOPHALF },
{ N_("Maximize right top corner"), WKBD_RTCMAXIMIZE, MAX_RIGHTHALF | MAX_TOPHALF },
{ N_("Maximize left bottom corner"), WKBD_LBCMAXIMIZE, MAX_LEFTHALF | MAX_BOTTOMHALF },
{ N_("Maximize right bottom corner"), WKBD_RBCMAXIMIZE, MAX_RIGHTHALF | MAX_BOTTOMHALF },
{ N_("Maximus: tiled maximization"), WKBD_MAXIMUS, MAX_MAXIMUS }
{ MI_SNAP_V, N_("Vertical"), WKBD_VMAXIMIZE, MAX_VERTICAL },
{ MI_SNAP_H, N_("Horizontal"), WKBD_HMAXIMIZE, MAX_HORIZONTAL },
{ MI_CENTRAL, N_("Central"), WKBD_CENTRAL, MAX_CENTRAL },
{ MI_SNAP_LH, N_("Left half"), WKBD_LHMAXIMIZE, MAX_VERTICAL | MAX_LEFTHALF },
{ MI_SNAP_RH, N_("Right half"), WKBD_RHMAXIMIZE, MAX_VERTICAL | MAX_RIGHTHALF },
{ MI_SNAP_TH, N_("Top half"), WKBD_THMAXIMIZE, MAX_HORIZONTAL | MAX_TOPHALF },
{ MI_SNAP_BH, N_("Bottom half"), WKBD_BHMAXIMIZE, MAX_HORIZONTAL | MAX_BOTTOMHALF },
{ MI_SNAP_TL, N_("Top left"), WKBD_LTCMAXIMIZE, MAX_LEFTHALF | MAX_TOPHALF },
{ MI_SNAP_TR, N_("Top right"), WKBD_RTCMAXIMIZE, MAX_RIGHTHALF | MAX_TOPHALF },
{ MI_SNAP_BL, N_("Bottom left"), WKBD_LBCMAXIMIZE, MAX_LEFTHALF | MAX_BOTTOMHALF },
{ MI_SNAP_BR, N_("Bottom right"), WKBD_RBCMAXIMIZE, MAX_RIGHTHALF | MAX_BOTTOMHALF },
{ MI_SNAP_TILED, N_("Tiled"), WKBD_MAXIMUS, MAX_MAXIMUS }
};
static void updateOptionsMenu(WMenu * menu, WWindow * wwin);
@@ -180,7 +182,7 @@ static void updateUnmaximizeShortcut(WMenuEntry * entry, int flags)
{
int key;
switch (flags & (MAX_HORIZONTAL | MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS)) {
switch (flags & (MAX_HORIZONTAL | MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_TOPHALF | MAX_BOTTOMHALF | MAX_MAXIMUS | MAX_CENTRAL)) {
case MAX_HORIZONTAL:
key = WKBD_HMAXIMIZE;
break;
@@ -189,6 +191,10 @@ static void updateUnmaximizeShortcut(WMenuEntry * entry, int flags)
key = WKBD_VMAXIMIZE;
break;
case MAX_CENTRAL:
key = WKBD_CENTRAL;
break;
case MAX_LEFTHALF | MAX_VERTICAL:
key = WKBD_LHMAXIMIZE;
break;
@@ -562,6 +568,7 @@ static WMenu *makeOptionsMenu(WScreen * scr)
static WMenu *makeMaximizeMenu(WScreen * scr)
{
WMenu *menu;
WMenuEntry *entry;
int i;
menu = wMenuCreate(scr, NULL, False);
@@ -570,8 +577,11 @@ static WMenu *makeMaximizeMenu(WScreen * scr)
return NULL;
}
for (i = 0; i < wlengthof(menu_maximize_entries); i++)
wMenuAddCallback(menu, _(menu_maximize_entries[i].label), execMaximizeCommand, NULL);
for (i = 0; i < wlengthof(menu_maximize_entries); i++) {
entry = wMenuAddCallback(menu, _(menu_maximize_entries[i].label), execMaximizeCommand, NULL);
entry->flags.indicator = entry->flags.indicator_on = 1;
entry->flags.indicator_type = menu_maximize_entries[i].indicator;
}
return menu;
}
+58 -6
View File
@@ -77,6 +77,9 @@ static Atom net_wm_visible_name; /* TODO (unnecessary?) */
static Atom net_wm_icon_name;
static Atom net_wm_visible_icon_name; /* TODO (unnecessary?) */
static Atom net_wm_desktop;
#ifdef USE_XINERAMA
static Atom net_wm_fullscreen_monitors;
#endif
static Atom net_wm_window_type;
static Atom net_wm_window_type_desktop;
static Atom net_wm_window_type_dock;
@@ -161,6 +164,9 @@ static atomitem_t atomNames[] = {
{"_NET_WM_ICON_NAME", &net_wm_icon_name},
{"_NET_WM_VISIBLE_ICON_NAME", &net_wm_visible_icon_name},
{"_NET_WM_DESKTOP", &net_wm_desktop},
#ifdef USE_XINERAMA
{"_NET_WM_FULLSCREEN_MONITORS", &net_wm_fullscreen_monitors},
#endif
{"_NET_WM_WINDOW_TYPE", &net_wm_window_type},
{"_NET_WM_WINDOW_TYPE_DESKTOP", &net_wm_window_type_desktop},
{"_NET_WM_WINDOW_TYPE_DOCK", &net_wm_window_type_dock},
@@ -287,6 +293,9 @@ static void setSupportedHints(WScreen *scr)
atom[i++] = net_wm_moveresize;
#endif
atom[i++] = net_wm_desktop;
#ifdef USE_XINERAMA
atom[i++] = net_wm_fullscreen_monitors;
#endif
atom[i++] = net_wm_window_type;
atom[i++] = net_wm_window_type_desktop;
atom[i++] = net_wm_window_type_dock;
@@ -988,7 +997,7 @@ static void updateWorkspaceNames(WScreen *scr)
len = 0;
for (i = 0; i < scr->workspace_count; i++) {
curr_size = strlen(scr->workspaces[i]->name);
strcpy(pos, scr->workspaces[i]->name);
strncpy(pos, scr->workspaces[i]->name, sizeof(pos) - 1);
pos += (curr_size + 1);
len += (curr_size + 1);
}
@@ -1027,6 +1036,9 @@ static void updateStateHint(WWindow *wwin, Bool changedWorkspace, Bool del)
{ /* changeable */
if (del) {
XDeleteProperty(dpy, wwin->client_win, net_wm_state);
#ifdef USE_XINERAMA
XDeleteProperty(dpy, wwin->client_win, net_wm_fullscreen_monitors);
#endif
} else {
Atom state[15]; /* nr of defined state atoms */
int i = 0;
@@ -1067,6 +1079,20 @@ static void updateStateHint(WWindow *wwin, Bool changedWorkspace, Bool del)
XChangeProperty(dpy, wwin->client_win, net_wm_state, XA_ATOM, 32,
PropModeReplace, (unsigned char *)state, i);
#ifdef USE_XINERAMA
if (wwin->flags.fullscreen && (wwin->flags.fullscreen_monitors[0] != -1)) {
unsigned long data[4];
data[0] = wwin->flags.fullscreen_monitors[0];
data[1] = wwin->flags.fullscreen_monitors[1];
data[2] = wwin->flags.fullscreen_monitors[2];
data[3] = wwin->flags.fullscreen_monitors[3];
XChangeProperty(dpy, wwin->client_win, net_wm_fullscreen_monitors, XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)data, 4);
}
#endif
}
}
@@ -1260,8 +1286,10 @@ static void doStateAtom(WWindow *wwin, Atom state, int set, Bool init)
} else {
if (set)
wFullscreenWindow(wwin);
else
else {
wUnfullscreenWindow(wwin);
wwin->flags.fullscreen_monitors[0] = -1;
}
}
} else if (state == net_wm_state_above) {
if (set == _NET_WM_STATE_TOGGLE)
@@ -1455,7 +1483,8 @@ void wNETWMPositionSplash(WWindow *wwin, int *x, int *y, int width, int height)
static void updateWindowType(WWindow *wwin)
{
Atom type_ret;
int fmt_ret, layer;
int fmt_ret;
int layer = INT_MIN; //illegal level
unsigned long nitems_ret, bytes_after_ret;
long *data = NULL;
@@ -1473,7 +1502,8 @@ static void updateWindowType(WWindow *wwin)
}
if (wwin->frame != NULL) {
ChangeStackingLevel(wwin->frame->core, layer);
if (layer != INT_MIN)
ChangeStackingLevel(wwin->frame->core, layer);
wwin->frame->flags.need_texture_change = 1;
wWindowConfigureBorders(wwin);
wFrameWindowPaint(wwin->frame);
@@ -1706,7 +1736,7 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
if (wwin->frame->workspace == wwin->screen_ptr->current_workspace /* No workspace change */
|| event->data.l[0] == 2 /* Requested by pager */
|| WFLAGP(wwin, focus_across_wksp) /* Explicitly allowed */) {
wNETWMShowingDesktop(scr, False);
wNETWMShowingDesktop(wwin->screen_ptr, False);
wMakeWindowVisible(wwin);
}
return True;
@@ -1759,8 +1789,30 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
wWindowChangeWorkspace(wwin, desktop);
}
return True;
}
#ifdef USE_XINERAMA
} else if (event->message_type == net_wm_fullscreen_monitors) {
unsigned long top, bottom, left, right, src_indication;
top = event->data.l[0];
bottom = event->data.l[1];
left = event->data.l[2];
right = event->data.l[3];
src_indication = event->data.l[4];
if (src_indication > 1)
wwarning("_NET_WM_FULLSCREEN_MONITORS source indication %ld not supported", src_indication);
wFullscreenMonitorsWindow(wwin, top, bottom, left, right);
return True;
}
#else
}
#endif
#ifdef DEBUG_WMSPEC
wmessage("processClientMessage unsupported type %s", XGetAtomName(dpy, event->message_type));
#endif
return False;
}
+37 -11
View File
@@ -2,7 +2,7 @@
*
* Window Maker window manager
*
* Copyright (c) 2014 Window Maker Team - David Maciejak
* Copyright (c) 2014-2023 Window Maker Team - David Maciejak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -256,7 +256,7 @@ static WMPixmap *dummy_background_pixmap(WWorkspaceMap *wsmap)
RImage *img;
WMPixmap *icon;
img = RCreateImage(wsmap->wswidth, wsmap->wsheight, 0);
img = RCreateImage(wsmap->mini_workspace_width, wsmap->mini_workspace_height, 0);
if (!img)
return NULL;
@@ -327,7 +327,7 @@ static void hide_mini_workspace(W_WorkspaceMap *wsmap_array, int i)
static WMPixmap *get_mini_workspace(WWorkspaceMap *wsmap, int index)
{
if (!wsmap->scr->workspaces[index]->map)
return dummy_background_pixmap(wsmap);
return NULL;
if (index == wsmap->scr->current_workspace)
return enlight_workspace(wsmap->scr, wsmap->scr->workspaces[index]->map);
@@ -337,9 +337,9 @@ static WMPixmap *get_mini_workspace(WWorkspaceMap *wsmap, int index)
static void create_mini_workspace(WScreen *scr, WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
{
int workspace_index;
unsigned short workspace_index;
int mini_workspace_cnt;
char name[10];
char name[6];
WMButton *mini_workspace_btn;
WMPixmap *icon;
@@ -363,7 +363,7 @@ static void create_mini_workspace(WScreen *scr, WWorkspaceMap *wsmap, W_Workspac
WMReleasePixmap(icon);
}
snprintf(name, sizeof(name), "%d", workspace_index);
snprintf(name, sizeof(name), "%hu", workspace_index);
WMSetButtonText(mini_workspace_btn, name);
WMSetButtonAction(mini_workspace_btn, selected_workspace_callback, wsmap);
}
@@ -423,9 +423,9 @@ static WWorkspaceMap *create_workspace_map(WScreen *scr, W_WorkspaceMap *wsmap_a
static void update_mini_workspace(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array, int bulk_of_ten)
{
int local_index, general_index;
unsigned short local_index, general_index;
int mini_workspace_cnt;
char name[10];
char name[6];
WMPixmap *icon;
if (bulk_of_ten == wsmap_bulk_index)
@@ -448,7 +448,7 @@ static void update_mini_workspace(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_ar
if (general_index < wsmap->scr->workspace_count) {
/* updating label */
WMSetLabelText(wsmap_array[local_index].workspace_label, wsmap->scr->workspaces[general_index]->name);
snprintf(name, sizeof(name), "%d", general_index);
snprintf(name, sizeof(name), "%hu", general_index);
WMSetButtonText(wsmap_array[local_index].workspace_img_button, name);
/* updating label background*/
@@ -486,12 +486,15 @@ static void handle_event(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
w_global.process_workspacemap_event = True;
while (w_global.process_workspacemap_event) {
WMMaskEvent(dpy, KeyPressMask | KeyReleaseMask | ExposureMask
| PointerMotionMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask, &ev);
WMMaskEvent(dpy, KeyPressMask | KeyReleaseMask | ExposureMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask | EnterWindowMask | FocusChangeMask, &ev);
modifiers = ev.xkey.state & w_global.shortcut.modifiers_mask;
switch (ev.type) {
WMScreen *wmscr;
WMColor *black;
case KeyPress:
if (ev.xkey.keycode == escKey || (wKeyBindings[WKBD_WORKSPACEMAP].keycode != 0 &&
wKeyBindings[WKBD_WORKSPACEMAP].keycode == ev.xkey.keycode &&
@@ -530,6 +533,29 @@ static void handle_event(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
}
break;
case FocusIn:
wmscr = wsmap->scr->wmscreen;
black = WMBlackColor(wmscr);
const char *text = "?";
WMFont *bold = WMBoldSystemFontOfSize(wmscr, wsmap->mini_workspace_width / 3);
int x = (wsmap->mini_workspace_width / 2) - (WMWidthOfString(bold, text, strlen(text)) / 2);
int y = (wsmap->mini_workspace_height / 2) - (WMFontHeight(bold) / 2);
WMPixmap *icon = dummy_background_pixmap(wsmap);
if (icon) {
int i;
WMDrawString(wmscr, WMGetPixmapXID(icon),
black, bold, x, y, text, strlen(text));
for (i = 0; i < wsmap->scr->workspace_count; i++) {
if (!wsmap->scr->workspaces[i]->map)
WMSetButtonImage(wsmap_array[i].workspace_img_button, icon);
}
WMReleasePixmap(icon);
}
WMHandleEvent(&ev);
break;
default:
WMHandleEvent(&ev);
break;
+1 -1
View File
@@ -2,7 +2,7 @@
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 2014 Window Maker Team
* Copyright (c) 2014-2015 Window Maker Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+30
View File
@@ -410,3 +410,33 @@ WMPoint wGetPointToCenterRectInHead(WScreen * scr, int head, int width, int heig
return p;
}
/* Find the bounding rect of the union of two rectangles */
void wGetRectUnion(const WMRect *rect1, const WMRect *rect2, WMRect *dest)
{
int dest_x, dest_y;
int dest_w, dest_h;
dest_x = rect1->pos.x;
dest_y = rect1->pos.y;
dest_w = rect1->size.width;
dest_h = rect1->size.height;
if (rect2->pos.x < dest_x) {
dest_w += dest_x - rect2->pos.x;
dest_x = rect2->pos.x;
}
if (rect2->pos.y < dest_y) {
dest_h += dest_y - rect2->pos.y;
dest_y = rect2->pos.y;
}
if (rect2->pos.x + rect2->size.width > dest_x + dest_w)
dest_w = rect2->pos.x + rect2->size.width - dest_x;
if (rect2->pos.y + rect2->size.height > dest_y + dest_h)
dest_h = rect2->pos.y + rect2->size.height - dest_y;
dest->pos.x = dest_x;
dest->pos.y = dest_y;
dest->size.width = dest_w;
dest->size.height = dest_h;
}
+2
View File
@@ -60,6 +60,8 @@ WArea wGetUsableAreaForHead(WScreen *scr, int head, WArea *totalAreaPtr, Bool no
WMPoint wGetPointToCenterRectInHead(WScreen *scr, int head, int width, int height);
void wGetRectUnion(const WMRect *rect1, const WMRect *rect2, WMRect *dest);
Bool wWindowTouchesHead(WWindow *wwin, int head);
Bool wAppIconTouchesHead(WAppIcon *aicon, int head);
+2 -1
View File
@@ -36,6 +36,7 @@ Perpetrator: Sudish Joseph <sj@eng.mindspring.net>, Sept. 1997. */
#include <X11/XKBlib.h>
#include <WINGs/WUtil.h>
#include <WINGs/WINGsP.h>
#include "WindowMaker.h"
#include "xmodifier.h"
@@ -174,7 +175,7 @@ static void x_reset_modifier_mapping(Display * display)
}
code = x_modifier_keymap->modifiermap[modifier_index * mkpm + modifier_key];
sym = (code ? XkbKeycodeToKeysym(display, code, 0, column) : NoSymbol);
sym = W_KeycodeToKeysym(display, code, column);
if (sym == last_sym)
continue;
+5 -2
View File
@@ -70,10 +70,13 @@ wmmenugen_SOURCES = wmmenugen.c wmmenugen.h wmmenugen_misc.c \
wmmenugen_parse_wmconfig.c \
wmmenugen_parse_xdg.c
wmiv_CFLAGS = @PANGO_CFLAGS@ @PTHREAD_CFLAGS@
wmiv_LDADD = \
$(top_builddir)/wrlib/libwraster.la \
@XLFLAGS@ @XLIBS@ \
@GFXLIBS@ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(LIBEXIF)
$(top_builddir)/WINGs/libWINGs.la \
@XLFLAGS@ @XLIBS@ @GFXLIBS@ \
@PANGO_LIBS@ @PTHREAD_LIBS@ @LIBEXIF@
wmiv_SOURCES = wmiv.c wmiv.h

Some files were not shown because too many files have changed in this diff Show More