Compare commits

...

129 commits

Author SHA1 Message Date
rfm
e59d923e90 New release
Some checks failed
/ ci (push) Has been cancelled
2025-02-11 18:52:08 +00:00
Fred Kiefer
e63ad3c1d2 Update news.texi for upcoming release
Some checks are pending
/ ci (push) Waiting to run
2025-02-10 22:40:35 +01:00
rfm
b9038250e6 Fix use of deallocated memory 2024-12-31 08:42:22 +00:00
Frederik Carlier
03a2e7e152
Enable default interpolation due to pixelated screen drawing (#53)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gnustep_testplant_branch@40163 72102866-910b-0410-8b05-ffd578937521

Co-authored-by: Marcian Lytwyn <gna@advcsi.com>
2024-11-05 18:30:47 +01:00
Riccardo
4e3ca27c0b
instead of just getting Latin1 we practically see getting 2 or 3 bytes (even for characters that representable in Latin1) so try our best to interpret them (#50) 2024-09-19 08:32:46 +02:00
Frederik Carlier
ba1c582024
Define WINBOOL on non-MinGW platforms (#52)
The Windows SDK declares BOOL as an int.  Objective C defines BOOl as a char.
Those two types clash.  MinGW's implementation of the Windows SDK uses the WINBOOL
type to avoid this clash.  When compiling natively on Windows, we need to manually
define WINBOOL.
MinGW will define _DEF_WINBOOL_ if it has defined WINBOOL so we can use the same trick
here.
See https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/include/ntdef.h#L355
2024-09-17 21:19:25 +02:00
Frederik Carlier
6e05e1e65e
Support building natively on Windows (#51)
When building for Windows using a native toolchain (i.e. not MinGW or MSYS), `<unistd.h>` is not available.  Include `<io.h>` instead and define `strcasecmp`.
2024-09-14 00:23:01 +02:00
Joe Maloney
d27af6af10
Fix build errors with Wayland on Debian 13 (trixie) using Clang 16 (#48)
* Solve an undelcared close function

* Fix xdgshell protocol handling and resolve compile errors

* Fixing build errors in WaylandServer+Cursor

* Revert changes except wl_cursor_destroy to fix build and avoid regressions

* Fix selector warnings and method call type issues

* Use window parameter directly

* Comments removed

* Include NSGraphics to eliminate redundant declaration.

* Remove NSWindow include that was replaced by NSGraphics
2024-08-28 23:03:03 +02:00
Fred Kiefer
e03ddf7b2b Update for new release 2024-05-26 22:14:27 +02:00
rfm
be85eb8ae6 add postscript pasteboard type 2024-03-07 09:50:42 +00:00
rfm
085082a6cc Add URL/URI-list support (without insisting on trailing cr-lf) 2024-03-06 20:47:04 +00:00
rfm
0d60ea2935 add html clipboard support 2024-03-06 20:39:29 +00:00
rfm
4fea5f4dae Add pdf support 2024-03-06 19:04:12 +00:00
Riccardo Mottola
c787d26af2 PNG support in copy and paste; NSPasteboardTypePNG XG_MIME_PNG 2024-03-05 18:00:30 +01:00
rfm
707c5239e3 Improve debug loging showing method entry/exit informmation 2024-03-05 12:48:21 +00:00
rfm
b8933e4610 Add support for text/plain;charset=utf8 and improve debug logging for available types 2024-03-05 11:36:45 +00:00
rfm
145ee71f5c iimprove formatting 2024-03-04 21:36:05 +00:00
rfm
6a221b4dc7 Report all available types in debug 2024-03-04 21:21:45 +00:00
rfm
e66906ef38 Optimisation for reading large properties: avoid memory reallocation and copying data. 2024-03-01 19:29:01 +00:00
rfm
f6707b897a Merge branch 'master' of ssh://github.com/gnustep/libs-back 2024-03-01 18:54:34 +00:00
Riccardo Mottola
9c31a7e016 debug which types are found available 2024-02-29 22:41:14 +01:00
rfm
ae6529e24f Add some debug for target types sent to X 2024-02-27 10:23:22 +00:00
rfm
bfbe4d8b57 Clean up new Incremental class and add mechanism to cancel old operations. 2024-02-27 05:36:10 +00:00
rfm
daf081b888 Rewrite code providing X selection property value using INCR. 2024-02-26 21:24:11 +00:00
rfm
a0a45faaea Add a lot of debug and rewrite to support sending using the INCR protocol 2024-02-26 17:07:39 +00:00
rfm
0a32e7284e fix minor leak and avoid inefficient memory reallocation with long properties. 2024-02-25 10:20:43 +00:00
rfm
d8c05939b4 fix leaks in last update 2024-02-20 08:19:01 +00:00
rfm
e781a3ae03 reduce x library traffic and memory footprint during large transfers 2024-02-19 22:06:55 +00:00
rfm
85bad5ded7 added more logging 2024-02-19 21:17:27 +00:00
Riccardo Mottola
d0a2376e92 try to make logging a bit more verbose 2024-02-19 22:12:26 +01:00
Riccardo Mottola
895fdbcf39 reshuffle code, compact name calculation and return NSString and not NSMutableString 2023-11-21 23:40:49 +01:00
Riccardo Mottola
4bb1370086 fix compiler warning with some code cleanup 2023-11-21 23:26:40 +01:00
Fred Kiefer
519f57d85a
Merge pull request #43 from qmfrederik/fixes/access-violation
Avoid AV in Win32FontInfo setupAttributes
2023-10-11 17:46:37 +02:00
Frederik Carlier
421c09dac2 Avoid AV in Win32FontInfo setupAttributes 2023-10-11 12:50:29 +02:00
Fred Kiefer
9ab65edd14
Merge pull request #42 from qmfrederik/features/headless-pr
Add headless backend
2023-10-01 23:30:01 +02:00
Frederik Carlier
8f0146f50d Update copyright headers
- Use GNU Lesser General Public License
- Streamline attributions in the form of "based on work by:"
- Streamline names of preprocessor variables
2023-10-01 23:01:55 +02:00
Frederik Carlier
feb28c4d84 Avoid instance variables on msvc 2023-09-30 22:00:00 +02:00
Frederik Carlier
3c1b5e1397 Build multiple configurations 2023-09-30 00:23:02 +02:00
Frederik Carlier
e9c633abf7 Add font enumerator, font info, and other classes 2023-09-30 00:23:02 +02:00
Frederik Carlier
bc1d726f41 Run autoreconf -i 2023-09-30 00:21:14 +02:00
Frederik Carlier
64f685db1c Filter out duplicates from subprojects 2023-09-30 00:21:14 +02:00
Frederik Carlier
f56d4cfce2 Skaffold headless backend 2023-09-30 00:21:14 +02:00
Frederik Carlier
1ec7eb6ecb Run autoreconf -i 2023-09-29 08:16:28 +00:00
Fred Kiefer
7c0c511674
Merge pull request #41 from qmfrederik/features/ci
Add GitHub Actions
2023-09-28 23:54:43 +02:00
Frederik Carlier
af84372398 Add GitHub Actions 2023-09-28 08:13:45 +00:00
Richard Frith-Macdonald
909bd06688 Update for new release 2022-12-29 16:50:36 +00:00
Riccardo Mottola
ecfb42a893 Delete property on begin and at every Notify to start and continue transfer of INCR. 2022-02-22 00:09:00 +01:00
Fred Kiefer
db40d23ed6
Merge pull request #38 from anthonyc-r/scale_factor_font_advancement
Cairo: Disable font hinting when GSScaleFactor is not 1 to fix text d…
2022-01-24 20:03:00 +01:00
anthony
20182c8ec8 Cairo: Default font hinting to off when GSScaleFactor is set to values other than 1.0 2022-01-24 09:56:03 +00:00
Fred Kiefer
d7cfebe169
Merge pull request #37 from nongio/wayland-cursor-fix
wayland: use GSStandardWindowDecorationView to hit-test cursor clicks
2021-12-29 14:44:03 +01:00
Riccardo Canalicchio
977b375feb wayland: use GSStandardWindowDecorationView to hit-test cursor clicks 2021-12-29 14:29:44 +01:00
Fred Kiefer
9c7c878717
Merge pull request #35 from nongio/wayland-pointer
Wayland backend pointer events and cursor images
2021-12-27 17:52:47 +01:00
Riccardo Canalicchio
89280c0e3e code formatting 2021-12-27 15:21:03 +01:00
Fred Kiefer
06be91b267
Merge pull request #34 from nongio/wayland-shm-surface
Wayland shm surface
2021-12-27 13:29:36 +01:00
Fred Kiefer
cb3a8d1501
Merge pull request #36 from nongio/wayland-menu-api-change
wayland backend: libs-gui api change _menu
2021-12-27 13:18:48 +01:00
Riccardo Canalicchio
ec500d2bfb wayland backend: libs-gui api change _menu 2021-12-27 10:00:02 +01:00
Riccardo Canalicchio
cc7af18075 wayland backendL capture mouse bugfix 2021-12-27 09:53:15 +01:00
Riccardo Canalicchio
a240d1b4d8 wayland cursor: capture and release methods 2021-12-22 07:50:34 +01:00
Riccardo Canalicchio
2683cdd8ab Wayland backend: cursor event serial 2021-12-20 00:12:13 +01:00
Riccardo Canalicchio
54b2b172d8 Wayland backend: cursor icon functions 2021-12-20 00:11:48 +01:00
Riccardo Canalicchio
5db58c071d Wayland backend: window ignoreMouse 2021-12-20 00:11:41 +01:00
Riccardo Canalicchio
00b7183f84 Wayland backend: cursor handlers 2021-12-20 00:11:32 +01:00
Gregory Casamento
e106932ae0
Merge pull request #33 from nongio/wayland 2021-12-14 12:47:06 -05:00
Riccardo Canalicchio
79be4acfba WaylandCairoShmSurface: fix memory leak, handling buffer release 2021-12-13 22:27:31 +01:00
Riccardo Canalicchio
317ca762a3 rename WaylandCairoShmSurface 2021-12-13 22:27:22 +01:00
Riccardo Canalicchio
96f07c13f7 Wayland server: remove attach calls from server, surface attach is delegated to cairo surface 2021-12-13 22:23:59 +01:00
Riccardo Mottola
637baa2d91 make cast to float explicit 2021-12-03 02:04:47 +01:00
Riccardo Canalicchio
91a1479193 Wayland server: code formatting
using clang-format from:
https://github.com/gnustep/libs-base/blob/master/.clang-format
2021-11-23 14:00:01 -05:00
Riccardo Canalicchio
114743a5d0 wayland backend: refactor logs 2021-11-09 03:23:08 -05:00
Riccardo Canalicchio
5967015078 wayland backend: window move/resize 2021-11-06 08:09:26 -04:00
Riccardo Canalicchio
502dde25f5 wayland backend: surface roles based on window level 2021-11-06 08:07:44 -04:00
Riccardo Canalicchio
6a9e97660d wayland backend: change logs to debuglog 2021-10-28 02:35:31 -04:00
Riccardo Canalicchio
30ceacc90d wayland backend: refactor code, split into categories 2021-10-25 07:38:15 -04:00
Riccardo Canalicchio
7b87b268e3 wayland backend: layer shell 2021-10-25 03:13:35 -04:00
Riccardo Canalicchio
1d74e36258 wayland backend:re-attach surface on ExposeRect 2021-10-19 02:10:45 -04:00
Riccardo Canalicchio
e7ab056264 wayland backend:implement xdg ping/pong handler
this prevents the client from being considered unresponsive
2021-10-18 13:39:58 -04:00
Riccardo Canalicchio
c6ce795898 wayland backend: delayed toplevel creation 2021-10-18 03:37:02 -04:00
Ivan Vučica
3227b39c58 release-chore: Release 0.29.0. 2021-04-26 23:28:18 +01:00
Fred Kiefer
6556ff6dd8 Correct date of last ChangeLog entry 2021-03-12 18:22:58 +01:00
Fred Kiefer
9299fa1f93 * Source/x11/XGServerWindow.m (-styleoffsets:...:): Change NSLog
statement on guessing the offset into a NSDebugLLog statement.
2021-03-12 17:40:08 +01:00
Fred Kiefer
3b90116f44
Merge pull request #31 from gnustep/win64-fixes
Win64 fixes
2021-03-05 11:14:15 +01:00
rmottola
c40aa45ea6 Merge branch 'win64-fixes' of https://github.com/gnustep/libs-back into win64-fixes 2021-03-04 15:13:01 +01:00
rmottola
8640bfafe3 use consistently GetWindowLongPtr also for Cairo on Windows 2021-03-04 15:12:34 +01:00
Riccardo Mottola
60f2cb4235 update changelog 2021-03-04 00:04:09 +01:00
rmottola
d5abf2ff1c actually store in a LONG_PTR the result of GetWindowLongPtr 2021-03-03 20:58:05 +01:00
rmottola
aad896a260 use consistently GetWindowLongPtr also for Cairo on Windows 2021-03-03 20:53:01 +01:00
rmottola
da9e53c608 upgrade consistently [Set,Get]WindowLong to [Set,Get]WindowLongPtr 2021-03-02 22:13:22 +01:00
Sergii Stoian
e5cdc1747b * Source/x11/XGServerWindow.m (_checkStyle:): do not set application
name and WindowGroupHint to temporary window. Created window designed
to help get window frame offsets only - appicon window will be created
later. This change prevents appicon flickering on WindowMaker at
application start.
(_createWMAppiconHack, _setupRootWindow): WindowMaker hack removed in
favour of solution introduced in _checkStyle:.
2021-01-27 15:37:27 +02:00
Sergii Stoian
3f3c1305a9 2021-01-24 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m: WindowMaker doesn't support
  _NET_REQUEST_FRAME_EXTENTS message andthe only way to determine offsets
  is creating and mapping window. In this case first mapped window of
  application is not appicon window.
  Early appicon creating inserted back as _createWMAppiconHack method and
  called only if no other way to determine window's offsets (before call to
  _checkStyle);appicon window size is set to size icon;
2021-01-24 02:45:29 +02:00
fredkiefer
aa9ae34916 Fill in some details for pending release. 2021-01-16 20:47:10 +01:00
Sergii Stoian
6c53486617
Merge pull request #29 from trunkmaster/master
x11/XGServerWindow.m: removed WindowMaker appicon hack
2020-09-19 01:51:00 +03:00
Sergii Stoian
0bbb7a0915 Author: Sergii Stoian <stoyan255@gmail.com>
--- log message follows this line --
* Source/x11/XGServerWindow.m: removed code commented out in
  previous commit.
2020-09-19 01:48:00 +03:00
Sergii Stoian
31b7c4ed2f * Source/x11/XGServerWindow.m
(_setupRootWindow, window::::): removed WindowMaker appicon hack and
  - now unused - _wmAppIcon variable.

  Description: The removed code removed creates and maps zero-sized
  window in hope that WindowMaker will recognize app by this event and
  create app icon window. Although when application requests window
  for appicon through the `-window::::` method call, it returns newly
  created and mapped window. This actually happens but application icon
  flickers between WM icon creation and application icon window appearance.

  This fix based on the fact that root application window (ROOT) is mapped
  in `-orderwindow:::` and this is the event of application recognition
  by WindowMaker because it is a first application window that is
  mapped.
2020-09-18 16:15:14 +03:00
Sergii Stoian
d221c98e95
Merge pull request #28 from trunkmaster/master
XGServerEvent.m: unhide app if WindowMaker sends WM_TAKE_FOCUS to window
2020-09-17 18:12:55 +03:00
Sergii Stoian
fa4549e522 * Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:):
space before argument was added.
2020-09-17 12:00:38 +03:00
Sergii Stoian
df32af71fc * Source/x11/XGServerEvent.m
(_handleTakeFocusAtom:forContext:): if application (window) receives
  WM_TAKE_FOCUS in hidden state it means WindowMaker wants us to be
  unhidden.

  Description: There are 2 protocols defined in XGServerWindow.h:
  WMFHideApplication and WMFHideOtherApplications. These protocols exist
  to help GNUstep application and WindowMaker notify each other
  about "Hide" and "Hide Others" actions. There are no protocols for
  "unhide" action.

  Test case steps:
  1. Open application with window opened.
  2. Hide application with "Hide" menu item.
  3. Open WindowMaker's "Windows" menu (middle-click on desktop).
  4. Select hidden application window.
  Application unhides, activates, restored window is focused (receives) input
  and "Hide" menu item unselected.
2020-09-17 01:42:32 +03:00
Sergii Stoian
d970554391 * Source/x11/XGServerWindow.m
(hideApplication:): send application's root window to WindowMaker (WM)
  because it's a "group leader" that clearly identifies application
  inside WM. WM uses XFindContext to get WApplication structure and
  "group leader" window ID is a key to find it.
2020-09-16 09:24:48 +00:00
Riccardo Mottola
9a46ea9160 If the Library directory is not found, create one for the user. 2020-06-18 07:58:01 +00:00
Riccardo Mottola
c5990ed022 Fix return value of width to CGFloat 2020-06-18 00:55:50 +02:00
Riccardo Mottola
95f8546eec Match return value in case of error (nil instead of NO) 2020-06-18 00:54:32 +02:00
fredkiefer
e929b48e0b * Headers/fontconfig/FCFaceInfo.h: Add instancevariable _patternIsResolved.
* Source/fontconfig/FCFaceInfo.m (-matchedPattern): Cache the
resolved pattern and return this. The method characterSet now uses
this cached pattern.
Patch by Josh Freeman <gnustep_lists@twilightedge.com>
2020-06-10 18:24:51 +02:00
Fred Kiefer
efe22e8557
Merge pull request #27 from pgeorgi/typo-fixes
Fix a bunch of typos
2020-05-29 18:11:47 +02:00
Patrick Georgi
aebcc4b7fe Fix a bunch of typos
Taken from the Debian "gnustep-back" package sources, which attribute
these changes to:

Author: Eric Heintzmann <heintzmann.eric@free.fr>
Author: Yavor Doganov <yavor@gnu.org>
2020-05-29 08:21:55 +02:00
Ivan Vučica
4ab5a69383
wayland: Mention the new README in the changelog. 2020-04-25 18:25:08 +01:00
Ivan Vučica
bf4efe9d36
wayland: Added a small readme noting some backend-specific information. 2020-04-25 18:23:49 +01:00
Ivan Vučica
2bbcb043ef
wayland: Update the changelog for the merge. 2020-04-25 18:12:43 +01:00
Ivan Vučica
8f0cc1b0ca
wayland: Write down TODOs for cairo_surface doublebuffering to itself and for mouse wheel axis_source. 2020-04-25 18:12:43 +01:00
Ivan Vučica
f8b8609e70
wayland: Implement -[WaylandServer mouselocation]. 2020-04-25 18:12:42 +01:00
Ivan Vučica
67e352b83e
wayland: Deleted the useless override of -[GSDisplayServer windowlist]. 2020-04-25 18:12:42 +01:00
Ivan Vučica
c6e9ee857f
wayland: Support mouse middle click and smooth scroll wheel events. 2020-04-25 18:12:41 +01:00
Ivan Vučica
12f1d48772
wayland: Remove the 'fake drawing' branch. 2020-04-25 18:12:41 +01:00
Ivan Vučica
de9a8b36c3
wayland: Performed some investigation into freeing WaylandCairoSurface memory. 2020-04-25 18:12:40 +01:00
Ivan Vučica
b294b7f1b9
wayland: In case *stable* XDG Shell protocol isn't supported, be more informative.
The exception was not very informative about why exactly the
error message may occur. Weston in Debian buster doesn't
support the stable XDG Shell protocol, for instance, and
triaging this took some effort.
2020-04-25 18:12:40 +01:00
Ivan Vučica
84f71f5c3e
wayland: Additional interface registration NSDebugLog() output. 2020-04-25 18:12:39 +01:00
Ivan Vučica
359aa9e639
wayland: Additional clean up for license headers. 2020-04-25 16:14:07 +01:00
Ivan Vučica
41b2d294ed
wayland: Checking whether the surface is configured before committing.
This now results in windows being painted on the screen. However, input is
still ending up in all the wrong places, and there is a lot of garbage content
being painted outside the actual windows.

Right clicking on a window seems to trigger rotate behavior, which needs to
be evaluated and likely removed (or prevented, if this is done by Weston).

Interestingly, checking for ->configured on first surface commit also seems to
break the backend.
2020-04-17 01:19:26 +01:00
Ivan Vučica
36eefc981e
wayland: Assortment of fixes noticed during code review.
Rearranging order of the code, freeing some memory, writing a note
that additional work is required, returning a value through pointer
passed as argument, etc.
2020-04-15 00:36:37 +01:00
Ivan Vučica
80cc4121ae
wayland: Additional license header fixes noticed during PR. 2020-04-15 00:35:47 +01:00
Ivan Vučica
e8e615548a
wayland: Update license headers and copyright statement.
For contributions, we generally ask that copyright is assigned
to FSF. I believe this has been done by Sergio.
2020-04-15 00:19:53 +01:00
Ivan Vučica
24cbc5a198 wayland: Include a script for regenerating protocol headers/source. 2020-04-15 00:00:40 +01:00
Ivan Vučica
3db7a6fbd4 wayland: Split the check for compositor and wm_base into two checks. 2020-04-15 00:00:40 +01:00
Ladislav Michl
c1cce2ad67 wayland: WIP 2020-04-15 00:00:40 +01:00
Ladislav Michl
4311a8191b wayland: Use memfd_create 2020-04-15 00:00:40 +01:00
Ladislav Michl
e805a4a6c0 wayland: Whitespace fixes 2020-04-15 00:00:40 +01:00
Ladislav Michl
05f362d528 wayland: Add wayland integration and use stable protocol.
non functional, all changes just make it compile again. Configure changes
by Ivan Vučica.
2020-04-15 00:00:40 +01:00
Sergio L. Pascual
81456203b2 Dirty Wayland backend implementation. 2020-04-15 00:00:40 +01:00
Fred Kiefer
ecfa661d7a
Merge pull request #26 from ivucica/ivucica-normalize-announce
Normalize annoucement file between core libraries
2020-04-14 08:37:46 +02:00
Ivan Vučica
427e50df1e
documentation: Regenerate the announcement file. 2020-04-13 23:26:00 +01:00
Ivan Vučica
67b7f637e5
documentation: Standardize announcement file text.
Normalize the accompanying text for the release announcement across
core packages: standardize chapter name and GPG information.
2020-04-13 23:25:48 +01:00
73 changed files with 11432 additions and 2681 deletions

47
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,47 @@
on:
push:
pull_request:
jobs:
########### Linux ###########
linux:
name: ci
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
# don't run pull requests from local branches twice
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
include:
- server: x11
graphics: cairo
- server: x11
graphics: xlib
- server: headless
graphics: headless
env:
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v3
- name: Install packages
run: |
apt-get -q -y update
apt-get -q -y install libgnustep-gui-dev libfreetype-dev libcairo2-dev libxt-dev pkg-config build-essential
- name: Build source
run: |
. /usr/share/GNUstep/Makefiles/GNUstep.sh
./configure --enable-server=${{ matrix.server }} --enable-graphics=${{ matrix.graphics }}
make && make install
- name: Run tests
run: |
. /usr/share/GNUstep/Makefiles/GNUstep.sh
make check

View file

@ -1,7 +1,7 @@
1 ANNOUNCE
**********
1 Announcement
**************
This is version 0.28.0 of the GNUstep GUI Backend ('gnustep-back').
This is version 0.32.0 of the GNUstep GUI Backend (gnustep-back).
1.1 What is the GNUstep GUI Backend?
====================================
@ -20,30 +20,27 @@ easily ported to other display systems.
Window's Systems. It works via a DPS emulation engine to emulate the
DPS functions required by the front-end system.
1.2 Noteworthy changes in version '0.28.0'
1.2 Noteworthy changes in version 0.32.0
==========================================
This release includes a few bugfixes and a huge rework of multi monitor
handling.
The release includes mostly bug fixes.
* Improved focus handling for WindowMaker interaction.
* Cursor improvements.
* Better handling of fonts with fontconfig.
* Simplify code that converts images for X11.
* art: Remove ftfont-old.m.
* Use Xrandr for multi monitor support.
• Make window termination saver.
• Use default interpolation in Cairo.
• Allow UTF-8 input from XLookupString.
• Improve building on MS Windows.
1.3 Where can you get it? How can you compile it?
=================================================
The gnustep-back-0.28.0.tar.gz distribution file has been placed at
The gnustep-back-0.32.0.tar.gz distribution file has been placed at
<ftp://ftp.gnustep.org/pub/gnustep/core>.
It is accompanied by gnustep-back-0.28.0.tar.gz.sig, a PGP signature
It is accompanied by gnustep-back-0.32.0.tar.gz.sig, a PGP signature
which you can validate by putting both files in the same directory and
using:
gpg --verify gnustep-back-0.28.0.tar.gz.sig
gpg --verify gnustep-back-0.32.0.tar.gz.sig
Signature has been created using the key with the following
fingerprint:
@ -56,10 +53,12 @@ instructions.
1.4 Where do I send bug reports?
================================
Bug reports can be sent to the GNUstep bug list <bug-gnustep@gnu.org>
Please log bug reports on the GNUstep project page
<http://savannah.gnu.org/bugs/?group=gnustep> or send bug reports to
<bug-gnustep@gnu.org>.
1.5 Obtaining GNU Software
==========================
1.5 Obtaining GNUstep Software
==============================
Check out the GNUstep web site. (<http://www.gnustep.org/>) and the GNU
web site. (<http://www.gnu.org/>)

179
ChangeLog
View file

@ -1,3 +1,182 @@
2025-02-11 Richard Frith-Macdonald <rfm@gnu.org>
* ANNOUNCE:
* INSTALL:
* NEWS:
* README:
* Version: bump to 0.32.0
New release
2024-05-26 Fred Kiefer <FredKiefer@gmx.de>
* ChangeLog: Update for new release
* ANNOUNCE:
* NEWS:
* Documentation/news.texi: Update of release notes for 0.31.0.
* Version: bump to 0.31.0
2022-12-29 Richard Frith-Macdonald <rfm@gnu.org>
* ChangeLog: Update for new release
* ANNOUNCE:
* NEWS:
* Documentation/news.texi: Update of release notes for 0.30.0 by Fred.
* Version: bump to 0.30.0
2022-02-22 Riccardo Mottola <rm@gnu.org>
* Tools/xpbs.m (xSelectionNotify:):
Delete property on begin and at every Notify to start and continue
transfer of INCR.
2020-04-26 Ivan Vucica <ivan@vucica.net>
* ANNOUNCE:
* NEWS:
* README:
Updating documentation for the 0.29.0 release.
2021-03-12 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerWindow.m (-styleoffsets:...:): Change NSLog
statement on guessing the offset into a NSDebugLLog statement.
2021-03-03 Riccardo Mottola <rm@gnu.org>
* Source/win32/WIN32Server.m:
actually store in a LONG_PTR the result of GetWindowLongPtr
2021-03-02 Riccardo Mottola <rm@gnu.org>
* Source/win32/WIN32Server.m
* Source/win32/w32_create.m
* Source/win32/w32_general.m
* Source/win32/w32_movesize.m
* Source/win32/w32_windowdisplay.m
* Source/winlib/WIN32GState.m
* Source/cairo/Win32CairoGlitzSurface.m:
Consistently use 64bit safe SetWindowLongPtr/GetWindowLongPtr instead
of a mix with old 32bit versions.
2021-01-27 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m (_checkStyle:): do not set application
name and WindowGroupHint to temporary window. Created window designed
to help get window frame offsets only - appicon window will be created
later. This change prevents appicon flickering on WindowMaker at
application start.
(_createWMAppiconHack, _setupRootWindow): WindowMaker hack removed in
favour of solution introduced in _checkStyle:.
2021-01-24 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m: WindowMaker doesn't support
_NET_REQUEST_FRAME_EXTENTS message andthe only way to determine offsets
is creating and mapping window. In this case first mapped window of
application is not appicon window.
Early appicon creating inserted back as _createWMAppiconHack method and
called only if no other way to determine window's offsets (before call to
_checkStyle);appicon window size is set to size icon;
2021-01-16 Fred Kiefer <FredKiefer@gmx.de>
* Documentation/news.texi: Fill in some details for pending release.
* Version: Inclease version number.
2020-09-18 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m
(_setupRootWindow, window::::): removed WindowMaker appicon hack and
- now unused - _wmAppIcon variable.
Description: The removed code removed creates and maps zero-sized
window in hope that WindowMaker will recognize app by this event and
create app icon window. Although when application requests window
for appicon through the `-window::::` method call, it returns newly
created and mapped window. This actually happens but application icon
flickers between WM icon creation and application icon window appearance.
This fix based on the fact that root application window (ROOT) is mapped
in `-orderwindow:::` and this is the event of application recognition
by WindowMaker because it is a first application window that is
mapped.
2020-09-17 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerEvent.m
(_handleTakeFocusAtom:forContext:): if application (window) receives
WM_TAKE_FOCUS in hidden state it means WindowMaker wants us to be
unhidden.
Description: There are 2 protocols defined in XGServerWindow.h:
WMFHideApplication and WMFHideOtherApplications. These protocols exist
to help GNUstep application and WindowMaker notify each other
about "Hide" and "Hide Others" actions. There are no protocols for
"unhide" action.
Test case steps:
1. Open application with window opened.
2. Hide application with "Hide" menu item.
3. Open WindowMaker's "Windows" menu (middle-click on desktop).
4. Select hidden application window.
Application unhides, activates, restored window is focused (receives) input
and "Hide" menu item unselected.
2020-09-16 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m
(hideApplication:): send application's root window to WindowMaker(WM)
because it's a "group leader" that clearly identifies application
inside WM. WM uses XFindContext to get WApplication structure and
"group leader" window ID is a key to find it.
2020-06-18 Riccardo Mottola <rm@gnu.org>
* Tools/font_cacher.m:
If the Library directory is not found, create one for the user.
2020-06-18 Riccardo Mottola <rm@gnu.org>
* Source/xlib/XGFontManager.m
Match return value in case of error (nil instead of NO)
* Headers/xlib/XGPrivate.h
Fix return value of width to CGFloat
2020-06-10 Fred Kiefer <FredKiefer@gmx.de>
* Headers/fontconfig/FCFaceInfo.h: Add instancevariable _patternIsResolved.
* Source/fontconfig/FCFaceInfo.m (-matchedPattern): Cache the
resolved pattern and return this. The method characterSet now uses
this cached pattern.
Patch by Josh Freeman <gnustep_lists@twilightedge.com>
2020-04-25 Ivan Vucica <ivan@vucica.net>
* Source/GSBackend.m:
* Source/cairo/GNUmakefile:
* Source/cairo/CairoContext.m:
* Source/cairo/WaylandCairoSurface.m:
* Source/wayland/GNUmakefile:
* Source/wayland/GNUmakefile.preamble:
* Source/wayland/WaylandServer.m:
* Source/wayland/xdg-shell-protocol.c:
* Source/wayland/README.md:
* Headers/cairo/WaylandCairoSurface.h:
* Headers/wayland/WaylandServer.h:
* Headers/wayland/xdg-shell-client-protocol.h:
* wayland-regenerate.h:
* configure:
* configure.ac:
Initial merge of the Wayland backend into the master branch.
2020-04-13 Ivan Vucica <ivan@vucica.net>
* Documentation/announce.texi:
* ANNOUNCE:
Normalize the accompanying text for the release announcement across
core packages: standardize chapter name and GPG information.
2020-04-05 Ivan Vucica <ivan@vucica.net>
* ANNOUNCE:

View file

@ -1,10 +1,10 @@
@c -*- texinfo -*-
@chapter ANNOUNCE
@chapter Announcement
@ifset TEXT-ONLY
@include version.texi
@end ifset
This is version @value{GNUSTEP-BACK-VERSION} of the GNUstep GUI Backend
This is version @value{GNUSTEP-BACK-VERSION} of the GNUstep GUI Backend
(@samp{gnustep-back}).
@section What is the GNUstep GUI Backend?
@ -32,9 +32,10 @@ emulate the DPS functions required by the front-end system.
@ifset GNUSTEP-BACK-FTP-MACHINE
The gnustep-back-@value{GNUSTEP-BACK-VERSION}.tar.gz distribution
file has been placed at @url{ftp://@value{GNUSTEP-BACK-FTP-MACHINE}/@value{GNUSTEP-BACK-FTP-DIRECTORY}}.
@end ifset
It is accompanied by gnustep-back-@value{GNUSTEP-BACK-VERSION}.tar.gz.sig, a PGP signature which you can validate by putting both files in the same directory and using:
It is accompanied by gnustep-back-@value{GNUSTEP-BACK-VERSION}.tar.gz.sig, a
PGP signature which you can validate by putting both files in the same
directory and using:
@example
gpg --verify gnustep-back-@value{GNUSTEP-BACK-VERSION}.tar.gz.sig
@ -45,15 +46,18 @@ Signature has been created using the key with the following fingerprint:
@example
83AA E47C E829 A414 6EF8 3420 CA86 8D4C 9914 9679
@end example
@end ifset
Read the INSTALL file or the GNUstep-HOWTO for installation instructions.
@section Where do I send bug reports?
Bug reports can be sent to the GNUstep bug list
@email{bug-gnustep@@gnu.org}
Please log bug reports on the GNUstep project page
@url{http://savannah.gnu.org/bugs/?group=gnustep} or send
bug reports to @email{bug-gnustep@@gnu.org}.
@section Obtaining GNU Software
@section Obtaining GNUstep Software
Check out the GNUstep web site. (@url{http://www.gnustep.org/}) and the
GNU web site. (@url{http://www.gnu.org/})

View file

@ -7,6 +7,58 @@
@include version.texi
@end ifset
@section Noteworthy changes in version @samp{0.32.0}
The release includes mostly bug fixes.
@itemize @bullet
@item Make window termination saver.
@item Use default interpolation in Cairo.
@item Allow UTF-8 input from XLookupString.
@item Improve building on MS Windows.
@end itemize
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.31.0}
The release includes mostly improvements for pasteboard handling and a few bug fixes.
@itemize @bullet
@item Improve font name creation.
@item Add headless backend.
@item Add CI pipeline.
@end itemize
@section Noteworthy changes in version @samp{0.30.0}
The release includes mostly improvements for the new Wayland backend and a few bug fixes.
@itemize @bullet
@item Improvements for the wayland backend.
@item Don't use font hinting for cauro, when using scaling.
@item Fix pasteboard transfer of huge data by deleting property on begin
and at every Notify.
@end itemize
@section Noteworthy changes in version @samp{0.29.0}
The release includes an alpha version of the wayland backend and a few
bug fixes.
@itemize @bullet
@item Alpha version of the wayland backend.
@item Improved focus handling for WindowMaker interaction.
@item Speed up for font pattern resolving.
@item Improved appicon behavior under WindowMaker.
@item Prevent appicon flickering on WindowMaker at application start.
@item On Windows, consistently use @code{GetWindowLongPtr} and
@code{SetWindowLongPtr} in place of @code{GetWindowLong} and
@code{SetWindowLong} for win32 and cairo for various win64 fixes.
@end itemize
@section Noteworthy changes in version @samp{0.28.0}
This release includes a few bugfixes and a huge rework of multi monitor handling.
@ -20,7 +72,6 @@ This release includes a few bugfixes and a huge rework of multi monitor handling
@item Use Xrandr for multi monitor support.
@end itemize
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.27.0}
This release includes a few bugfixes.

View file

@ -0,0 +1,54 @@
/*
WaylandCairoShmSurface.h
Copyright (C) 2020 Free Software Foundation, Inc.
Author: Sergio L. Pascual <slp@sinrega.org>
Date: February 2016
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef WaylandCairoShmSurface_h
#define WaylandCairoShmSurface_h
#include "cairo/CairoSurface.h"
struct pool_buffer
{
int poolfd;
struct wl_shm_pool *pool;
struct wl_buffer *buffer;
cairo_surface_t *surface;
uint32_t width, height;
void *data;
size_t size;
bool busy;
};
struct pool_buffer *
createShmBuffer(int width, int height, struct wl_shm *shm);
@interface WaylandCairoShmSurface : CairoSurface
{
}
- (void)destroySurface;
@end
#endif

View file

@ -46,6 +46,7 @@
NSString *_familyName;
NSCharacterSet *_characterSet;
BOOL _hasNoCharacterSet;
BOOL _patternIsResolved;
}
- (id) initWithfamilyName: (NSString *)familyName

View file

@ -0,0 +1,33 @@
/*
HeadlessContext.h
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef HeadlessContext_h
#define HeadlessContext_h
#include "gsc/GSContext.h"
@interface HeadlessContext : GSContext
@end
#endif /* HeadlessContext_h */

View file

@ -0,0 +1,42 @@
/*
HeadlessFaceInfo.h
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
Based on work by: Banlu Kemiyatorn <object at gmail dot com>
Based on work by: Alexander Malmberg <alexander@malmberg.org>
Based on work by: Fred Kiefer <fredkiefer@gmx.de>
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef HeadlessFaceInfo_h
#define HeadlessFaceInfo_h
#include <Foundation/NSObject.h>
@interface HeadlessFaceInfo : NSObject
{
void *_fontFace;
}
- (void *)fontFace;
@end
#endif /* HeadlessFaceInfo_h */

View file

@ -0,0 +1,41 @@
/*
HeadlessFontEnumeartorInfo.h
Copyright (C) 2003 Free Software Foundation, Inc.
Based on work by: Banlu Kemiyatorn <object at gmail dot com>
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef HeadlessFontEnumerator_h
#define HeadlessFontEnumerator_h
#include <GNUstepGUI/GSFontInfo.h>
#include "headless/HeadlessFaceInfo.h"
@interface HeadlessFontEnumerator : GSFontEnumerator
{
}
+ (Class) faceInfoClass;
+ (HeadlessFaceInfo *) fontWithName: (NSString *)name;
@end
#endif /* HeadlessFontEnumerator_h */

View file

@ -0,0 +1,35 @@
/*
HeadlessFontInfo.h
Copyright (C) 2003 Free Software Foundation, Inc.
Based on work by: Banlu Kemiyatorn <object at gmail dot com>
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef HeadlessFontInfo_h
#define HeadlessFontInfo_h
#include <GNUstepGUI/GSFontInfo.h>
@interface HeadlessFontInfo : GSFontInfo
@end
#endif /* HeadlessFontInfo_h */

View file

@ -0,0 +1,37 @@
/*
HeadlessGState.h
Copyright (C) 2004 Free Software Foundation, Inc.
Based on work by: Banlu Kemiyatorn <object at gmail dot com>
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef HeadlessGState_h
#define HeadlessGState_h
#include "gsc/GSGState.h"
@interface HeadlessGState : GSGState
{
}
@end
#endif /* HeadlessGState_h */

View file

@ -0,0 +1,37 @@
/*
HeadlessServer.h
Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef HeadlessServer_h
#define HeadlessServer_h
#include "config.h"
#include <GNUstepGUI/GSDisplayServer.h>
@interface HeadlessServer : GSDisplayServer
{
}
@end
#endif /* HeadlessServer_h */

187
Headers/wayland/WaylandServer.h Executable file
View file

@ -0,0 +1,187 @@
/* <title>WaylandServer</title>
<abstract>Backend server using Wayland.</abstract>
Copyright (C) 2020 Free Software Foundation, Inc.
Author: Sergio L. Pascual <slp@sinrega.org>
Rewrite: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
Date: February 2016
This file is part of the GNUstep Backend.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _WaylandServer_h_INCLUDE
#define _WaylandServer_h_INCLUDE
#include "config.h"
#include <GNUstepGUI/GSDisplayServer.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
#include <cairo/cairo.h>
#include <xkbcommon/xkbcommon.h>
#include "cairo/CairoSurface.h"
#include "wayland/xdg-shell-client-protocol.h"
#include "wayland/wlr-layer-shell-client-protocol.h"
struct pointer
{
struct wl_pointer *wlpointer;
float x;
float y;
uint32_t last_click_button;
uint32_t last_click_time;
float last_click_x;
float last_click_y;
uint32_t button;
NSTimeInterval last_timestamp;
enum wl_pointer_button_state button_state;
uint32_t axis_source;
uint32_t serial;
struct window *focus;
struct window *captured;
};
struct cursor
{
struct wl_cursor *cursor;
struct wl_surface *surface;
struct wl_cursor_image *image;
struct wl_buffer *buffer;
};
typedef struct _WaylandConfig
{
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shell *shell;
struct wl_shm *shm;
struct wl_seat *seat;
struct wl_keyboard *keyboard;
struct xdg_wm_base *wm_base;
struct zwlr_layer_shell_v1 *layer_shell;
int seat_version;
struct wl_list output_list;
int output_count;
struct wl_list window_list;
int window_count;
int last_window_id;
// last event serial from pointer or keyboard
uint32_t event_serial;
// cursor
struct wl_cursor_theme *cursor_theme;
struct cursor *cursor;
struct wl_surface *cursor_surface;
// pointer
struct pointer pointer;
float mouse_scroll_multiplier;
// keyboard
struct xkb_context *xkb_context;
struct
{
struct xkb_keymap *keymap;
struct xkb_state *state;
xkb_mod_mask_t control_mask;
xkb_mod_mask_t alt_mask;
xkb_mod_mask_t shift_mask;
} xkb;
int modifiers;
} WaylandConfig;
struct output
{
WaylandConfig *wlconfig;
struct wl_output *output;
uint32_t server_output_id;
struct wl_list link;
int alloc_x;
int alloc_y;
int width;
int height;
int transform;
int scale;
char *make;
char *model;
void *user_data;
};
struct window
{
WaylandConfig *wlconfig;
id instance;
int window_id;
struct wl_list link;
BOOL configured; // surface has been configured once
BOOL buffer_needs_attach; // there is a new buffer avaialble for the surface
BOOL terminated;
BOOL moving;
BOOL resizing;
BOOL ignoreMouse;
float pos_x;
float pos_y;
float width;
float height;
float saved_pos_x;
float saved_pos_y;
int is_out;
int level;
struct wl_surface *surface;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *toplevel;
struct xdg_popup *popup;
struct xdg_positioner *positioner;
struct zwlr_layer_surface_v1 *layer_surface;
struct output *output;
CairoSurface *wcs;
};
struct window *get_window_with_id(WaylandConfig *wlconfig, int winid);
@interface WaylandServer : GSDisplayServer
{
WaylandConfig *wlconfig;
BOOL _mouseInitialized;
}
@end
@interface
WaylandServer (Cursor)
- (void)initializeMouseIfRequired;
@end
#endif /* _WaylandServer_h_INCLUDE */

View file

@ -0,0 +1,597 @@
/* Generated by wayland-scanner 1.18.0 */
#ifndef WLR_LAYER_SHELL_UNSTABLE_V1_CLIENT_PROTOCOL_H
#define WLR_LAYER_SHELL_UNSTABLE_V1_CLIENT_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-client.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @page page_wlr_layer_shell_unstable_v1 The wlr_layer_shell_unstable_v1 protocol
* @section page_ifaces_wlr_layer_shell_unstable_v1 Interfaces
* - @subpage page_iface_zwlr_layer_shell_v1 - create surfaces that are layers of the desktop
* - @subpage page_iface_zwlr_layer_surface_v1 - layer metadata interface
* @section page_copyright_wlr_layer_shell_unstable_v1 Copyright
* <pre>
*
* Copyright © 2017 Drew DeVault
*
* Permission to use, copy, modify, distribute, and sell this
* software and its documentation for any purpose is hereby granted
* without fee, provided that the above copyright notice appear in
* all copies and that both that copyright notice and this permission
* notice appear in supporting documentation, and that the name of
* the copyright holders not be used in advertising or publicity
* pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
* </pre>
*/
struct wl_output;
struct wl_surface;
struct xdg_popup;
struct zwlr_layer_shell_v1;
struct zwlr_layer_surface_v1;
/**
* @page page_iface_zwlr_layer_shell_v1 zwlr_layer_shell_v1
* @section page_iface_zwlr_layer_shell_v1_desc Description
*
* Clients can use this interface to assign the surface_layer role to
* wl_surfaces. Such surfaces are assigned to a "layer" of the output and
* rendered with a defined z-depth respective to each other. They may also be
* anchored to the edges and corners of a screen and specify input handling
* semantics. This interface should be suitable for the implementation of
* many desktop shell components, and a broad number of other applications
* that interact with the desktop.
* @section page_iface_zwlr_layer_shell_v1_api API
* See @ref iface_zwlr_layer_shell_v1.
*/
/**
* @defgroup iface_zwlr_layer_shell_v1 The zwlr_layer_shell_v1 interface
*
* Clients can use this interface to assign the surface_layer role to
* wl_surfaces. Such surfaces are assigned to a "layer" of the output and
* rendered with a defined z-depth respective to each other. They may also be
* anchored to the edges and corners of a screen and specify input handling
* semantics. This interface should be suitable for the implementation of
* many desktop shell components, and a broad number of other applications
* that interact with the desktop.
*/
extern const struct wl_interface zwlr_layer_shell_v1_interface;
/**
* @page page_iface_zwlr_layer_surface_v1 zwlr_layer_surface_v1
* @section page_iface_zwlr_layer_surface_v1_desc Description
*
* An interface that may be implemented by a wl_surface, for surfaces that
* are designed to be rendered as a layer of a stacked desktop-like
* environment.
*
* Layer surface state (layer, size, anchor, exclusive zone,
* margin, interactivity) is double-buffered, and will be applied at the
* time wl_surface.commit of the corresponding wl_surface is called.
* @section page_iface_zwlr_layer_surface_v1_api API
* See @ref iface_zwlr_layer_surface_v1.
*/
/**
* @defgroup iface_zwlr_layer_surface_v1 The zwlr_layer_surface_v1 interface
*
* An interface that may be implemented by a wl_surface, for surfaces that
* are designed to be rendered as a layer of a stacked desktop-like
* environment.
*
* Layer surface state (layer, size, anchor, exclusive zone,
* margin, interactivity) is double-buffered, and will be applied at the
* time wl_surface.commit of the corresponding wl_surface is called.
*/
extern const struct wl_interface zwlr_layer_surface_v1_interface;
#ifndef ZWLR_LAYER_SHELL_V1_ERROR_ENUM
#define ZWLR_LAYER_SHELL_V1_ERROR_ENUM
enum zwlr_layer_shell_v1_error {
/**
* wl_surface has another role
*/
ZWLR_LAYER_SHELL_V1_ERROR_ROLE = 0,
/**
* layer value is invalid
*/
ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER = 1,
/**
* wl_surface has a buffer attached or committed
*/
ZWLR_LAYER_SHELL_V1_ERROR_ALREADY_CONSTRUCTED = 2,
};
#endif /* ZWLR_LAYER_SHELL_V1_ERROR_ENUM */
#ifndef ZWLR_LAYER_SHELL_V1_LAYER_ENUM
#define ZWLR_LAYER_SHELL_V1_LAYER_ENUM
/**
* @ingroup iface_zwlr_layer_shell_v1
* available layers for surfaces
*
* These values indicate which layers a surface can be rendered in. They
* are ordered by z depth, bottom-most first. Traditional shell surfaces
* will typically be rendered between the bottom and top layers.
* Fullscreen shell surfaces are typically rendered at the top layer.
* Multiple surfaces can share a single layer, and ordering within a
* single layer is undefined.
*/
enum zwlr_layer_shell_v1_layer {
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND = 0,
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM = 1,
ZWLR_LAYER_SHELL_V1_LAYER_TOP = 2,
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY = 3,
};
#endif /* ZWLR_LAYER_SHELL_V1_LAYER_ENUM */
#define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE 0
#define ZWLR_LAYER_SHELL_V1_DESTROY 1
/**
* @ingroup iface_zwlr_layer_shell_v1
*/
#define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_shell_v1
*/
#define ZWLR_LAYER_SHELL_V1_DESTROY_SINCE_VERSION 3
/** @ingroup iface_zwlr_layer_shell_v1 */
static inline void
zwlr_layer_shell_v1_set_user_data(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) zwlr_layer_shell_v1, user_data);
}
/** @ingroup iface_zwlr_layer_shell_v1 */
static inline void *
zwlr_layer_shell_v1_get_user_data(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1)
{
return wl_proxy_get_user_data((struct wl_proxy *) zwlr_layer_shell_v1);
}
static inline uint32_t
zwlr_layer_shell_v1_get_version(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1)
{
return wl_proxy_get_version((struct wl_proxy *) zwlr_layer_shell_v1);
}
/**
* @ingroup iface_zwlr_layer_shell_v1
*
* Create a layer surface for an existing surface. This assigns the role of
* layer_surface, or raises a protocol error if another role is already
* assigned.
*
* Creating a layer surface from a wl_surface which has a buffer attached
* or committed is a client error, and any attempts by a client to attach
* or manipulate a buffer prior to the first layer_surface.configure call
* must also be treated as errors.
*
* You may pass NULL for output to allow the compositor to decide which
* output to use. Generally this will be the one that the user most
* recently interacted with.
*
* Clients can specify a namespace that defines the purpose of the layer
* surface.
*/
static inline struct zwlr_layer_surface_v1 *
zwlr_layer_shell_v1_get_layer_surface(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1, struct wl_surface *surface, struct wl_output *output, uint32_t layer, const char *namespace)
{
struct wl_proxy *id;
id = wl_proxy_marshal_constructor((struct wl_proxy *) zwlr_layer_shell_v1,
ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE, &zwlr_layer_surface_v1_interface, NULL, surface, output, layer, namespace);
return (struct zwlr_layer_surface_v1 *) id;
}
/**
* @ingroup iface_zwlr_layer_shell_v1
*
* This request indicates that the client will not use the layer_shell
* object any more. Objects that have been created through this instance
* are not affected.
*/
static inline void
zwlr_layer_shell_v1_destroy(struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_shell_v1,
ZWLR_LAYER_SHELL_V1_DESTROY);
wl_proxy_destroy((struct wl_proxy *) zwlr_layer_shell_v1);
}
#ifndef ZWLR_LAYER_SURFACE_V1_ERROR_ENUM
#define ZWLR_LAYER_SURFACE_V1_ERROR_ENUM
enum zwlr_layer_surface_v1_error {
/**
* provided surface state is invalid
*/
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SURFACE_STATE = 0,
/**
* size is invalid
*/
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE = 1,
/**
* anchor bitfield is invalid
*/
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_ANCHOR = 2,
};
#endif /* ZWLR_LAYER_SURFACE_V1_ERROR_ENUM */
#ifndef ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM
#define ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM
enum zwlr_layer_surface_v1_anchor {
/**
* the top edge of the anchor rectangle
*/
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP = 1,
/**
* the bottom edge of the anchor rectangle
*/
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM = 2,
/**
* the left edge of the anchor rectangle
*/
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT = 4,
/**
* the right edge of the anchor rectangle
*/
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT = 8,
};
#endif /* ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM */
/**
* @ingroup iface_zwlr_layer_surface_v1
* @struct zwlr_layer_surface_v1_listener
*/
struct zwlr_layer_surface_v1_listener {
/**
* suggest a surface change
*
* The configure event asks the client to resize its surface.
*
* Clients should arrange their surface for the new states, and
* then send an ack_configure request with the serial sent in this
* configure event at some point before committing the new surface.
*
* The client is free to dismiss all but the last configure event
* it received.
*
* The width and height arguments specify the size of the window in
* surface-local coordinates.
*
* The size is a hint, in the sense that the client is free to
* ignore it if it doesn't resize, pick a smaller size (to satisfy
* aspect ratio or resize in steps of NxM pixels). If the client
* picks a smaller size and is anchored to two opposite anchors
* (e.g. 'top' and 'bottom'), the surface will be centered on this
* axis.
*
* If the width or height arguments are zero, it means the client
* should decide its own window dimension.
*/
void (*configure)(void *data,
struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1,
uint32_t serial,
uint32_t width,
uint32_t height);
/**
* surface should be closed
*
* The closed event is sent by the compositor when the surface
* will no longer be shown. The output may have been destroyed or
* the user may have asked for it to be removed. Further changes to
* the surface will be ignored. The client should destroy the
* resource after receiving this event, and create a new surface if
* they so choose.
*/
void (*closed)(void *data,
struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1);
};
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
static inline int
zwlr_layer_surface_v1_add_listener(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1,
const struct zwlr_layer_surface_v1_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) zwlr_layer_surface_v1,
(void (**)(void)) listener, data);
}
#define ZWLR_LAYER_SURFACE_V1_SET_SIZE 0
#define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR 1
#define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE 2
#define ZWLR_LAYER_SURFACE_V1_SET_MARGIN 3
#define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY 4
#define ZWLR_LAYER_SURFACE_V1_GET_POPUP 5
#define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE 6
#define ZWLR_LAYER_SURFACE_V1_DESTROY 7
#define ZWLR_LAYER_SURFACE_V1_SET_LAYER 8
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_CONFIGURE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_CLOSED_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_SIZE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_MARGIN_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_GET_POPUP_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_DESTROY_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_LAYER_SINCE_VERSION 2
/** @ingroup iface_zwlr_layer_surface_v1 */
static inline void
zwlr_layer_surface_v1_set_user_data(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) zwlr_layer_surface_v1, user_data);
}
/** @ingroup iface_zwlr_layer_surface_v1 */
static inline void *
zwlr_layer_surface_v1_get_user_data(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1)
{
return wl_proxy_get_user_data((struct wl_proxy *) zwlr_layer_surface_v1);
}
static inline uint32_t
zwlr_layer_surface_v1_get_version(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1)
{
return wl_proxy_get_version((struct wl_proxy *) zwlr_layer_surface_v1);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
*
* Sets the size of the surface in surface-local coordinates. The
* compositor will display the surface centered with respect to its
* anchors.
*
* If you pass 0 for either value, the compositor will assign it and
* inform you of the assignment in the configure event. You must set your
* anchor to opposite edges in the dimensions you omit; not doing so is a
* protocol error. Both values are 0 by default.
*
* Size is double-buffered, see wl_surface.commit.
*/
static inline void
zwlr_layer_surface_v1_set_size(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t width, uint32_t height)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
ZWLR_LAYER_SURFACE_V1_SET_SIZE, width, height);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
*
* Requests that the compositor anchor the surface to the specified edges
* and corners. If two orthogonal edges are specified (e.g. 'top' and
* 'left'), then the anchor point will be the intersection of the edges
* (e.g. the top left corner of the output); otherwise the anchor point
* will be centered on that edge, or in the center if none is specified.
*
* Anchor is double-buffered, see wl_surface.commit.
*/
static inline void
zwlr_layer_surface_v1_set_anchor(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t anchor)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
ZWLR_LAYER_SURFACE_V1_SET_ANCHOR, anchor);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
*
* Requests that the compositor avoids occluding an area with other
* surfaces. The compositor's use of this information is
* implementation-dependent - do not assume that this region will not
* actually be occluded.
*
* A positive value is only meaningful if the surface is anchored to one
* edge or an edge and both perpendicular edges. If the surface is not
* anchored, anchored to only two perpendicular edges (a corner), anchored
* to only two parallel edges or anchored to all edges, a positive value
* will be treated the same as zero.
*
* A positive zone is the distance from the edge in surface-local
* coordinates to consider exclusive.
*
* Surfaces that do not wish to have an exclusive zone may instead specify
* how they should interact with surfaces that do. If set to zero, the
* surface indicates that it would like to be moved to avoid occluding
* surfaces with a positive exclusive zone. If set to -1, the surface
* indicates that it would not like to be moved to accommodate for other
* surfaces, and the compositor should extend it all the way to the edges
* it is anchored to.
*
* For example, a panel might set its exclusive zone to 10, so that
* maximized shell surfaces are not shown on top of it. A notification
* might set its exclusive zone to 0, so that it is moved to avoid
* occluding the panel, but shell surfaces are shown underneath it. A
* wallpaper or lock screen might set their exclusive zone to -1, so that
* they stretch below or over the panel.
*
* The default value is 0.
*
* Exclusive zone is double-buffered, see wl_surface.commit.
*/
static inline void
zwlr_layer_surface_v1_set_exclusive_zone(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, int32_t zone)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE, zone);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
*
* Requests that the surface be placed some distance away from the anchor
* point on the output, in surface-local coordinates. Setting this value
* for edges you are not anchored to has no effect.
*
* The exclusive zone includes the margin.
*
* Margin is double-buffered, see wl_surface.commit.
*/
static inline void
zwlr_layer_surface_v1_set_margin(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, int32_t top, int32_t right, int32_t bottom, int32_t left)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
ZWLR_LAYER_SURFACE_V1_SET_MARGIN, top, right, bottom, left);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
*
* Set to 1 to request that the seat send keyboard events to this layer
* surface. For layers below the shell surface layer, the seat will use
* normal focus semantics. For layers above the shell surface layers, the
* seat will always give exclusive keyboard focus to the top-most layer
* which has keyboard interactivity set to true.
*
* Layer surfaces receive pointer, touch, and tablet events normally. If
* you do not want to receive them, set the input region on your surface
* to an empty region.
*
* Events is double-buffered, see wl_surface.commit.
*/
static inline void
zwlr_layer_surface_v1_set_keyboard_interactivity(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t keyboard_interactivity)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY, keyboard_interactivity);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
*
* This assigns an xdg_popup's parent to this layer_surface. This popup
* should have been created via xdg_surface::get_popup with the parent set
* to NULL, and this request must be invoked before committing the popup's
* initial state.
*
* See the documentation of xdg_popup for more details about what an
* xdg_popup is and how it is used.
*/
static inline void
zwlr_layer_surface_v1_get_popup(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, struct xdg_popup *popup)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
ZWLR_LAYER_SURFACE_V1_GET_POPUP, popup);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
*
* When a configure event is received, if a client commits the
* surface in response to the configure event, then the client
* must make an ack_configure request sometime before the commit
* request, passing along the serial of the configure event.
*
* If the client receives multiple configure events before it
* can respond to one, it only has to ack the last configure event.
*
* A client is not required to commit immediately after sending
* an ack_configure request - it may even ack_configure several times
* before its next surface commit.
*
* A client may send multiple ack_configure requests before committing, but
* only the last request sent before a commit indicates which configure
* event the client really is responding to.
*/
static inline void
zwlr_layer_surface_v1_ack_configure(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t serial)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE, serial);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
*
* This request destroys the layer surface.
*/
static inline void
zwlr_layer_surface_v1_destroy(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
ZWLR_LAYER_SURFACE_V1_DESTROY);
wl_proxy_destroy((struct wl_proxy *) zwlr_layer_surface_v1);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
*
* Change the layer that the surface is rendered on.
*
* Layer is double-buffered, see wl_surface.commit.
*/
static inline void
zwlr_layer_surface_v1_set_layer(struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t layer)
{
wl_proxy_marshal((struct wl_proxy *) zwlr_layer_surface_v1,
ZWLR_LAYER_SURFACE_V1_SET_LAYER, layer);
}
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -73,13 +73,13 @@ extern unsigned long XGFontPropULong(Display *dpy, XFontStruct *font_struct,
- (void) draw: (const char*) s length: (int) len
onDisplay: (Display*) xdpy drawable: (Drawable) draw
with: (GC) xgcntxt at: (XPoint) xp;
- (float) widthOf: (const char*) s length: (int) len;
- (CGFloat) widthOf: (const char*) s length: (int) len;
- (void) setActiveFor: (Display*) xdpy gc: (GC) xgcntxt;
- (void) drawGlyphs: (const NSGlyph *) glyphs length: (int) len
onDisplay: (Display*) xdpy drawable: (Drawable) draw
with: (GC) xgcntxt at: (XPoint) xp;
- (float) widthOfGlyphs: (const NSGlyph *) glyphs length: (int) len;
- (CGFloat) widthOfGlyphs: (const NSGlyph *) glyphs length: (int) len;
@end

12
INSTALL
View file

@ -5,7 +5,7 @@
================
This file documents the installation of the GNUstep Backend Library,
'gnustep-back'. If you are installing this package as part of the
gnustep-back. If you are installing this package as part of the
GNUstep core package, read the file GNUstep-HOWTO for more complete
instructions on how to install the entire GNUstep package (including
this library). GNUstep-HOWTO is located at <http://www.gnustep.org>
@ -15,9 +15,9 @@ this library). GNUstep-HOWTO is located at <http://www.gnustep.org>
1.2 Configuration
=================
Configuration is performed by running the 'configure' program at a shell
Configuration is performed by running the configure program at a shell
prompt. You may want to use some of the optional arguments to the
'configure' program. Type 'configure --help' for a list. GNUstep
configure program. Type configure --help for a list. GNUstep
specific options are at the end of this list (if any).
The backend comes with several different window server and graphics
@ -27,7 +27,7 @@ choose the art graphical drawing implementation, run
configure --enable-graphics=art
Type 'configure --help' for a list of graphical drawing
Type configure --help for a list of graphical drawing
implementations.
You can also change the name of the backend when configuring it.
@ -52,8 +52,8 @@ program:
To compile this library, type make. After this is complete, type make
install (make sure you are the root user). Some additional options you
can use with make are 'debug=yes' to make a debugging version of the
library and 'shared=no' to make a static version of the library. See
can use with make are debug=yes to make a debugging version of the
library and shared=no to make a static version of the library. See
the gstep-make package for more information on these options.
1.4 Installing

214
NEWS
View file

@ -1,64 +1,110 @@
1 NEWS
******
1.1 Noteworthy changes in version '0.28.0'
1.1 Noteworthy changes in version 0.32.0
==========================================
The release includes mostly bug fixes.
• Make window termination saver.
• Use default interpolation in Cairo.
• Allow UTF-8 input from XLookupString.
• Improve building on MS Windows.
1.2 Noteworthy changes in version 0.31.0
==========================================
The release includes mostly improvements for pasteboard handling and a
few bug fixes.
• Improve font name creation.
• Add headless backend.
• Add CI pipeline.
1.3 Noteworthy changes in version 0.30.0
==========================================
The release includes mostly improvements for the new Wayland backend and
a few bug fixes.
• Improvements for the wayland backend.
• Don't use font hinting for cauro, when using scaling.
• Fix pasteboard transfer of huge data by deleting property on begin
and at every Notify.
1.4 Noteworthy changes in version 0.29.0
==========================================
The release includes an alpha version of the wayland backend and a few
bug fixes.
• Alpha version of the wayland backend.
• Improved focus handling for WindowMaker interaction.
• Speed up for font pattern resolving.
• Improved appicon behavior under WindowMaker.
• Prevent appicon flickering on WindowMaker at application start.
• On Windows, consistently use GetWindowLongPtr and
SetWindowLongPtr in place of GetWindowLong and SetWindowLong
for win32 and cairo for various win64 fixes.
1.5 Noteworthy changes in version 0.28.0
==========================================
This release includes a few bugfixes and a huge rework of multi monitor
handling.
* Improved focus handling for WindowMaker interaction.
* Cursor improvements.
* Better handling of fonts with fontconfig.
* Simplify code that converts images for X11.
* art: Remove ftfont-old.m.
* Use Xrandr for multi monitor support.
Improved focus handling for WindowMaker interaction.
Cursor improvements.
Better handling of fonts with fontconfig.
Simplify code that converts images for X11.
art: Remove ftfont-old.m.
Use Xrandr for multi monitor support.
1.2 Noteworthy changes in version '0.27.0'
1.6 Noteworthy changes in version 0.27.0
==========================================
This release includes a few bugfixes.
* configure: Improve configuration.
* xlib: Improve xft font classes.
* x11: Enable drawing in secondary threads.
* x11: Better handling of atoms. Method to get the window manager.
* opal: Improve colour handling
configure: Improve configuration.
xlib: Improve xft font classes.
x11: Enable drawing in secondary threads.
x11: Better handling of atoms. Method to get the window manager.
opal: Improve colour handling
1.3 Noteworthy changes in version '0.26.2'
1.7 Noteworthy changes in version 0.26.2
==========================================
This release contains no changes since 0.26.1. It is released to
coincide with gnustep-gui 0.26.2, which has important bugfixes related
to printing.
1.4 Noteworthy changes in version '0.26.1'
1.8 Noteworthy changes in version 0.26.1
==========================================
This release contains no changes since 0.26.0. It is released to
coincide with gnustep-gui 0.26.1, released to mark gnustep-base 1.25.1
as the requirement for gnustep-gui.
1.5 Noteworthy changes in version '0.26.0'
1.9 Noteworthy changes in version 0.26.0
==========================================
This release includes a few bugfixes, as well as compatibility
improvements as a result of GSoC 2017 project.
* opal: Bridging categories between Opal and GNUstep GUI. Added onto
opal: Bridging categories between Opal and GNUstep GUI. Added onto
NSColor, NSImage and NSImageRep.
* cairo: Get -DPSshow: to work on scaled windows.
* opal: Allow creating a NSGraphicsContext with a custom graphics
cairo: Get -DPSshow: to work on scaled windows.
opal: Allow creating a NSGraphicsContext with a custom graphics
port, other than a CGContext.
* misc: Fix reported static analyser warnings.
misc: Fix reported static analyser warnings.
1.6 Noteworthy changes in version '0.25.1'
==========================================
1.10 Noteworthy changes in version 0.25.1
===========================================
Small fixes and cleanups.
1.7 Noteworthy changes in version '0.25.0'
==========================================
1.11 Noteworthy changes in version 0.25.0
===========================================
Support for pattern phase, compositing operation, image interpolation
and antialiasing per gstate.
@ -69,28 +115,28 @@ and antialiasing per gstate.
Various fixes.
1.8 Noteworthy changes in version '0.24.1'
==========================================
1.12 Noteworthy changes in version 0.24.1
===========================================
Improvements in win32 display and mouse tracking.
Various minor bugfixes and cleanups.
1.9 Noteworthy changes in version '0.24.0'
==========================================
1.13 Noteworthy changes in version 0.24.0
===========================================
Added experimental Opal backend.
Allow for ARGB visual for OpenGL.
1.10 Noteworthy changes in version '0.23.0'
1.14 Noteworthy changes in version 0.23.0
===========================================
Added cairo support for ms-windows.
Updated for NSInteger/CGFloat support
1.11 Noteworthy changes in version '0.22.0'
1.15 Noteworthy changes in version 0.22.0
===========================================
Added new user defaults to make app icons and mini windows sticky
@ -99,7 +145,7 @@ Added new user defaults to make app icons and mini windows sticky
Many improvements to Cairo rendering, including buffering, glyphs and
DPI scaling.
1.12 Noteworthy changes in version '0.20.0'
1.16 Noteworthy changes in version 0.20.0
===========================================
Cairo is now the default backend, but falls back to art and xlib
@ -109,37 +155,37 @@ gracefully.
More Windows improvements.
1.13 Noteworthy changes in version '0.19.0'
1.17 Noteworthy changes in version 0.19.0
===========================================
This is an (unstable) copy of the 0.18.0 release
1.14 Noteworthy changes in version '0.18.0'
1.18 Noteworthy changes in version 0.18.0
===========================================
Many Windows improvements
Implement pattern colours for all backends.
1.15 Noteworthy changes in version '0.17.1'
1.19 Noteworthy changes in version 0.17.1
===========================================
Use DejaVu as another fallback font.
1.16 Noteworthy changes in version '0.17.0'
1.20 Noteworthy changes in version 0.17.0
===========================================
Key repeat support implemented in X11.
OpenGL fixes and improvements.
1.17 Noteworthy changes in version '0.16.0'
1.21 Noteworthy changes in version 0.16.0
===========================================
Transparent windows implemented in WIN32 backend, better position and
scaling of images. General cleanup of code.
1.18 Noteworthy changes in version '0.14.0'
1.22 Noteworthy changes in version 0.14.0
===========================================
Added code to automatically make any window which uses the
@ -147,7 +193,7 @@ NSDesktopWindowLevel also be omnipresent.
Many glyph drawing improvements.
1.19 Noteworthy changes in version '0.13.2'
1.23 Noteworthy changes in version 0.13.2
===========================================
Added basic implementation of window levels on Windows. In general a
@ -161,24 +207,24 @@ bunch of improvements in the Windows backend.
frontend. This version or greater of the backend needs to be used with
gui 0.13.2
1.20 Noteworthy changes in version '0.13.1'
1.24 Noteworthy changes in version 0.13.1
===========================================
Minor improvements.
1.21 Noteworthy changes in version '0.13.0'
1.25 Noteworthy changes in version 0.13.0
===========================================
Many improvements to the cairo backend. Add DPSshfill for all backends.
Better handling of X event times.
1.22 Noteworthy changes in version '0.12.0'
1.26 Noteworthy changes in version 0.12.0
===========================================
Big improvements to the cairo graphics and Window backend. Also better
support for OpenGL.
1.23 Noteworthy changes in version '0.11.0'
1.27 Noteworthy changes in version 0.11.0
===========================================
Bugfixes to art and xlib.
@ -186,17 +232,17 @@ Bugfixes to art and xlib.
There was some work on the Windows backend for the GDI interface by
Christopher Armstrong.
1.24 Noteworthy changes in version '0.10.3'
1.28 Noteworthy changes in version 0.10.3
===========================================
Fixes. A lot of Cairo backend work.
1.25 Noteworthy changes in version '0.10.2'
1.29 Noteworthy changes in version 0.10.2
===========================================
The Backend can set UTF8 window titles where this is allowed.
1.26 Noteworthy changes in version '0.10.1'
1.30 Noteworthy changes in version 0.10.1
===========================================
The art graphics module is the default now. As was previously the case,
@ -213,69 +259,69 @@ Cairo library before it will work with GNUstep. Due to this, this
module is still considered beta. Ask on the mailing lists for help with
this.
1.27 Noteworthy changes in version '0.10.0'
1.31 Noteworthy changes in version 0.10.0
===========================================
The installed name of the backend now includes an interface version
number. This avoids the potential version mismatch between the frontend
(GUI) library and the backend.
* Alpha blending was implemented for Windows, although it does not
Alpha blending was implemented for Windows, although it does not
seem to work on some machines.
1.28 Noteworthy changes in version '0.9.5'
1.32 Noteworthy changes in version 0.9.5
==========================================
* Added support for window alpha on X servers.
* Add support for old and new freetype libs.
* Some improvements to the Windows backend.
Added support for window alpha on X servers.
Add support for old and new freetype libs.
Some improvements to the Windows backend.
1.29 Noteworthy changes in version '0.9.4'
1.33 Noteworthy changes in version 0.9.4
==========================================
* Fast drawing on 8 bit displays was added (although it might only
Fast drawing on 8 bit displays was added (although it might only
speed things up on old X11 servers and/or remote servers).
* GNUstep modifier keys are mapped to KeySyms instead of KeyCodes
* Added a Cairo backend, although it is probably non-functional.
GNUstep modifier keys are mapped to KeySyms instead of KeyCodes
Added a Cairo backend, although it is probably non-functional.
Anyone is invited to contribute to making it work.
* art backend supports reading from a window.
* Add internal window decoration handling.
art backend supports reading from a window.
Add internal window decoration handling.
1.30 Noteworthy changes in version '0.9.3'
1.34 Noteworthy changes in version 0.9.3
==========================================
* A number of W32 window event enhancements
* art backend glyph drawing with alpha enhancements.
* libwraster is no longer checked for - image functions now in
A number of W32 window event enhancements
art backend glyph drawing with alpha enhancements.
libwraster is no longer checked for - image functions now in
frontend
1.31 Noteworthy changes in version '0.9.2'
1.35 Noteworthy changes in version 0.9.2
==========================================
* Art backend added support for grayscale, one-isblack colorspaces.
* Windows pasteboard interaction handling added.
* Better focus handling on Windows.
* Better font and draw handling on Windows.
Art backend added support for grayscale, one-isblack colorspaces.
Windows pasteboard interaction handling added.
Better focus handling on Windows.
Better font and draw handling on Windows.
1.32 Noteworthy changes in version '0.9.1'
1.36 Noteworthy changes in version 0.9.1
==========================================
Color on 8 bit displays works correctly now. WindowMaker properties are
always set now in case another manager is emulating WindowMaker styles.
1.33 Noteworthy changes in version '0.9.0'
1.37 Noteworthy changes in version 0.9.0
==========================================
Some more improvements to copy/paste support following ICCCM
specifications (like COMPOUND_TEXT support).
1.34 Noteworthy changes in version '0.8.9'
1.38 Noteworthy changes in version 0.8.9
==========================================
* Much improved pasting support between X apps and GNUstep apps.
* Backend headers are no longer installed (now private).
Much improved pasting support between X apps and GNUstep apps.
Backend headers are no longer installed (now private).
1.35 Noteworthy changes in version '0.8.8'
1.39 Noteworthy changes in version 0.8.8
==========================================
Full multi-byte/unicode support for East Asian languages was added to
@ -283,60 +329,60 @@ the xlib backend. The X11 server now supports use of the XIM input
method for entering non-keyboard characters. Both contributions thanks
to Kazunobu Kuriyama.
* Also added slightly better EWMH support.
* Art backend works with more versions of freetype.
Also added slightly better EWMH support.
Art backend works with more versions of freetype.
1.36 Noteworthy changes in version '0.8.7'
1.40 Noteworthy changes in version 0.8.7
==========================================
Handle NSBezierPath glyph drawing in art backend. art backend compiles
with all freetype except 2.1.3 via ifdefs.
1.37 Noteworthy changes in version '0.8.6'
1.41 Noteworthy changes in version 0.8.6
==========================================
Bug fixes. See the gnustep-gui NEWS for changes.
1.38 Noteworthy changes in version '0.8.5'
1.42 Noteworthy changes in version 0.8.5
==========================================
Text system improvements. See the gnustep-gui NEWS for changes.
1.39 Noteworthy changes in version '0.8.3'
1.43 Noteworthy changes in version 0.8.3
==========================================
See the gnustep-gui NEWS for changes.
1.40 Noteworthy changes in version '0.8.2'
1.44 Noteworthy changes in version 0.8.2
==========================================
Improved font handling in art backend. Improved compositing with
transformations and clipping in art backend.
1.41 Noteworthy changes in version '0.8.1'
1.45 Noteworthy changes in version 0.8.1
==========================================
art (libart-based) backend added. Use ./configure -enable-graphics=art
to choose this backend.
1.42 Noteworthy changes in version '0.8.0'
1.46 Noteworthy changes in version 0.8.0
==========================================
Bug fixes.
1.43 Noteworthy changes in version '0.7.9'
1.47 Noteworthy changes in version 0.7.9
==========================================
Bug fixes.
1.44 Noteworthy changes in version '0.7.8'
1.48 Noteworthy changes in version 0.7.8
==========================================
Simplified backend selection using -enable-server and -enable-graphics.
Add -with-library-flags and -with-include-flags for adding additonal
flags. Set name with -with-name
1.45 Noteworthy changes in version '0.7.7'
1.49 Noteworthy changes in version 0.7.7
==========================================
First release. Most components extracted from xgps. The old backends,

10
README
View file

@ -1,23 +1,23 @@
1 README
********
This is version 0.28.0 of the GNUstep GUI Backend ('gnustep-back').
This is version 0.32.0 of the GNUstep GUI Backend (gnustep-back).
Here is some introductory info to get you started:
1.1 Initial reading
===================
* The file 'ANNOUNCE' contains a very brief overview of the library.
• The file ANNOUNCE contains a very brief overview of the library.
It also tells you where to get the most recent version.
* The file 'NEWS' has the library's feature history.
• The file NEWS has the library's feature history.
* The file 'INSTALL' gives instructions for installing the library.
• The file INSTALL gives instructions for installing the library.
1.2 How can you help?
=====================
* Give us feedback! Tell us what you like; tell us what you think
Give us feedback! Tell us what you like; tell us what you think
could be better. Send us bug reports at <bug-gnustep@gnu.org>.

View file

@ -43,7 +43,7 @@ endif
#
# The list of subproject directories
#
SUBPROJECTS = gsc $(BUILD_SERVER) $(BUILD_GRAPHICS)
SUBPROJECTS = $(sort gsc $(BUILD_SERVER) $(BUILD_GRAPHICS))
libgnustep-$(BACKEND_FULL)_SUBPROJECTS=$(SUBPROJECTS)

View file

@ -45,6 +45,16 @@
@interface WIN32Server (Initialize)
+ (void) initializeBackend;
@end
#elif BUILD_SERVER == SERVER_wayland
#include <wayland/WaylandServer.h>
@interface WaylandServer (Initialize)
+ (void) initializeBackend;
@end
#elif BUILD_SERVER == SERVER_headless
#include <headless/HeadlessServer.h>
@interface HeadlessServer (Initialize)
+ (void) initializeBackend;
@end
#endif
/* Call the correct initalization routines for the choosen
@ -63,6 +73,10 @@
[XGServer initializeBackend];
#elif BUILD_SERVER == SERVER_win32
[WIN32Server initializeBackend];
#elif BUILD_SERVER == SERVER_wayland
[WaylandServer initializeBackend];
#elif BUILD_SERVER == SERVER_headless
[HeadlessServer initializeBackend];
#else
[NSException raise: NSInternalInconsistencyException
format: @"No Window Server configured in backend"];
@ -89,6 +103,8 @@
context = @"CairoContext";
#elif (BUILD_GRAPHICS==GRAPHICS_opal)
context = @"OpalContext";
#elif (BUILD_GRAPHICS==GRAPHICS_headless)
context = @"HeadlessContext";
#else
#error INVALID build graphics type
#endif

View file

@ -70,6 +70,12 @@
# define _CAIRO_SURFACE_CLASSNAME Win32CairoSurface
# include "cairo/Win32CairoSurface.h"
# endif /* USE_GLITZ */
#elif BUILD_SERVER == SERVER_wayland
# include "wayland/WaylandServer.h"
# include "cairo/CairoGState.h"
# include "cairo/WaylandCairoShmSurface.h"
# define _CAIRO_GSTATE_CLASSNAME CairoGState
# define _CAIRO_SURFACE_CLASSNAME WaylandCairoShmSurface
#else
# error Invalid server for Cairo backend : non implemented
#endif /* BUILD_SERVER */
@ -99,6 +105,16 @@
return YES;
}
- (id) initWithContextInfo: (NSDictionary *)info
{
self = [super initWithContextInfo: info];
if (self)
{
[self setImageInterpolation: NSImageInterpolationDefault];
}
return self;
}
- (BOOL) isDrawingToScreen
{
CairoSurface *surface = nil;

View file

@ -48,6 +48,7 @@ void set_font_options(cairo_font_options_t *options)
cairo_hint_metrics_t metrics = CAIRO_HINT_METRICS_ON;
cairo_hint_style_t style = CAIRO_HINT_STYLE_NONE;
int hinting = [ud integerForKey: @"GSFontHinting"];
float scale = [ud floatForKey: @"GSScaleFactor"];
int subpixel = 0;
if (hinting == 0)
@ -58,7 +59,18 @@ void set_font_options(cairo_font_options_t *options)
*/
if (nil == [ud objectForKey: @"GSFontHinting"])
{
hinting = 33;
/*
* Default hinting to off if scale is set to something other than 1.0. As
* hinting + scaling breaks assumptions about glyph advancement made in gui.
*/
if (scale == 0.0f || scale == 1.0f)
{
hinting = 33;
}
else
{
hinting = 17;
}
}
}

View file

@ -49,12 +49,16 @@ ifeq ($(BUILD_SERVER),x11)
cairo_OBJC_FILES += XGCairoSurface.m XGCairoXImageSurface.m XGCairoModernSurface.m
endif
else
ifeq ($(BUILD_GRAPHICS),cairo)
ifeq ($(WITH_GLITZ),yes)
cairo_OBJC_FILES += Win32CairoGlitzSurface.m
else
cairo_OBJC_FILES += Win32CairoSurface.m Win32CairoGState.m
# Win32CairoXImageSurface.m
ifeq ($(BUILD_SERVER),wayland)
cairo_OBJC_FILES += WaylandCairoShmSurface.m
else
ifeq ($(BUILD_GRAPHICS),cairo)
ifeq ($(WITH_GLITZ),yes)
cairo_OBJC_FILES += Win32CairoGlitzSurface.m
else
cairo_OBJC_FILES += Win32CairoSurface.m Win32CairoGState.m
# Win32CairoXImageSurface.m
endif
endif
endif
endif

View file

@ -0,0 +1,270 @@
/* WaylandCairoSurface
WaylandCairoShmSurface - A cairo surface backed by a wayland
shared memory buffer.
After the wayland surface is configured, the buffer needs to be
attached to the surface. Subsequent changes to the cairo surface
needs to be notified to the wayland server using wl_surface_damage
and wl_surface_commit. The buffer is freed after the compositor
releases it and the cairo surface is not in use.
Copyright (C) 2020 Free Software Foundation, Inc.
Author: Sergio L. Pascual <slp@sinrega.org>
Rewrite: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
Date: November 2021
This file is part of the GNU Objective C Backend Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#define _GNU_SOURCE
#include "wayland/WaylandServer.h"
#include "cairo/WaylandCairoShmSurface.h"
#include <cairo/cairo.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
static const enum wl_shm_format wl_fmt = WL_SHM_FORMAT_ARGB8888;
static const cairo_format_t cairo_fmt = CAIRO_FORMAT_ARGB32;
static void
finishBuffer(struct pool_buffer *buf)
{
// The buffer can be deleted if it has been released by the compositor
// and if not used by the cairo surface
if(buf == NULL || buf->busy || buf->surface != NULL)
{
return;
}
if (buf->buffer)
{
wl_buffer_destroy(buf->buffer);
}
if (buf->data)
{
munmap(buf->data, buf->size);
}
free(buf);
return;
}
static void
buffer_handle_release(void *data, struct wl_buffer *wl_buffer)
{
struct pool_buffer *buffer = data;
buffer->busy = false;
// If the buffer was not released before dealloc
finishBuffer(buffer);
}
static const struct wl_buffer_listener buffer_listener = {
// Sent by the compositor when it's no longer using a buffer
.release = buffer_handle_release,
};
// Creates a file descriptor for the compositor to share pixel buffers
static int
createPoolFile(off_t size)
{
static const char template[] = "/gnustep-shared-XXXXXX";
const char *path;
char *name;
int fd;
path = getenv("XDG_RUNTIME_DIR");
if (!path)
{
errno = ENOENT;
return -1;
}
name = malloc(strlen(path) + sizeof(template));
if (!name)
{
return -1;
}
strcpy(name, path);
strcat(name, template);
fd = memfd_create(name, MFD_CLOEXEC);
free(name);
if (fd < 0)
return -1;
if (ftruncate(fd, size) != 0)
{
close(fd);
return -1;
}
return fd;
}
struct pool_buffer *
createShmBuffer(int width, int height, struct wl_shm *shm)
{
uint32_t stride = cairo_format_stride_for_width(cairo_fmt, width);
size_t size = stride * height;
struct pool_buffer * buf = malloc(sizeof(struct pool_buffer));
void *data = NULL;
if (size > 0)
{
buf->poolfd = createPoolFile(size);
if (buf->poolfd == -1)
{
return NULL;
}
data
= mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, buf->poolfd, 0);
if (data == MAP_FAILED)
{
return NULL;
}
buf->pool = wl_shm_create_pool(shm, buf->poolfd, size);
buf->buffer = wl_shm_pool_create_buffer(buf->pool, 0, width, height,
stride, wl_fmt);
wl_buffer_add_listener(buf->buffer, &buffer_listener, buf);
}
else
{
return NULL;
}
buf->data = data;
buf->size = size;
buf->width = width;
buf->height = height;
buf->surface = cairo_image_surface_create_for_data(data, cairo_fmt, width, height, stride);
if(buf->pool)
{
wl_shm_pool_destroy(buf->pool);
}
return buf;
}
@implementation WaylandCairoShmSurface
{
struct pool_buffer *pbuffer;
}
- (id)initWithDevice:(void *)device
{
struct window *window = (struct window *) device;
NSDebugLog(@"WaylandCairoShmSurface: initWithDevice win=%d",
window->window_id);
gsDevice = device;
pbuffer = createShmBuffer(window->width, window->height, window->wlconfig->shm);
if (pbuffer == NULL)
{
NSDebugLog(@"failed to obtain buffer");
return nil;
}
_surface = pbuffer->surface;
window->buffer_needs_attach = YES;
if (_surface == NULL)
{
NSDebugLog(@"can't create cairo surface");
return nil;
}
if (window->configured)
{
// we can attach a buffer to the surface only if the surface is configured
// this is usually done in the configure event handler
// in case of resize of an already configured surface
// we should reattach the new allocated buffer
NSDebugLog(@"wl_surface_attach: win=%d",
window->window_id);
window->buffer_needs_attach = NO;
wl_surface_attach(window->surface, pbuffer->buffer, 0, 0);
wl_surface_commit(window->surface);
}
window->wcs = self;
return self;
}
- (void)dealloc
{
struct window *window = (struct window *) gsDevice;
NSDebugLog(@"WaylandCairoSurface: dealloc win=%d", window->window_id);
cairo_surface_destroy(_surface);
_surface = NULL;
pbuffer->surface = NULL;
// try to free the buffer if already released by the compositor
finishBuffer(pbuffer);
[super dealloc];
}
- (NSSize)size
{
if (_surface == NULL)
{
return NSZeroSize;
}
return NSMakeSize(cairo_image_surface_get_width(_surface),
cairo_image_surface_get_height(_surface));
}
- (void)handleExposeRect:(NSRect)rect
{
struct window *window = (struct window *) gsDevice;
NSDebugLog(@"[CairoSurface handleExposeRect] %d", window->window_id);
window->buffer_needs_attach = YES;
if (window->configured)
{
window->buffer_needs_attach = NO;
wl_surface_attach(window->surface, pbuffer->buffer, 0, 0);
NSDebugLog(@"[%d] updating region: %d,%d %fx%f", window->window_id, 0, 0,
window->width, window->height);
// FIXME we should update only the damaged area defined as x,y,width,
// height at the moment it doesnt work
wl_surface_damage(window->surface, 0, 0, window->width, window->height);
wl_surface_commit(window->surface);
wl_display_dispatch_pending(window->wlconfig->display);
wl_display_flush(window->wlconfig->display);
}
}
- (void)destroySurface
{
// noop this is an offscreen surface
// no need to destroy it when not visible
}
@end

View file

@ -57,7 +57,7 @@
gsDevice = device;
GetClientRect(GSWINDEVICE, &sz);
win = (WIN_INTERN *)GetWindowLong(GSWINDEVICE, GWL_USERDATA);
win = (WIN_INTERN *)GetWindowLongPtr(GSWINDEVICE, GWLP_USERDATA);
if (win && win->useHDC)
{
HGDIOBJ old;

View file

@ -39,7 +39,7 @@
{
if (self)
{
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)device, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)device, GWLP_USERDATA);
HDC hDC = GetDC((HWND)device);
// Save/set initial state...

View file

@ -133,27 +133,32 @@
- (FcPattern *) matchedPattern
{
FcResult result;
FcPattern *resolved;
FcConfigSubstitute(NULL, _pattern, FcMatchPattern);
FcDefaultSubstitute(_pattern);
resolved = FcFontMatch(NULL, _pattern, &result);
return resolved;
}
- (NSCharacterSet*)characterSet
{
if (_characterSet == nil && !_hasNoCharacterSet)
if (!_patternIsResolved)
{
FcResult result;
FcPattern *resolved;
FcCharSet *charset;
FcConfigSubstitute(NULL, _pattern, FcMatchPattern);
FcDefaultSubstitute(_pattern);
resolved = FcFontMatch(NULL, _pattern, &result);
FcPatternDestroy(_pattern);
_pattern = resolved;
_patternIsResolved = YES;
}
// The caller expects ownership of returned pattern and will destroy it
FcPatternReference(_pattern);
return _pattern;
}
- (NSCharacterSet*) characterSet
{
if (_characterSet == nil && !_hasNoCharacterSet)
{
FcPattern *resolved;
FcCharSet *charset;
resolved = [self matchedPattern];
if (FcResultMatch == FcPatternGetCharSet(resolved, FC_CHARSET, 0, &charset))
{

View file

@ -163,11 +163,20 @@ static NSArray *faFromFc(FcPattern *pat)
float nsweight;
unsigned int nstraits = 0;
char *fcfamily, *fcstyle;
NSMutableString *name, *family, *style;
NSString *styleStr = nil;
NSString *name = nil;
NSMutableString *family, *style;
#ifdef FC_POSTSCRIPT_NAME
char *fcname;
#endif
if (FcPatternGetString(pat, FC_STYLE, 0, (FcChar8 **)&fcstyle) == FcResultMatch)
{
styleStr = [NSString stringWithUTF8String: fcstyle];
}
// NSLog (@"family: %@, style: %s/%@", name, fcstyle, style);
if (FcPatternGetInteger(pat, FC_WEIGHT, 0, &weight) != FcResultMatch
|| FcPatternGetInteger(pat, FC_SLANT, 0, &slant) != FcResultMatch
|| FcPatternGetString(pat, FC_FAMILY, 0, (FcChar8 **)&fcfamily)
@ -178,12 +187,6 @@ static NSArray *faFromFc(FcPattern *pat)
if (spacing==FC_MONO || spacing==FC_CHARCELL)
nstraits |= NSFixedPitchFontMask;
name = [NSMutableString stringWithCapacity: 100];
#ifdef FC_POSTSCRIPT_NAME
if (FcPatternGetString(pat, FC_POSTSCRIPT_NAME, 0, (FcChar8 **)&fcname) == FcResultMatch)
[name appendString: [NSMutableString stringWithUTF8String: fcname]];
#endif
family = [NSMutableString stringWithUTF8String: fcfamily];
style = [NSMutableString stringWithCapacity: 100];
@ -303,28 +306,40 @@ static NSArray *faFromFc(FcPattern *pat)
break;
}
if (![name length]) // no psname
if (styleStr == nil)
{
NSDebugLLog(@"NSFont", @"Warning: synthesizing PSName for '%@ %@'", family, style);
[name appendString: family];
if ([style length] > 0)
styleStr = (NSString *)style;
}
if (![styleStr length])
{
styleStr = @"Regular";
}
#ifdef FC_POSTSCRIPT_NAME
if (FcPatternGetString(pat, FC_POSTSCRIPT_NAME, 0, (FcChar8 **)&fcname) == FcResultMatch)
{
name = [NSString stringWithUTF8String: fcname];
}
#endif
if (!name || ![name length]) // no psname
{
NSMutableString *tmpStr;
tmpStr = [NSMutableString stringWithCapacity: 100];
NSDebugLLog(@"NSFont", @"Warning: synthesizing PSName for '%@ %@'", family, styleStr);
[tmpStr appendString: family];
if ([styleStr length] > 0 && ![styleStr isEqualToString: @"Regular"])
{
[name appendString: @"-"];
[name appendString: style];
}
[tmpStr appendString: @"-"];
[tmpStr appendString: styleStr];
}
name = [NSString stringWithString: tmpStr];
}
if (![style length])
{
[style setString: @"Regular"];
}
if (FcPatternGetString(pat, FC_STYLE, 0, (FcChar8 **)&fcstyle) == FcResultMatch)
style = [NSString stringWithUTF8String: fcstyle];
// NSLog (@"family: %@, style: %s/%@", name, fcstyle, style);
return [NSArray arrayWithObjects: name,
style,
styleStr,
[NSNumber numberWithFloat: nsweight],
[NSNumber numberWithUnsignedInt: nstraits],
nil];

View file

@ -0,0 +1,48 @@
#
# Main makefile for GNUstep Headless Backend
#
# Copyright (C) 2002 Free Software Foundation, Inc.
#
# Author: Adam Fedor <fedor@gnu.org>
#
# This file is part of the GNUstep Backend.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; see the file COPYING.LIB.
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
PACKAGE_NAME = gnustep-back
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../../back.make
include $(GNUSTEP_MAKEFILES)/common.make
include ../../config.make
# The library to be compiled, as a library or as a bundle
SUBPROJECT_NAME=headless
# The Objective-C source files to be compiled
headless_OBJC_FILES = \
HeadlessContext.m \
HeadlessServer.m \
HeadlessFontInfo.m \
HeadlessFontEnumerator.m \
HeadlessFaceInfo.m \
HeadlessGState.m
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/subproject.make
-include GNUmakefile.postamble

View file

@ -0,0 +1,51 @@
#
# GNUmakefile.preamble
#
# Copyright (C) 2002 Free Software Foundation, Inc.
#
# Author: Adam Fedor <fedor@gnu.org>
#
# This file is part of the GNUstep Backend.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; see the file COPYING.LIB.
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# Flags dealing with compiling and linking
#
# Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS += -Wall $(CONFIG_SYSTEM_DEFS)
# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS =
# Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../../Headers \
-I../$(GNUSTEP_TARGET_DIR) $(GRAPHIC_CFLAGS)
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS =
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS =
#
# Flags dealing with installing and uninstalling
#

View file

@ -0,0 +1,45 @@
/*
HeadlessContext.m
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "headless/HeadlessContext.h"
#include "headless/HeadlessFontInfo.h"
#include "headless/HeadlessFontEnumerator.h"
#include "headless/HeadlessGState.h"
@implementation HeadlessContext
+ (void) initializeBackend
{
[NSGraphicsContext setDefaultContextClass: self];
[GSFontEnumerator setDefaultClass: [HeadlessFontEnumerator class]];
[GSFontInfo setDefaultClass: [HeadlessFontInfo class]];
}
+ (Class) GStateClass
{
return [HeadlessGState class];
}
@end

View file

@ -0,0 +1,44 @@
/*
HeadlessFaceInfo.m
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
Based on work by: Marcian Lytwyn <gnustep@advcsi.com> for Keysight
Based on work by: Banlu Kemiyatorn <object at gmail dot com>
Based on work by: Alex Malmberg
Based on work by: Fred Kiefer <fredkiefer@gmx.de>
This file is part of GNUstep.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "headless/HeadlessFaceInfo.h"
@implementation HeadlessFaceInfo
- (void) dealloc
{
[super dealloc];
}
- (void *)fontFace
{
return _fontFace;
}
@end

View file

@ -0,0 +1,47 @@
/*
HeadlessFontEnumerator.m
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
Based on work by: Marcian Lytwyn <gnustep@advcsi.com> for Keysight
Based on work by: Banlu Kemiyatorn <object at gmail dot com>
Based on work by: Alex Malmberg
Based on work by: Fred Kiefer <fredkiefer@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "headless/HeadlessFontEnumerator.h"
#include "headless/HeadlessFontInfo.h"
@implementation HeadlessFontEnumerator
+ (Class) faceInfoClass
{
return [HeadlessFaceInfo class];
}
+ (HeadlessFaceInfo *) fontWithName: (NSString *) name
{
return (HeadlessFaceInfo *) [super fontWithName: name];
}
- (void)enumerateFontsAndFamilies
{
}
@end

View file

@ -0,0 +1,87 @@
/*
HeadlessFontInfo.m
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
Based on work by: Marcian Lytwyn <gnustep@advcsi.com> for Keysight
Based on work by: Banlu Kemiyatorn <object at gmail dot com>
Based on work by: Alex Malmberg
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "GNUstepBase/Unicode.h"
#include <AppKit/NSAffineTransform.h>
#include <AppKit/NSBezierPath.h>
#include "headless/HeadlessFontInfo.h"
#include "headless/HeadlessFontEnumerator.h"
#include <math.h>
@implementation HeadlessFontInfo
- (id) initWithFontName: (NSString *)name
matrix: (const CGFloat *)fmatrix
screenFont: (BOOL)p_screenFont
{
self = [super init];
if (!self)
return nil;
#ifndef _MSC_VER
// Accessing instance variables across module boundaries is not supported by the Visual Studio
// toolchain; this could be implemented using e.g. setFontName: and setMatrix: method on the
// base case.
fontName = [name copy];
memcpy(matrix, fmatrix, sizeof(matrix));
#endif
return self;
}
- (void) dealloc
{
[super dealloc];
}
- (BOOL) glyphIsEncoded: (NSGlyph)glyph
{
return NO;
}
- (NSSize) advancementForGlyph: (NSGlyph)glyph
{
return NSZeroSize;
}
- (NSRect) boundingRectForGlyph: (NSGlyph)glyph
{
return NSZeroRect;
}
- (CGFloat) widthOfString: (NSString *)string
{
return 0.0;
}
- (void) appendBezierPathWithGlyphs: (NSGlyph *)glyphs
count: (int)length
toBezierPath: (NSBezierPath *)path
{
}
@end

View file

@ -0,0 +1,72 @@
/*
HeadlessGState.m
Copyright (C) 2003, 2023 Free Software Foundation, Inc.
Based on work by: Marcian Lytwyn <gnustep@advcsi.com> for Keysight
Based on work by: Banlu Kemiyatorn <object at gmail dot com>
Based on work by: Fred Kiefer <fredkiefer@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "headless/HeadlessGState.h"
@implementation HeadlessGState
- (void) DPSclip
{
}
- (void) DPSfill
{
}
- (void) DPSsetlinewidth: (CGFloat)width
{
}
- (void) DPSsetdash: (const CGFloat *)pat : (NSInteger)size : (CGFloat)foffset
{
}
- (void) DPSimage: (NSAffineTransform *)matrix : (NSInteger)pixelsWide
: (NSInteger)pixelsHigh : (NSInteger)bitsPerSample
: (NSInteger)samplesPerPixel : (NSInteger)bitsPerPixel
: (NSInteger)bytesPerRow : (BOOL)isPlanar
: (BOOL)hasAlpha : (NSString *)colorSpaceName
: (const unsigned char *const[5])data
{
}
- (void) DPSstroke
{
}
- (void) compositerect: (NSRect)aRect op: (NSCompositingOperation)op
{
}
- (void) compositeGState: (HeadlessGState *)source
fromRect: (NSRect)srcRect
toPoint: (NSPoint)destPoint
op: (NSCompositingOperation)op
fraction: (CGFloat)delta
{
}
@end

View file

@ -0,0 +1,115 @@
/*
HeadlessServer.m
Copyright (C) 1998,2002,2023 Free Software Foundation, Inc.
Based on work by: Marcian Lytwyn <gnustep@advcsi.com> for Keysight
Based on work by: Adam Fedor <fedor@gnu.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include <AppKit/NSApplication.h>
#include <Foundation/NSDebug.h>
#include <Foundation/NSValue.h>
#include "headless/HeadlessServer.h"
/* Terminate cleanly if we get a signal to do so */
static void
terminate(int sig)
{
if (nil != NSApp)
{
[NSApp terminate: NSApp];
}
else
{
exit(1);
}
}
@implementation HeadlessServer
/* Initialize AppKit backend */
+ (void) initializeBackend
{
NSDebugLog(@"Initializing GNUstep headless backend.\n");
[GSDisplayServer setDefaultServerClass: [HeadlessServer class]];
signal(SIGTERM, terminate);
signal(SIGINT, terminate);
}
- (NSArray *)screenList
{
NSDebugLog(@"GNUstep headless - fetching screen list");
NSMutableArray *screens = [NSMutableArray arrayWithCapacity: 1];
[screens addObject: [NSNumber numberWithInt: 1]];
return screens;
}
- (NSRect) boundsForScreen: (int)screen
{
return NSMakeRect(0, 0, 400, 400);
}
- (NSWindowDepth) windowDepthForScreen: (int) screen_num
{
return 0;
}
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
: (unsigned int) style
{
}
- (void) standardcursor: (int)style : (void **)cid
{
}
- (int) window: (NSRect)frame
: (NSBackingStoreType)type
: (unsigned int)style
: (int)screen
{
return 1;
}
- (void) setwindowlevel: (int)level : (int)win
{
}
- (void) setWindowdevice: (int)win forContext: (NSGraphicsContext *)ctxt
{
}
- (void) orderwindow: (int)op : (int)otherWin : (int)winNum
{
}
- (void) setinputfocus: (int)win
{
}
- (void) imagecursor: (NSPoint)hotp : (NSImage *)image : (void **)cid
{
}
@end

View file

@ -0,0 +1,59 @@
#
# Main makefile for GNUstep Backend wayland
#
# Copyright (C) 2020 Free Software Foundation, Inc.
#
# Author: Adam Fedor <fedor@gnu.org>
# Author: Sergio L. Pascual <slp@sinrega.org>
# Author: Ladislav Michl <ladis@linux-mips.org>
#
# This file is part of the GNUstep Backend.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; see the file COPYING.LIB.
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
PACKAGE_NAME = gnustep-back
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../../back.make
include $(GNUSTEP_MAKEFILES)/common.make
include ../../config.make
# The library to be compiled, as a library or as a bundle
SUBPROJECT_NAME=wayland
wayland_LOCALIZED_RESOURCE_FILES = \
# The C source files to be compiled
wayland_C_FILES = \
xdg-shell-protocol.c \
wlr-layer-shell-protocol.c \
# The Objective-C source files to be compiled
wayland_OBJC_FILES = \
WaylandServer.m \
WaylandServer+Output.m \
WaylandServer+Cursor.m \
WaylandServer+Keyboard.m \
WaylandServer+Seat.m \
WaylandServer+Xdgshell.m \
WaylandServer+Layershell.m \
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/subproject.make
-include GNUmakefile.postamble

View file

@ -0,0 +1,52 @@
#
# GNUmakefile.preamble
#
# Copyright (C) 2020 Free Software Foundation, Inc.
#
# Author: Adam Fedor <fedor@gnu.org>
# Author: Sergio L. Pascual <slp@sinrega.org>
#
# This file is part of the GNUstep Backend.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; see the file COPYING.LIB.
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# Flags dealing with compiling and linking
#
# Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS += -Wall $(CONFIG_SYSTEM_DEFS)
# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS =
# Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../../Headers \
-I../$(GNUSTEP_TARGET_DIR) $(GRAPHIC_CFLAGS)
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS =
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS =
#
# Flags dealing with installing and uninstalling
#

37
Source/wayland/README.md Normal file
View file

@ -0,0 +1,37 @@
# Wayland backend for GNUstep
This directory (along with `Headers/wayland/`, and a file in `Source/cairo/`
and `Headers/cairo`) contains the Wayland backend for GNUstep GUI. This
display server backend depends on Cairo graphics backend; it will currently
not work with any other combination.
As of April 2020, it is incomplete and broken. Help getting it functional will
be appreciated.
## Known issues
Last updated 25 April 2020:
* Under Weston, some backing Cairo surfaces, which should not be visible in
the compositor, are nonetheless drawn randomly onto the screen.
* Backing view surfaces may never get blitted onto the main window.
* After a while, Weston assumes that the application is not responding (there
is a spinner when hovering over the windows, and the surfaces can be
rotated by holding the right mouse button). Some events still get
delivered, visible in the debug output, but otherwise the application
appears frozen.
## Use on Debian
As of April 2020, it requires the stable XDG Shell protocol to be available in
the compositor you may be using. Weston included in Debian buster does _not_
include the stable XDG Shell protocol; this was only checked into Weston in
February 2019, and seemingly released with Weston 6, which does not ship in
Debian buster.
## Regenerating protocol files
To regenerate protocol sources from protocol IDLs in XML format, please use
`wayland-regenerate.sh`. Paths to the XML files are hardcoded to the values on
a Debian testing system.

View file

@ -0,0 +1,857 @@
/*
WaylandServer - Cursor Handling
Copyright (C) 2020 Free Software Foundation, Inc.
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
Date: November 2021
This file is part of the GNU Objective C Backend Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "wayland/WaylandServer.h"
#include "cairo/WaylandCairoShmSurface.h"
#import <AppKit/NSEvent.h>
#import <AppKit/NSView.h>
#import <AppKit/NSWindow.h>
#import <AppKit/NSCursor.h>
#import <AppKit/NSGraphics.h>
#import <AppKit/NSBitmapImageRep.h>
#import <GNUstepGUI/GSWindowDecorationView.h>
#import <GNUstepGUI/GSTheme.h>
#include <linux/input.h>
#include "wayland-cursor.h"
extern void wl_cursor_destroy(struct wl_cursor *cursor);
// XXX should this be configurable by the user?
#define DOUBLECLICK_DELAY 300
#define DOUBLECLICK_MOVE_THREASHOLD 3
static void
pointer_handle_enter(void *data, struct wl_pointer *pointer, uint32_t serial,
struct wl_surface *surface, wl_fixed_t sx_w,
wl_fixed_t sy_w)
{
WaylandConfig *wlconfig = data;
struct window *window = wl_surface_get_user_data(surface);
if (window->ignoreMouse)
{
return;
}
wlconfig->pointer.focus = window;
if (wlconfig->pointer.captured)
{
return;
}
[(WaylandServer *)GSCurrentServer() initializeMouseIfRequired];
NSDebugLog(@"[%d] pointer_handle_enter",window->window_id);
float sx = wl_fixed_to_double(sx_w);
float sy = wl_fixed_to_double(sy_w);
if (window && wlconfig->pointer.serial)
{
NSEvent *event;
NSPoint eventLocation;
NSGraphicsContext *gcontext;
float deltaX = sx - wlconfig->pointer.x;
float deltaY = sy - wlconfig->pointer.y;
gcontext = GSCurrentContext();
eventLocation = NSMakePoint(sx, window->height - sy);
event = [NSEvent mouseEventWithType:NSMouseEntered
location:eventLocation
modifierFlags:wlconfig->modifiers
timestamp:wlconfig->pointer.last_timestamp
windowNumber:window->window_id
context:gcontext
eventNumber:serial
clickCount:0
pressure:0.0
buttonNumber:0
deltaX:deltaX
deltaY:deltaY
deltaZ:0.];
[GSCurrentServer() postEvent:event atStart:NO];
}
wlconfig->pointer.x = sx;
wlconfig->pointer.y = sy;
wlconfig->pointer.serial = serial;
wlconfig->event_serial = serial;
}
static void
pointer_handle_leave(void *data, struct wl_pointer *pointer, uint32_t serial,
struct wl_surface *surface)
{
WaylandConfig *wlconfig = data;
struct window *window = wl_surface_get_user_data(surface);
if (window->ignoreMouse)
{
return;
}
if (wlconfig->pointer.focus == NULL)
{
return;
}
[(WaylandServer *)GSCurrentServer() initializeMouseIfRequired];
if (wlconfig->pointer.focus->window_id == window->window_id
&& wlconfig->pointer.serial)
{
if (wlconfig->pointer.captured == NULL)
{
window = wlconfig->pointer.focus;
NSEvent *event;
NSPoint eventLocation;
NSGraphicsContext *gcontext;
gcontext = GSCurrentContext();
eventLocation = NSMakePoint(wlconfig->pointer.x, wlconfig->pointer.y);
event = [NSEvent mouseEventWithType:NSMouseExited
location:eventLocation
modifierFlags:0
timestamp:wlconfig->pointer.last_timestamp
windowNumber:window->window_id
context:gcontext
eventNumber:serial
clickCount:0
pressure:0.0
buttonNumber:0
deltaX:0
deltaY:0
deltaZ:0.];
[GSCurrentServer() postEvent:event atStart:NO];
}
wlconfig->pointer.focus = NULL;
wlconfig->pointer.serial = serial;
wlconfig->event_serial = serial;
}
}
// triggered when the cursor is over a surface
static void
pointer_handle_motion(void *data, struct wl_pointer *pointer, uint32_t time,
wl_fixed_t sx_w, wl_fixed_t sy_w)
{
WaylandConfig *wlconfig = data;
struct window *focused_window = wlconfig->pointer.focus;
if (wlconfig->pointer.captured)
{
focused_window = wlconfig->pointer.captured;
}
if (focused_window == NULL || focused_window->ignoreMouse)
{
return;
}
float sx = wl_fixed_to_double(sx_w);
float sy = wl_fixed_to_double(sy_w);
wlconfig->pointer.last_timestamp = (NSTimeInterval) time / 1000.0;
[(WaylandServer *)GSCurrentServer() initializeMouseIfRequired];
if (focused_window && wlconfig->pointer.serial)
{
NSEvent *event;
NSEventType eventType;
NSPoint eventLocation;
NSGraphicsContext *gcontext;
unsigned int eventFlags;
float deltaX = sx - wlconfig->pointer.x;
float deltaY = sy - wlconfig->pointer.y;
gcontext = GSCurrentContext();
eventLocation = NSMakePoint(sx, focused_window->height - sy);
eventFlags = wlconfig->modifiers;
eventType = NSMouseMoved;
if (wlconfig->pointer.button_state == WL_POINTER_BUTTON_STATE_PRESSED)
{
switch (wlconfig->pointer.button)
{
case BTN_LEFT:
eventType = NSLeftMouseDragged;
break;
case BTN_RIGHT:
eventType = NSRightMouseDragged;
break;
case BTN_MIDDLE:
eventType = NSOtherMouseDragged;
break;
}
}
event = [NSEvent mouseEventWithType:eventType
location:eventLocation
modifierFlags:eventFlags
timestamp:wlconfig->pointer.last_timestamp
windowNumber:(int) focused_window->window_id
context:gcontext
eventNumber:time
clickCount:0
pressure:1.0 // XXX should this be 0 when no button is pressed?
buttonNumber:wlconfig->pointer.button
deltaX:deltaX
deltaY:deltaY
deltaZ:0.];
[GSCurrentServer() postEvent:event atStart:NO];
}
wlconfig->pointer.x = sx;
wlconfig->pointer.y = sy;
}
static void
pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
uint32_t time, uint32_t button, uint32_t state_w)
{
WaylandConfig *wlconfig = data;
NSEvent *event;
NSEventType eventType;
NSPoint eventLocation;
NSGraphicsContext *gcontext;
unsigned int eventFlags;
float deltaX = 0.0;
float deltaY = 0.0;
int clickCount = 1;
int tick;
int buttonNumber;
enum wl_pointer_button_state state = state_w;
struct window *window = wlconfig->pointer.focus;
if (wlconfig->pointer.captured)
{
window = wlconfig->pointer.captured;
}
if (window == NULL || window->ignoreMouse)
{
return;
}
[(WaylandServer *)GSCurrentServer() initializeMouseIfRequired];
gcontext = GSCurrentContext();
eventLocation
= NSMakePoint(wlconfig->pointer.x, window->height - wlconfig->pointer.y);
eventFlags = wlconfig->modifiers;
NSTimeInterval timestamp = (NSTimeInterval) time / 1000.0;
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
{
wlconfig->pointer.button = button;
if (window->toplevel)
{
// if the window is a toplevel we check if the event is for resizing or
// moving the window these actions are delegated to the compositor and
// therefore we skip forwarding the events to the NSWindow / NSView
NSWindow *nswindow = GSWindowWithNumber(window->window_id);
if (nswindow != nil)
{
GSStandardWindowDecorationView * wd = [nswindow _windowView];
if ([wd pointInTitleBarRect:eventLocation])
{
xdg_toplevel_move(window->toplevel, wlconfig->seat, serial);
window->moving = YES;
return;
}
if ([wd pointInResizeBarRect:eventLocation])
{
GSResizeEdgeMode mode = [wd resizeModeForPoint:eventLocation];
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
if (mode == GSResizeEdgeBottomLeftMode)
{
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
}
else if (mode == GSResizeEdgeBottomRightMode)
{
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
}
else if (mode == GSResizeEdgeBottomMode)
{
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
}
xdg_toplevel_resize(window->toplevel, wlconfig->seat, serial,
edges);
window->resizing = YES;
return;
}
} // endif nswindow != nil
} // endif window->toplevel
if (button == wlconfig->pointer.last_click_button
&& time - wlconfig->pointer.last_click_time < DOUBLECLICK_DELAY
&& fabsf(wlconfig->pointer.x - wlconfig->pointer.last_click_x)
< DOUBLECLICK_MOVE_THREASHOLD
&& fabsf(wlconfig->pointer.y - wlconfig->pointer.last_click_y)
< DOUBLECLICK_MOVE_THREASHOLD)
{
wlconfig->pointer.last_click_time = 0;
clickCount++;
}
else
{
wlconfig->pointer.last_click_button = button;
wlconfig->pointer.last_click_time = time;
wlconfig->pointer.last_click_x = wlconfig->pointer.x;
wlconfig->pointer.last_click_y = wlconfig->pointer.y;
}
wlconfig->pointer.serial = serial;
switch (button)
{
case BTN_LEFT:
eventType = NSLeftMouseDown;
break;
case BTN_RIGHT:
eventType = NSRightMouseDown;
break;
case BTN_MIDDLE:
eventType = NSOtherMouseDown;
break;
// TODO: handle BTN_SIDE, BTN_EXTRA, BTN_FORWARD, BTN_BACK and other
// constants in libinput.
// We may just want to send NSOtherMouseDown and populate buttonNumber
// with the libinput constant?
}
}
else if (state == WL_POINTER_BUTTON_STATE_RELEASED)
{
wlconfig->pointer.serial = 0;
wlconfig->pointer.button = 0;
if (window->moving)
{
window->moving = NO;
return;
}
if (window->resizing)
{
window->resizing = NO;
return;
}
switch (button)
{
case BTN_LEFT:
eventType = NSLeftMouseUp;
break;
case BTN_RIGHT:
eventType = NSRightMouseUp;
break;
case BTN_MIDDLE:
eventType = NSOtherMouseUp;
break;
}
}
else
{
return;
}
/* FIXME: unlike in _motion and _axis handlers, the argument used in _button
is the "serial" of the event, not passed and unavailable in _motion and
_axis handlers. Is it allowed to pass "serial" as the eventNumber: in
_button handler, but "time" as the eventNumber: in the _motion and _axis
handlers? */
tick = serial;
/* FIXME: X11 backend uses the XGetPointerMapping()-returned values from
its map_return argument as constants for buttonNumber. As the variant
with buttonNumber: seems to be a GNUstep extension, and the value
internal, it might be ok to just provide libinput constant as we're doing
here. If this is truly correct, please update this comment to document
the correctness of doing so. */
buttonNumber = button;
event = [NSEvent mouseEventWithType:eventType
location:eventLocation
modifierFlags:eventFlags
timestamp:timestamp
windowNumber:(int) window->window_id
context:gcontext
eventNumber:tick
clickCount:clickCount
pressure:1.0
buttonNumber:buttonNumber
deltaX:deltaX /* FIXME unused */
deltaY:deltaY /* FIXME unused */
deltaZ:0.];
[GSCurrentServer() postEvent:event atStart:NO];
// store button state for mouse move handlers
wlconfig->pointer.button_state = state;
wlconfig->pointer.last_timestamp = timestamp;
wlconfig->pointer.serial = serial;
wlconfig->event_serial = serial;
}
// Discrete step information for scroll and other axes.
static void
pointer_handle_frame(void *data, struct wl_pointer *pointer)
{}
// Source information for scroll and other axes.
static void
pointer_handle_axis_source(void *data, struct wl_pointer *pointer,
uint32_t axis_source)
{
WaylandConfig *wlconfig = data;
wlconfig->pointer.axis_source = axis_source;
}
// Stop notification for scroll and other axes.
static void
pointer_handle_axis_stop(void *data, struct wl_pointer *pointer, uint32_t time,
uint32_t axis)
{}
// Discrete step information for scroll and other axes.
static void
pointer_handle_axis_discrete(void *data, struct wl_pointer *pointer,
uint32_t axis, int discrete)
{}
// Scroll and other axis notifications.
static void
pointer_handle_axis(void *data, struct wl_pointer *pointer, uint32_t time,
uint32_t axis, wl_fixed_t value)
{
WaylandConfig *wlconfig = data;
NSEvent *event;
NSEventType eventType;
NSPoint eventLocation;
NSGraphicsContext *gcontext;
unsigned int eventFlags;
float deltaX = 0.0;
float deltaY = 0.0;
int clickCount = 1;
int buttonNumber;
struct window *window = wlconfig->pointer.focus;
if (window->ignoreMouse)
{
return;
}
[(WaylandServer *)GSCurrentServer() initializeMouseIfRequired];
gcontext = GSCurrentContext();
eventLocation
= NSMakePoint(wlconfig->pointer.x, window->height - wlconfig->pointer.y);
eventFlags = wlconfig->modifiers;
if (wlconfig->pointer.axis_source != WL_POINTER_AXIS_SOURCE_WHEEL)
{
//axis_source == WL POINTER AXIS SOURCE FINGER
//axis_source == WL POINTER AXIS SOURCE CONTINUOUS
// XXX the scroll is from trackpad we should calculate
// the momentumPhase
NSDebugLog(@"touch scroll");
}
//float mouse_scroll_multiplier = wlconfig->mouse_scroll_multiplier;
/* For smooth-scroll events, we're not doing any cross-event or delta
calculations, as is done in button event handling. */
switch (axis)
{
case WL_POINTER_AXIS_VERTICAL_SCROLL:
eventType = NSScrollWheel;
deltaY = wl_fixed_to_double(value) * wlconfig->mouse_scroll_multiplier;
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
eventType = NSScrollWheel;
deltaX = wl_fixed_to_double(value) * wlconfig->mouse_scroll_multiplier;
}
/* FIXME: X11 backend uses the XGetPointerMapping()-returned values from
its map_return argument as constants for buttonNumber. As the variant
with buttonNumber: seems to be a GNUstep extension, and the value
internal, it might be ok to just not provide any value here.
If this is truly correct, please update this comment to document
the correctness of doing so. */
buttonNumber = 0;
event = [NSEvent mouseEventWithType:eventType
location:eventLocation
modifierFlags:eventFlags
timestamp:(NSTimeInterval) time / 1000.0
windowNumber:(int) window->window_id
context:gcontext
eventNumber:time
clickCount:clickCount
pressure:1.0
buttonNumber:buttonNumber
deltaX:deltaX
deltaY:deltaY
deltaZ:0.];
[GSCurrentServer() postEvent:event atStart:NO];
}
// the Seat category uses this listener
const struct wl_pointer_listener pointer_listener
= {pointer_handle_enter, pointer_handle_leave,
pointer_handle_motion, pointer_handle_button,
pointer_handle_axis, pointer_handle_frame,
pointer_handle_axis_source, pointer_handle_axis_stop,
pointer_handle_axis_discrete};
@implementation
WaylandServer (Cursor)
- (NSPoint)mouselocation
{
int aScreen = -1;
if (wl_list_length(&wlconfig->output_list) == 0)
{
return NSZeroPoint;
}
struct output *output = (struct output *)wlconfig->output_list.next;
aScreen = output->server_output_id;
if (aScreen < 0)
{
// No outputs in the wl_list.
return NSZeroPoint;
}
return [self mouseLocationOnScreen:aScreen window:NULL];
}
- (NSPoint)mouseLocationOnScreen:(int)aScreen window:(int *)win
{
struct window *window = wlconfig->pointer.focus;
struct output *output;
float x;
float y;
x = wlconfig->pointer.x;
y = wlconfig->pointer.y;
if (window)
{
x += window->pos_x;
y += window->pos_y;
if (win)
{
*win = window->window_id;
}
}
wl_list_for_each(output, &wlconfig->output_list, link)
{
if (output->server_output_id == aScreen)
{
y = output->height - y;
break;
}
}
return NSMakePoint(x, y);
}
- (BOOL)capturemouse:(int)win
{
struct window *window = get_window_with_id(wlconfig, win);
wlconfig->pointer.captured = window;
return YES;
}
- (void)releasemouse
{
wlconfig->pointer.captured = NULL;
}
- (void)setMouseLocation:(NSPoint)mouseLocation onScreen:(int)aScreen
{
NSDebugLog(@"setMouseLocation: not supported");
}
- (void)hidecursor
{
// to hide the cursor we set a NULL surface
wl_pointer_set_cursor(wlconfig->pointer.wlpointer, wlconfig->pointer.serial,
NULL, 0, 0);
}
- (void)showcursor
{
// restore the previous surface
wl_pointer_set_cursor(wlconfig->pointer.wlpointer, wlconfig->pointer.serial,
wlconfig->cursor->surface,
wlconfig->cursor->image->hotspot_x,
wlconfig->cursor->image->hotspot_y);
}
- (void)standardcursor:(int)style :(void **)cid
{
[self initializeMouseIfRequired];
char * cursor_name = "";
switch (style)
{
case GSArrowCursor:
cursor_name = "left_ptr";
break;
case GSIBeamCursor:
cursor_name = "xterm";
break;
case GSDragLinkCursor:
cursor_name = "dnd-link";
break;
case GSOperationNotAllowedCursor:
cursor_name = "X_cursor";
break;
case GSDragCopyCursor:
cursor_name = "dnd-copy";
break;
case GSPointingHandCursor:
cursor_name = "hand";
break;
case GSResizeLeftCursor:
cursor_name = "left_side";
break;
case GSResizeRightCursor:
cursor_name = "right_side";
break;
case GSResizeLeftRightCursor:
cursor_name = "sb_h_double_arrow";
break;
case GSCrosshairCursor:
cursor_name = "crosshair";
break;
case GSResizeUpCursor:
cursor_name = "top_side";
break;
case GSResizeDownCursor:
cursor_name = "bottom_side";
break;
case GSResizeUpDownCursor:
cursor_name = "sb_v_double_arrow";
break;
case GSDisappearingItemCursor:
cursor_name = "pirate";
break;
case GSContextualMenuCursor:
break;
case GSGreenArrowCursor:
break;
case GSClosedHandCursor:
break;
case GSOpenHandCursor:
break;
}
if (strlen(cursor_name) != 0)
{
NSDebugLog(@"load cursor from theme for style %d: %s", style,
cursor_name);
struct cursor *wayland_cursor = malloc(sizeof(struct cursor));
wayland_cursor->cursor
= wl_cursor_theme_get_cursor(wlconfig->cursor_theme, cursor_name);
wayland_cursor->image = wayland_cursor->cursor->images[0];
wayland_cursor->buffer
= wl_cursor_image_get_buffer(wayland_cursor->image);
*cid = wayland_cursor;
}
else
{
NSDebugLog(@"unable to load cursor from theme for style %d", style);
}
}
- (void)imagecursor:(NSPoint)hotp :(NSImage *)image :(void **)cid
{
NSBitmapImageRep* raw_img = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
unsigned char *data = [raw_img bitmapData];
NSSize imageSize = NSMakeSize(raw_img.pixelsWide, raw_img.pixelsHigh);
int width = imageSize.width;
int height = imageSize.height;
struct pool_buffer *pbuffer
= createShmBuffer(width, height, wlconfig->shm);
// TODO should check if the bitmaprep format is compatible
memcpy(pbuffer->data, data, [raw_img bytesPerPlane]);
struct cursor * wayland_cursor = malloc(sizeof(struct cursor));
struct wl_cursor * cursor = malloc(sizeof(struct wl_cursor));
cursor->image_count = 1;
cursor->name = "custom";
struct wl_cursor_image * cursor_image = malloc(sizeof(struct wl_cursor_image));
cursor->images = malloc(sizeof *cursor->images);
cursor->images[0] = cursor_image;
cursor_image->width = width;
cursor_image->height = height;
cursor_image->hotspot_x = hotp.x;
cursor_image->hotspot_y = hotp.y;
wayland_cursor->cursor = cursor;
wayland_cursor->image = cursor_image;
wayland_cursor->buffer = pbuffer->buffer;
*cid = wayland_cursor;
}
- (void)setcursorcolor:(NSColor *)fg :(NSColor *)bg :(void *)cid
{
NSLog(@"Call to obsolete method -setcursorcolor:::");
[self recolorcursor:fg:bg:cid];
[self setcursor:cid];
}
- (void) recolorcursor:(NSColor *)fg :(NSColor *)bg :(void*) cid
{
// TODO recolorcursor
NSDebugLog(@"recolorcursor");
}
- (void)setcursor:(void *)cid
{
struct cursor *wayland_cursor = cid;
if (wayland_cursor == NULL)
{
return;
}
if (wayland_cursor->cursor == NULL)
{
return;
}
if (wayland_cursor->image == NULL)
{
return;
}
if (wayland_cursor->buffer == NULL)
{
return;
}
if (wayland_cursor->surface)
{
wl_surface_destroy(wayland_cursor->surface);
}
wl_pointer_set_cursor(wlconfig->pointer.wlpointer, wlconfig->event_serial,
wlconfig->cursor_surface,
wayland_cursor->image->hotspot_x,
wayland_cursor->image->hotspot_y);
wl_surface_attach(wlconfig->cursor_surface, wayland_cursor->buffer, 0, 0);
wl_surface_damage(wlconfig->cursor_surface, 0, 0,
wayland_cursor->image->width, wayland_cursor->image->height);
wl_surface_commit(wlconfig->cursor_surface);
wlconfig->cursor = wayland_cursor;
}
- (void)freecursor:(void *)cid
{
// the cursor should be deallocated
struct cursor * c = cid;
wl_cursor_destroy(c->cursor);
wl_buffer_destroy(c->buffer);
free(cid);
}
- (void)setIgnoreMouse:(BOOL)ignoreMouse :(int)win
{
struct window *window = get_window_with_id(wlconfig, win);
if (window)
{
window->ignoreMouse = ignoreMouse;
}
}
- (void)initializeMouseIfRequired
{
if (!_mouseInitialized)
{
[self initializeMouse];
}
}
- (void)initializeMouse
{
_mouseInitialized = YES;
wlconfig->cursor_theme =
wl_cursor_theme_load(NULL, 24, wlconfig->shm);
wlconfig->cursor_surface
= wl_compositor_create_surface(wlconfig->compositor);
// default cursor used for show/hide
struct cursor *wayland_cursor;
[self standardcursor:GSArrowCursor :(void **)&wayland_cursor];
[self setcursor:wayland_cursor];
[self mouseOptionsChanged:nil];
[[NSDistributedNotificationCenter defaultCenter]
addObserver:self
selector:@selector(mouseOptionsChanged:)
name:NSUserDefaultsDidChangeNotification
object:nil];
}
- (void)mouseOptionsChanged:(NSNotification *)aNotif
{
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
wlconfig->mouse_scroll_multiplier =
[defs integerForKey:@"GSMouseScrollMultiplier"];
if (wlconfig->mouse_scroll_multiplier < 0.0001f)
{
wlconfig->mouse_scroll_multiplier = 1.0f;
}
}
@end

View file

@ -0,0 +1,230 @@
/*
WaylandServer - Keyboard Handling
Copyright (C) 2020 Free Software Foundation, Inc.
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
Date: November 2021
This file is part of the GNU Objective C Backend Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "wayland/WaylandServer.h"
#include <AppKit/NSEvent.h>
#include <AppKit/NSApplication.h>
#include <linux/input.h>
#include <AppKit/NSText.h>
#include <sys/mman.h>
#include <unistd.h>
static void
keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
uint32_t format, int fd, uint32_t size)
{
NSDebugLog(@"keyboard_handle_keymap");
WaylandConfig *wlconfig = data;
struct xkb_keymap *keymap;
struct xkb_state *state;
char *map_str;
if (!data)
{
close(fd);
return;
}
if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1)
{
close(fd);
return;
}
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (map_str == MAP_FAILED)
{
close(fd);
return;
}
wlconfig->xkb_context = xkb_context_new(0);
if (wlconfig->xkb_context == NULL)
{
fprintf(stderr, "Failed to create XKB context\n");
return;
}
keymap = xkb_keymap_new_from_string(wlconfig->xkb_context, map_str,
XKB_KEYMAP_FORMAT_TEXT_V1, 0);
munmap(map_str, size);
close(fd);
if (!keymap)
{
fprintf(stderr, "failed to compile keymap\n");
return;
}
state = xkb_state_new(keymap);
if (!state)
{
fprintf(stderr, "failed to create XKB state\n");
xkb_keymap_unref(keymap);
return;
}
xkb_keymap_unref(wlconfig->xkb.keymap);
xkb_state_unref(wlconfig->xkb.state);
wlconfig->xkb.keymap = keymap;
wlconfig->xkb.state = state;
wlconfig->xkb.control_mask
= 1 << xkb_keymap_mod_get_index(wlconfig->xkb.keymap, "Control");
wlconfig->xkb.alt_mask
= 1 << xkb_keymap_mod_get_index(wlconfig->xkb.keymap, "Mod1");
wlconfig->xkb.shift_mask
= 1 << xkb_keymap_mod_get_index(wlconfig->xkb.keymap, "Shift");
}
static void
keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial,
struct wl_surface *surface, struct wl_array *keys)
{
// NSDebugLog(@"keyboard_handle_enter");
WaylandConfig *wlconfig = data;
wlconfig->event_serial = serial;
}
static void
keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial,
struct wl_surface *surface)
{
WaylandConfig *wlconfig = data;
wlconfig->event_serial = serial;
// NSDebugLog(@"keyboard_handle_leave");
}
static void
keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
uint32_t serial, uint32_t mods_depressed,
uint32_t mods_latched, uint32_t mods_locked,
uint32_t group)
{
// NSDebugLog(@"keyboard_handle_modifiers");
WaylandConfig *wlconfig = data;
wlconfig->event_serial = serial;
xkb_mod_mask_t mask;
/* If we're not using a keymap, then we don't handle PC-style modifiers */
if (!wlconfig->xkb.keymap)
return;
xkb_state_update_mask(wlconfig->xkb.state, mods_depressed, mods_latched,
mods_locked, 0, 0, group);
mask
= xkb_state_serialize_mods(wlconfig->xkb.state, XKB_STATE_MODS_DEPRESSED
| XKB_STATE_MODS_LATCHED);
wlconfig->modifiers = 0;
if (mask & wlconfig->xkb.control_mask)
wlconfig->modifiers |= NSCommandKeyMask;
if (mask & wlconfig->xkb.alt_mask)
wlconfig->modifiers |= NSAlternateKeyMask;
if (mask & wlconfig->xkb.shift_mask)
wlconfig->modifiers |= NSShiftKeyMask;
}
static void
keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial,
uint32_t time, uint32_t key, uint32_t state_w)
{
// NSDebugLog(@"keyboard_handle_key: %d", key);
WaylandConfig *wlconfig = data;
wlconfig->event_serial = serial;
uint32_t code, num_syms;
enum wl_keyboard_key_state state = state_w;
const xkb_keysym_t *syms;
xkb_keysym_t sym;
struct window *window = wlconfig->pointer.focus;
if (!window)
return;
code = 0;
if (key == 28)
{
sym = NSCarriageReturnCharacter;
}
else if (key == 14)
{
sym = NSDeleteCharacter;
}
else
{
code = key + 8;
num_syms = xkb_state_key_get_syms(wlconfig->xkb.state, code, &syms);
sym = XKB_KEY_NoSymbol;
if (num_syms == 1)
sym = syms[0];
}
NSString *s = [NSString stringWithUTF8String:&sym];
NSEventType eventType;
if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
{
eventType = NSKeyDown;
}
else
{
eventType = NSKeyUp;
}
NSEvent *ev = [NSEvent keyEventWithType:eventType
location:NSZeroPoint
modifierFlags:wlconfig->modifiers
timestamp:time / 1000.0
windowNumber:window->window_id
context:GSCurrentContext()
characters:s
charactersIgnoringModifiers:s
isARepeat:NO
keyCode:code];
[GSCurrentServer() postEvent:ev atStart:NO];
// NSDebugLog(@"keyboard_handle_key: %@", s);
}
static void
keyboard_handle_repeat_info(void *data, struct wl_keyboard *keyboard,
int32_t rate, int32_t delay)
{
// NSDebugLog(@"keyboard_handle_repeat_info");
}
const struct wl_keyboard_listener keyboard_listener
= {keyboard_handle_keymap, keyboard_handle_enter,
keyboard_handle_leave, keyboard_handle_key,
keyboard_handle_modifiers, keyboard_handle_repeat_info};
@implementation
WaylandServer (KeyboardOps)
@end

View file

@ -0,0 +1,65 @@
/*
WaylandServer - LayerShell Protocol Handling
Copyright (C) 2020 Free Software Foundation, Inc.
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
Date: November 2021
This file is part of the GNU Objective C Backend Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "wayland/WaylandServer.h"
#include <AppKit/NSEvent.h>
#include <AppKit/NSApplication.h>
static void
layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,
uint32_t serial, uint32_t w, uint32_t h)
{
struct window *window = data;
NSDebugLog(@"[%d] layer_surface_configure", window->window_id);
WaylandConfig *wlconfig = window->wlconfig;
zwlr_layer_surface_v1_ack_configure(surface, serial);
window->configured = YES;
if (window->buffer_needs_attach)
{
[window->instance flushwindowrect:NSMakeRect(window->pos_x, window->pos_y,
window->width, window->height
):window->window_id];
}
}
static void
layer_surface_closed(void *data, struct zwlr_layer_surface_v1 *surface)
{
struct window *window = data;
WaylandConfig *wlconfig = window->wlconfig;
NSDebugLog(@"layer_surface_closed %d", window->window_id);
// zwlr_layer_surface_v1_destroy(surface);
wl_surface_destroy(window->surface);
window->surface = NULL;
window->configured = NO;
window->layer_surface = NULL;
}
const struct zwlr_layer_surface_v1_listener layer_surface_listener = {
.configure = layer_surface_configure,
.closed = layer_surface_closed,
};

View file

@ -0,0 +1,88 @@
/*
WaylandServer - Output Handling
Copyright (C) 2020 Free Software Foundation, Inc.
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
Date: November 2021
This file is part of the GNU Objective C Backend Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "wayland/WaylandServer.h"
static void
handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
int physical_width, int physical_height, int subpixel,
const char *make, const char *model, int transform)
{
NSDebugLog(@"handle_geometry");
struct output *output = data;
output->alloc_x = x;
output->alloc_y = y;
output->transform = transform;
if (output->make)
free(output->make);
output->make = strdup(make);
if (output->model)
free(output->model);
output->model = strdup(model);
}
static void
handle_done(void *data, struct wl_output *wl_output)
{
NSDebugLog(@"handle_done");
}
static void
handle_scale(void *data, struct wl_output *wl_output, int32_t scale)
{
NSDebugLog(@"handle_scale");
struct output *output = data;
output->scale = scale;
}
static void
handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int width,
int height, int refresh)
{
NSDebugLog(@"handle_mode");
struct output *output = data;
if (flags & WL_OUTPUT_MODE_CURRENT)
{
output->width = width;
output->height = height /*- 30*/;
NSDebugLog(@"handle_mode output=%dx%d", width, height);
// XXX - Should we implement this?
// if (display->output_configure_handler)
// (*display->output_configure_handler)
// (output, display->user_data);
//
}
}
const struct wl_output_listener output_listener
= {handle_geometry, handle_mode, handle_done, handle_scale};

View file

@ -0,0 +1,92 @@
/*
WaylandServer - Seat Handling
Copyright (C) 2020 Free Software Foundation, Inc.
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
Date: November 2021
This file is part of the GNU Objective C Backend Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "wayland/WaylandServer.h"
extern const struct wl_keyboard_listener keyboard_listener;
extern const struct wl_pointer_listener pointer_listener;
static void
seat_handle_capabilities(void *data, struct wl_seat *seat,
enum wl_seat_capability caps)
{
WaylandConfig *wlconfig = data;
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !wlconfig->pointer.wlpointer)
{
wlconfig->pointer.wlpointer = wl_seat_get_pointer(seat);
wl_pointer_set_user_data(wlconfig->pointer.wlpointer, wlconfig);
wl_pointer_add_listener(wlconfig->pointer.wlpointer, &pointer_listener,
wlconfig);
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && wlconfig->pointer.wlpointer)
{
if (wlconfig->seat_version >= WL_POINTER_RELEASE_SINCE_VERSION)
wl_pointer_release(wlconfig->pointer.wlpointer);
else
wl_pointer_destroy(wlconfig->pointer.wlpointer);
wlconfig->pointer.wlpointer = NULL;
}
wl_display_dispatch_pending(wlconfig->display);
wl_display_flush(wlconfig->display);
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !wlconfig->keyboard)
{
wlconfig->keyboard = wl_seat_get_keyboard(seat);
wl_keyboard_set_user_data(wlconfig->keyboard, wlconfig);
wl_keyboard_add_listener(wlconfig->keyboard, &keyboard_listener,
wlconfig);
}
else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && wlconfig->keyboard)
{
if (wlconfig->seat_version >= WL_KEYBOARD_RELEASE_SINCE_VERSION)
wl_keyboard_release(wlconfig->keyboard);
else
wl_keyboard_destroy(wlconfig->keyboard);
wlconfig->keyboard = NULL;
}
#if 0
if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) {
input->touch = wl_seat_get_touch(seat);
wl_touch_set_user_data(input->touch, input);
wl_touch_add_listener(input->touch, &touch_listener, input);
} else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) {
if (input->seat_version >= WL_TOUCH_RELEASE_SINCE_VERSION)
wl_touch_release(input->touch);
else
wl_touch_destroy(input->touch);
input->touch = NULL;
}
#endif
}
const struct wl_seat_listener seat_listener = {
seat_handle_capabilities,
};

View file

@ -0,0 +1,167 @@
/*
WaylandServer - XdgShell Protocol Handling
Copyright (C) 2020 Free Software Foundation, Inc.
Author: Riccardo Canalicchio <riccardo.canalicchio(at)gmail.com>
Date: November 2021
This file is part of the GNU Objective C Backend Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "wayland/WaylandServer.h"
#include <AppKit/NSEvent.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSGraphics.h>
static void
xdg_surface_on_configure(void *data, struct xdg_surface *xdg_surface,
uint32_t serial)
{
struct window *window = data;
NSDebugLog(@"xdg_surface_on_configure: win=%d", window->window_id);
if (window->terminated == YES)
{
NSDebugLog(@"deleting window win=%d", window->window_id);
free(window);
return;
}
NSEvent *ev = nil;
NSWindow *nswindow = GSWindowWithNumber(window->window_id);
// NSDebugLog(@"Acknowledging surface configure %p %d (window_id=%d)",
// xdg_surface, serial, window->window_id);
xdg_surface_ack_configure(xdg_surface, serial);
window->configured = YES;
if (window->buffer_needs_attach)
{
[window->instance flushwindowrect:NSMakeRect(window->pos_x, window->pos_y,
window->width, window->height)
:window->window_id];
}
if (window->wlconfig->pointer.focus
&& window->wlconfig->pointer.focus->window_id == window->window_id)
{
ev = [NSEvent otherEventWithType:NSAppKitDefined
location:NSZeroPoint
modifierFlags:0
timestamp:0
windowNumber:(int) window->window_id
context:GSCurrentContext()
subtype:GSAppKitWindowFocusIn
data1:0
data2:0];
[nswindow sendEvent:ev];
}
}
static void
xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
int32_t width, int32_t height, struct wl_array *states)
{
struct window *window = data;
NSDebugLog(@"[%d] xdg_toplevel_configure %dx%d", window->window_id, width,
height);
// The compositor can send 0x0
if (width == 0 || height == 0)
{
return;
}
if (window->width != width || window->height != height)
{
window->width = width;
window->height = height;
xdg_surface_set_window_geometry(window->xdg_surface, 0, 0, window->width,
window->height);
NSEvent *ev = [NSEvent otherEventWithType:NSAppKitDefined
location:NSMakePoint(0.0, 0.0)
modifierFlags:0
timestamp:0
windowNumber:window->window_id
context:GSCurrentContext()
subtype:GSAppKitWindowResized
data1:window->width
data2:window->height];
[(GSWindowWithNumber(window->window_id)) sendEvent:ev];
}
NSDebugLog(@"[%d] notify resize from backend=%dx%d", window->window_id,
width, height);
}
static void
xdg_toplevel_close_handler(void *data, struct xdg_toplevel *xdg_toplevel)
{
NSDebugLog(@"xdg_toplevel_close_handler");
}
static void
xdg_popup_configure(void *data, struct xdg_popup *xdg_popup, int32_t x,
int32_t y, int32_t width, int32_t height)
{
struct window *window = data;
NSDebugLog(@"[%d] xdg_popup_configure [%d,%d %dx%d]", window->window_id, x, y,
width, height);
}
static void
xdg_popup_done(void *data, struct xdg_popup *xdg_popup)
{
struct window *window = data;
window->terminated = YES;
xdg_popup_destroy(xdg_popup);
wl_surface_destroy(window->surface);
}
static void
wm_base_handle_ping(void *data, struct xdg_wm_base *xdg_wm_base,
uint32_t serial)
{
NSDebugLog(@"wm_base_handle_ping");
xdg_wm_base_pong(xdg_wm_base, serial);
}
const struct xdg_surface_listener xdg_surface_listener = {
xdg_surface_on_configure,
};
const struct xdg_wm_base_listener wm_base_listener = {
.ping = wm_base_handle_ping,
};
const struct xdg_popup_listener xdg_popup_listener = {
.configure = xdg_popup_configure,
.popup_done = xdg_popup_done,
};
const struct xdg_toplevel_listener xdg_toplevel_listener = {
.configure = xdg_toplevel_configure,
.close = xdg_toplevel_close_handler,
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,311 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="wlr_layer_shell_unstable_v1">
<copyright>
Copyright © 2017 Drew DeVault
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that copyright notice and this permission
notice appear in supporting documentation, and that the name of
the copyright holders not be used in advertising or publicity
pertaining to distribution of the software without specific,
written prior permission. The copyright holders make no
representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied
warranty.
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
</copyright>
<interface name="zwlr_layer_shell_v1" version="3">
<description summary="create surfaces that are layers of the desktop">
Clients can use this interface to assign the surface_layer role to
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
rendered with a defined z-depth respective to each other. They may also be
anchored to the edges and corners of a screen and specify input handling
semantics. This interface should be suitable for the implementation of
many desktop shell components, and a broad number of other applications
that interact with the desktop.
</description>
<request name="get_layer_surface">
<description summary="create a layer_surface from a surface">
Create a layer surface for an existing surface. This assigns the role of
layer_surface, or raises a protocol error if another role is already
assigned.
Creating a layer surface from a wl_surface which has a buffer attached
or committed is a client error, and any attempts by a client to attach
or manipulate a buffer prior to the first layer_surface.configure call
must also be treated as errors.
You may pass NULL for output to allow the compositor to decide which
output to use. Generally this will be the one that the user most
recently interacted with.
Clients can specify a namespace that defines the purpose of the layer
surface.
</description>
<arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/>
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
<arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
<arg name="namespace" type="string" summary="namespace for the layer surface"/>
</request>
<enum name="error">
<entry name="role" value="0" summary="wl_surface has another role"/>
<entry name="invalid_layer" value="1" summary="layer value is invalid"/>
<entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
</enum>
<enum name="layer">
<description summary="available layers for surfaces">
These values indicate which layers a surface can be rendered in. They
are ordered by z depth, bottom-most first. Traditional shell surfaces
will typically be rendered between the bottom and top layers.
Fullscreen shell surfaces are typically rendered at the top layer.
Multiple surfaces can share a single layer, and ordering within a
single layer is undefined.
</description>
<entry name="background" value="0"/>
<entry name="bottom" value="1"/>
<entry name="top" value="2"/>
<entry name="overlay" value="3"/>
</enum>
<!-- Version 3 additions -->
<request name="destroy" type="destructor" since="3">
<description summary="destroy the layer_shell object">
This request indicates that the client will not use the layer_shell
object any more. Objects that have been created through this instance
are not affected.
</description>
</request>
</interface>
<interface name="zwlr_layer_surface_v1" version="3">
<description summary="layer metadata interface">
An interface that may be implemented by a wl_surface, for surfaces that
are designed to be rendered as a layer of a stacked desktop-like
environment.
Layer surface state (layer, size, anchor, exclusive zone,
margin, interactivity) is double-buffered, and will be applied at the
time wl_surface.commit of the corresponding wl_surface is called.
</description>
<request name="set_size">
<description summary="sets the size of the surface">
Sets the size of the surface in surface-local coordinates. The
compositor will display the surface centered with respect to its
anchors.
If you pass 0 for either value, the compositor will assign it and
inform you of the assignment in the configure event. You must set your
anchor to opposite edges in the dimensions you omit; not doing so is a
protocol error. Both values are 0 by default.
Size is double-buffered, see wl_surface.commit.
</description>
<arg name="width" type="uint"/>
<arg name="height" type="uint"/>
</request>
<request name="set_anchor">
<description summary="configures the anchor point of the surface">
Requests that the compositor anchor the surface to the specified edges
and corners. If two orthogonal edges are specified (e.g. 'top' and
'left'), then the anchor point will be the intersection of the edges
(e.g. the top left corner of the output); otherwise the anchor point
will be centered on that edge, or in the center if none is specified.
Anchor is double-buffered, see wl_surface.commit.
</description>
<arg name="anchor" type="uint" enum="anchor"/>
</request>
<request name="set_exclusive_zone">
<description summary="configures the exclusive geometry of this surface">
Requests that the compositor avoids occluding an area with other
surfaces. The compositor's use of this information is
implementation-dependent - do not assume that this region will not
actually be occluded.
A positive value is only meaningful if the surface is anchored to one
edge or an edge and both perpendicular edges. If the surface is not
anchored, anchored to only two perpendicular edges (a corner), anchored
to only two parallel edges or anchored to all edges, a positive value
will be treated the same as zero.
A positive zone is the distance from the edge in surface-local
coordinates to consider exclusive.
Surfaces that do not wish to have an exclusive zone may instead specify
how they should interact with surfaces that do. If set to zero, the
surface indicates that it would like to be moved to avoid occluding
surfaces with a positive exclusive zone. If set to -1, the surface
indicates that it would not like to be moved to accommodate for other
surfaces, and the compositor should extend it all the way to the edges
it is anchored to.
For example, a panel might set its exclusive zone to 10, so that
maximized shell surfaces are not shown on top of it. A notification
might set its exclusive zone to 0, so that it is moved to avoid
occluding the panel, but shell surfaces are shown underneath it. A
wallpaper or lock screen might set their exclusive zone to -1, so that
they stretch below or over the panel.
The default value is 0.
Exclusive zone is double-buffered, see wl_surface.commit.
</description>
<arg name="zone" type="int"/>
</request>
<request name="set_margin">
<description summary="sets a margin from the anchor point">
Requests that the surface be placed some distance away from the anchor
point on the output, in surface-local coordinates. Setting this value
for edges you are not anchored to has no effect.
The exclusive zone includes the margin.
Margin is double-buffered, see wl_surface.commit.
</description>
<arg name="top" type="int"/>
<arg name="right" type="int"/>
<arg name="bottom" type="int"/>
<arg name="left" type="int"/>
</request>
<request name="set_keyboard_interactivity">
<description summary="requests keyboard events">
Set to 1 to request that the seat send keyboard events to this layer
surface. For layers below the shell surface layer, the seat will use
normal focus semantics. For layers above the shell surface layers, the
seat will always give exclusive keyboard focus to the top-most layer
which has keyboard interactivity set to true.
Layer surfaces receive pointer, touch, and tablet events normally. If
you do not want to receive them, set the input region on your surface
to an empty region.
Events is double-buffered, see wl_surface.commit.
</description>
<arg name="keyboard_interactivity" type="uint"/>
</request>
<request name="get_popup">
<description summary="assign this layer_surface as an xdg_popup parent">
This assigns an xdg_popup's parent to this layer_surface. This popup
should have been created via xdg_surface::get_popup with the parent set
to NULL, and this request must be invoked before committing the popup's
initial state.
See the documentation of xdg_popup for more details about what an
xdg_popup is and how it is used.
</description>
<arg name="popup" type="object" interface="xdg_popup"/>
</request>
<request name="ack_configure">
<description summary="ack a configure event">
When a configure event is received, if a client commits the
surface in response to the configure event, then the client
must make an ack_configure request sometime before the commit
request, passing along the serial of the configure event.
If the client receives multiple configure events before it
can respond to one, it only has to ack the last configure event.
A client is not required to commit immediately after sending
an ack_configure request - it may even ack_configure several times
before its next surface commit.
A client may send multiple ack_configure requests before committing, but
only the last request sent before a commit indicates which configure
event the client really is responding to.
</description>
<arg name="serial" type="uint" summary="the serial from the configure event"/>
</request>
<request name="destroy" type="destructor">
<description summary="destroy the layer_surface">
This request destroys the layer surface.
</description>
</request>
<event name="configure">
<description summary="suggest a surface change">
The configure event asks the client to resize its surface.
Clients should arrange their surface for the new states, and then send
an ack_configure request with the serial sent in this configure event at
some point before committing the new surface.
The client is free to dismiss all but the last configure event it
received.
The width and height arguments specify the size of the window in
surface-local coordinates.
The size is a hint, in the sense that the client is free to ignore it if
it doesn't resize, pick a smaller size (to satisfy aspect ratio or
resize in steps of NxM pixels). If the client picks a smaller size and
is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
surface will be centered on this axis.
If the width or height arguments are zero, it means the client should
decide its own window dimension.
</description>
<arg name="serial" type="uint"/>
<arg name="width" type="uint"/>
<arg name="height" type="uint"/>
</event>
<event name="closed">
<description summary="surface should be closed">
The closed event is sent by the compositor when the surface will no
longer be shown. The output may have been destroyed or the user may
have asked for it to be removed. Further changes to the surface will be
ignored. The client should destroy the resource after receiving this
event, and create a new surface if they so choose.
</description>
</event>
<enum name="error">
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
<entry name="invalid_size" value="1" summary="size is invalid"/>
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
</enum>
<enum name="anchor" bitfield="true">
<entry name="top" value="1" summary="the top edge of the anchor rectangle"/>
<entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/>
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
</enum>
<!-- Version 2 additions -->
<request name="set_layer" since="2">
<description summary="change the layer of the surface">
Change the layer that the surface is rendered on.
Layer is double-buffered, see wl_surface.commit.
</description>
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
</request>
</interface>
</protocol>

View file

@ -0,0 +1,83 @@
/* Generated by wayland-scanner 1.18.0 */
/*
* Copyright © 2017 Drew DeVault
*
* Permission to use, copy, modify, distribute, and sell this
* software and its documentation for any purpose is hereby granted
* without fee, provided that the above copyright notice appear in
* all copies and that both that copyright notice and this permission
* notice appear in supporting documentation, and that the name of
* the copyright holders not be used in advertising or publicity
* pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
*/
#include <stdlib.h>
#include <stdint.h>
#include "wayland-util.h"
extern const struct wl_interface wl_output_interface;
extern const struct wl_interface wl_surface_interface;
extern const struct wl_interface xdg_popup_interface;
extern const struct wl_interface zwlr_layer_surface_v1_interface;
static const struct wl_interface *wlr_layer_shell_unstable_v1_types[] = {
NULL,
NULL,
NULL,
NULL,
&zwlr_layer_surface_v1_interface,
&wl_surface_interface,
&wl_output_interface,
NULL,
NULL,
&xdg_popup_interface,
};
static const struct wl_message zwlr_layer_shell_v1_requests[] = {
{ "get_layer_surface", "no?ous", wlr_layer_shell_unstable_v1_types + 4 },
{ "destroy", "3", wlr_layer_shell_unstable_v1_types + 0 },
};
WL_EXPORT const struct wl_interface zwlr_layer_shell_v1_interface = {
"zwlr_layer_shell_v1", 3,
2, zwlr_layer_shell_v1_requests,
0, NULL,
};
static const struct wl_message zwlr_layer_surface_v1_requests[] = {
{ "set_size", "uu", wlr_layer_shell_unstable_v1_types + 0 },
{ "set_anchor", "u", wlr_layer_shell_unstable_v1_types + 0 },
{ "set_exclusive_zone", "i", wlr_layer_shell_unstable_v1_types + 0 },
{ "set_margin", "iiii", wlr_layer_shell_unstable_v1_types + 0 },
{ "set_keyboard_interactivity", "u", wlr_layer_shell_unstable_v1_types + 0 },
{ "get_popup", "o", wlr_layer_shell_unstable_v1_types + 9 },
{ "ack_configure", "u", wlr_layer_shell_unstable_v1_types + 0 },
{ "destroy", "", wlr_layer_shell_unstable_v1_types + 0 },
{ "set_layer", "2u", wlr_layer_shell_unstable_v1_types + 0 },
};
static const struct wl_message zwlr_layer_surface_v1_events[] = {
{ "configure", "uuu", wlr_layer_shell_unstable_v1_types + 0 },
{ "closed", "", wlr_layer_shell_unstable_v1_types + 0 },
};
WL_EXPORT const struct wl_interface zwlr_layer_surface_v1_interface = {
"zwlr_layer_surface_v1", 3,
9, zwlr_layer_surface_v1_requests,
2, zwlr_layer_surface_v1_events,
};

View file

@ -0,0 +1,171 @@
/* Generated by wayland-scanner 1.18.0 */
/*
* Copyright © 2008-2013 Kristian Høgsberg
* Copyright © 2013 Rafael Antognolli
* Copyright © 2013 Jasper St. Pierre
* Copyright © 2010-2013 Intel Corporation
* Copyright © 2015-2017 Samsung Electronics Co., Ltd
* Copyright © 2015-2017 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <stdlib.h>
#include <stdint.h>
#include "wayland-util.h"
extern const struct wl_interface wl_output_interface;
extern const struct wl_interface wl_seat_interface;
extern const struct wl_interface wl_surface_interface;
extern const struct wl_interface xdg_popup_interface;
extern const struct wl_interface xdg_positioner_interface;
extern const struct wl_interface xdg_surface_interface;
extern const struct wl_interface xdg_toplevel_interface;
static const struct wl_interface *xdg_shell_types[] = {
NULL,
NULL,
NULL,
NULL,
&xdg_positioner_interface,
&xdg_surface_interface,
&wl_surface_interface,
&xdg_toplevel_interface,
&xdg_popup_interface,
&xdg_surface_interface,
&xdg_positioner_interface,
&xdg_toplevel_interface,
&wl_seat_interface,
NULL,
NULL,
NULL,
&wl_seat_interface,
NULL,
&wl_seat_interface,
NULL,
NULL,
&wl_output_interface,
&wl_seat_interface,
NULL,
&xdg_positioner_interface,
NULL,
};
static const struct wl_message xdg_wm_base_requests[] = {
{ "destroy", "", xdg_shell_types + 0 },
{ "create_positioner", "n", xdg_shell_types + 4 },
{ "get_xdg_surface", "no", xdg_shell_types + 5 },
{ "pong", "u", xdg_shell_types + 0 },
};
static const struct wl_message xdg_wm_base_events[] = {
{ "ping", "u", xdg_shell_types + 0 },
};
WL_EXPORT const struct wl_interface xdg_wm_base_interface = {
"xdg_wm_base", 3,
4, xdg_wm_base_requests,
1, xdg_wm_base_events,
};
static const struct wl_message xdg_positioner_requests[] = {
{ "destroy", "", xdg_shell_types + 0 },
{ "set_size", "ii", xdg_shell_types + 0 },
{ "set_anchor_rect", "iiii", xdg_shell_types + 0 },
{ "set_anchor", "u", xdg_shell_types + 0 },
{ "set_gravity", "u", xdg_shell_types + 0 },
{ "set_constraint_adjustment", "u", xdg_shell_types + 0 },
{ "set_offset", "ii", xdg_shell_types + 0 },
{ "set_reactive", "3", xdg_shell_types + 0 },
{ "set_parent_size", "3ii", xdg_shell_types + 0 },
{ "set_parent_configure", "3u", xdg_shell_types + 0 },
};
WL_EXPORT const struct wl_interface xdg_positioner_interface = {
"xdg_positioner", 3,
10, xdg_positioner_requests,
0, NULL,
};
static const struct wl_message xdg_surface_requests[] = {
{ "destroy", "", xdg_shell_types + 0 },
{ "get_toplevel", "n", xdg_shell_types + 7 },
{ "get_popup", "n?oo", xdg_shell_types + 8 },
{ "set_window_geometry", "iiii", xdg_shell_types + 0 },
{ "ack_configure", "u", xdg_shell_types + 0 },
};
static const struct wl_message xdg_surface_events[] = {
{ "configure", "u", xdg_shell_types + 0 },
};
WL_EXPORT const struct wl_interface xdg_surface_interface = {
"xdg_surface", 3,
5, xdg_surface_requests,
1, xdg_surface_events,
};
static const struct wl_message xdg_toplevel_requests[] = {
{ "destroy", "", xdg_shell_types + 0 },
{ "set_parent", "?o", xdg_shell_types + 11 },
{ "set_title", "s", xdg_shell_types + 0 },
{ "set_app_id", "s", xdg_shell_types + 0 },
{ "show_window_menu", "ouii", xdg_shell_types + 12 },
{ "move", "ou", xdg_shell_types + 16 },
{ "resize", "ouu", xdg_shell_types + 18 },
{ "set_max_size", "ii", xdg_shell_types + 0 },
{ "set_min_size", "ii", xdg_shell_types + 0 },
{ "set_maximized", "", xdg_shell_types + 0 },
{ "unset_maximized", "", xdg_shell_types + 0 },
{ "set_fullscreen", "?o", xdg_shell_types + 21 },
{ "unset_fullscreen", "", xdg_shell_types + 0 },
{ "set_minimized", "", xdg_shell_types + 0 },
};
static const struct wl_message xdg_toplevel_events[] = {
{ "configure", "iia", xdg_shell_types + 0 },
{ "close", "", xdg_shell_types + 0 },
};
WL_EXPORT const struct wl_interface xdg_toplevel_interface = {
"xdg_toplevel", 3,
14, xdg_toplevel_requests,
2, xdg_toplevel_events,
};
static const struct wl_message xdg_popup_requests[] = {
{ "destroy", "", xdg_shell_types + 0 },
{ "grab", "ou", xdg_shell_types + 22 },
{ "reposition", "3ou", xdg_shell_types + 24 },
};
static const struct wl_message xdg_popup_events[] = {
{ "configure", "iiii", xdg_shell_types + 0 },
{ "popup_done", "", xdg_shell_types + 0 },
{ "repositioned", "3u", xdg_shell_types + 0 },
};
WL_EXPORT const struct wl_interface xdg_popup_interface = {
"xdg_popup", 3,
3, xdg_popup_requests,
3, xdg_popup_events,
};

View file

@ -63,6 +63,18 @@
#include <math.h>
// The Windows SDK declares BOOL as an int. Objective C defines BOOl as a char.
// Those two types clash. MinGW's implementation of the Windows SDK uses the WINBOOL
// type to avoid this clash. When compiling natively on Windows, we need to manually
// define WINBOOL.
// MinGW will define _DEF_WINBOOL_ if it has defined WINBOOL so we can use the same trick
// here.
// See https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/include/ntdef.h#L355
#ifndef _DEF_WINBOOL_
#define _DEF_WINBOOL_
typedef int WINBOOL;
#endif
// To update the cursor..
static BOOL update_cursor = NO;
static BOOL should_handle_cursor = NO;
@ -700,7 +712,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
- (void) resizeBackingStoreFor: (HWND)hwnd
{
#if (BUILD_GRAPHICS==GRAPHICS_winlib)
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)hwnd, GWLP_USERDATA);
// FIXME: We should check if the size really did change.
if (win->useHDC)
@ -1635,10 +1647,10 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
// Borderless window request...
if (wstyle & WS_POPUP)
{
LONG wstyleOld = GetWindowLong(hwnd, GWL_STYLE);
LONG estyleOld = GetWindowLong(hwnd, GWL_EXSTYLE);
LONG wstyleNew = (wstyleOld & ~WS_OVERLAPPEDWINDOW);
LONG estyleNew = estyleOld | WS_EX_TOOLWINDOW;
LONG_PTR wstyleOld = GetWindowLongPtr(hwnd, GWL_STYLE);
LONG_PTR estyleOld = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
LONG_PTR wstyleNew = (wstyleOld & ~WS_OVERLAPPEDWINDOW);
LONG_PTR estyleNew = estyleOld | WS_EX_TOOLWINDOW;
NSDebugMLLog(@"WCTrace", @"wstyles - old: %8.8X new: %8.8X\n",
wstyleOld, wstyleNew);
@ -1646,8 +1658,8 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
estyleOld, estyleNew);
// Modify window style parameters and update the window information...
SetWindowLong(hwnd, GWL_STYLE, wstyleNew);
SetWindowLong(hwnd, GWL_EXSTYLE, estyleNew);
SetWindowLongPtr(hwnd, GWL_STYLE, wstyleNew);
SetWindowLongPtr(hwnd, GWL_EXSTYLE, estyleNew);
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
SWP_FRAMECHANGED | SWP_NOSENDCHANGING | SWP_NOREPOSITION |
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
@ -1678,8 +1690,8 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
@"-stylewindow: : called when [self handlesWindowDecorations] == NO");
NSDebugLLog(@"WTrace", @"stylewindow: %d : %d", style, winNum);
SetWindowLong((HWND)winNum, GWL_STYLE, wstyle);
SetWindowLong((HWND)winNum, GWL_EXSTYLE, estyle);
SetWindowLongPtr((HWND)winNum, GWL_STYLE, wstyle);
SetWindowLongPtr((HWND)winNum, GWL_EXSTYLE, estyle);
}
- (void) setbackgroundcolor: (NSColor *)color : (int)win
@ -1689,7 +1701,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
/** Changes window's the backing store to type */
- (void) windowbacking: (NSBackingStoreType)type : (int) winNum
{
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)winNum, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
NSDebugLLog(@"WTrace", @"windowbacking: %d : %d", type, winNum);
#if (BUILD_GRAPHICS==GRAPHICS_winlib)
@ -1817,7 +1829,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
if (op == NSWindowOut)
{
SetWindowLong((HWND)winNum, OFF_ORDERED, 0);
SetWindowLongPtr((HWND)winNum, OFF_ORDERED, 0);
ShowWindow((HWND)winNum, SW_HIDE);
return;
}
@ -1835,10 +1847,10 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
}
ShowWindow((HWND)winNum, flag);
SetWindowLong((HWND)winNum, OFF_ORDERED, 1);
SetWindowLongPtr((HWND)winNum, OFF_ORDERED, 1);
// Process window leveling...
level = GetWindowLong((HWND)winNum, OFF_LEVEL);
level = GetWindowLongPtr((HWND)winNum, OFF_LEVEL);
if (otherWin <= 0)
{
@ -1863,14 +1875,14 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
/* Put this on the same window level as the window we are ordering
* it against.
*/
otherLevel = GetWindowLong((HWND)otherWin, OFF_LEVEL);
otherLevel = GetWindowLongPtr((HWND)otherWin, OFF_LEVEL);
if (level != otherLevel)
{
NSDebugLLog(@"WTrace",
@"orderwindow: implicitly set level of %d (%d) to that of %d (%d)",
winNum, level, otherWin, otherLevel);
level = otherLevel;
SetWindowLong((HWND)winNum, OFF_LEVEL, level);
SetWindowLongPtr((HWND)winNum, OFF_LEVEL, level);
}
}
@ -1917,9 +1929,9 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
&& GetClassName((HWND)otherWin, buf, 32) == 18
&& strncmp(buf, "GNUstepWindowClass", 18) == 0)
{
if (GetWindowLong((HWND)otherWin, OFF_ORDERED) == 1)
if (GetWindowLongPtr((HWND)otherWin, OFF_ORDERED) == 1)
{
otherLevel = GetWindowLong((HWND)otherWin, OFF_LEVEL);
otherLevel = GetWindowLongPtr((HWND)otherWin, OFF_LEVEL);
NSDebugLLog(@"WTrace", @"orderwindow: found gnustep window %d (%d)",
otherWin, otherLevel);
if (otherLevel >= level)
@ -2000,9 +2012,9 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
&& GetClassName((HWND)otherWin, buf, 32) == 18
&& strncmp(buf, "GNUstepWindowClass", 18) == 0)
{
if (GetWindowLong((HWND)otherWin, OFF_ORDERED) == 1)
if (GetWindowLongPtr((HWND)otherWin, OFF_ORDERED) == 1)
{
otherLevel = GetWindowLong((HWND)otherWin, OFF_LEVEL);
otherLevel = GetWindowLongPtr((HWND)otherWin, OFF_LEVEL);
s = [s stringByAppendingFormat:
@"%d (%d)\n", otherWin, otherLevel];
}
@ -2039,7 +2051,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
#if (BUILD_GRAPHICS==GRAPHICS_winlib)
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)winNum, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
if ((win->useHDC)
&& (r.right - r.left != r2.right - r2.left)
@ -2084,10 +2096,10 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
- (void) setwindowlevel: (int) level : (int) winNum
{
NSDebugLLog(@"WTrace", @"setwindowlevel: %d : %d", level, winNum);
if (GetWindowLong((HWND)winNum, OFF_LEVEL) != level)
if (GetWindowLongPtr((HWND)winNum, OFF_LEVEL) != level)
{
SetWindowLong((HWND)winNum, OFF_LEVEL, level);
if (GetWindowLong((HWND)winNum, OFF_ORDERED) == YES)
SetWindowLongPtr((HWND)winNum, OFF_LEVEL, level);
if (GetWindowLongPtr((HWND)winNum, OFF_ORDERED) == YES)
{
[self orderwindow: NSWindowAbove : 0 : winNum];
}
@ -2096,7 +2108,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
- (int) windowlevel: (int) winNum
{
return GetWindowLong((HWND)winNum, OFF_LEVEL);
return GetWindowLongPtr((HWND)winNum, OFF_LEVEL);
}
- (NSArray *) windowlist
@ -2144,7 +2156,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
/** Set the maximum size of the window */
- (void) setmaxsize: (NSSize)size : (int) winNum
{
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)winNum, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
POINT p;
p.x = size.width;
@ -2154,20 +2166,20 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
// Disable the maximize box if a maximum size is set
if (size.width < 10000 || size.height < 10000)
{
SetWindowLong((HWND)winNum, GWL_STYLE,
GetWindowLong((HWND)winNum, GWL_STYLE) ^ WS_MAXIMIZEBOX);
SetWindowLongPtr((HWND)winNum, GWL_STYLE,
GetWindowLongPtr((HWND)winNum, GWL_STYLE) ^ WS_MAXIMIZEBOX);
}
else
{
SetWindowLong((HWND)winNum, GWL_STYLE,
GetWindowLong((HWND)winNum, GWL_STYLE) | WS_MAXIMIZEBOX);
SetWindowLongPtr((HWND)winNum, GWL_STYLE,
GetWindowLongPtr((HWND)winNum, GWL_STYLE) | WS_MAXIMIZEBOX);
}
}
/** Set the minimum size of the window */
- (void) setminsize: (NSSize)size : (int) winNum
{
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)winNum, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
POINT p;
p.x = size.width;
@ -2183,7 +2195,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
- (void) flushwindowrect: (NSRect)rect : (int)winNum
{
HWND hwnd = (HWND)winNum;
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (win)
{
@ -2290,15 +2302,15 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
{
if (alpha > 0.99)
{
SetWindowLong((HWND)win, GWL_EXSTYLE,
GetWindowLong((HWND)win, GWL_EXSTYLE) & ~WS_EX_LAYERED);
SetWindowLongPtr((HWND)win, GWL_EXSTYLE,
GetWindowLongPtr((HWND)win, GWL_EXSTYLE) & ~WS_EX_LAYERED);
RedrawWindow((HWND)win, NULL, NULL,
RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
}
else
{
SetWindowLong((HWND)win, GWL_EXSTYLE,
GetWindowLong((HWND)win, GWL_EXSTYLE) | WS_EX_LAYERED);
SetWindowLongPtr((HWND)win, GWL_EXSTYLE,
GetWindowLongPtr((HWND)win, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes((HWND)win, 0, 255 * alpha, LWA_ALPHA);
}
}
@ -2430,15 +2442,15 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
- (void) setIgnoreMouse: (BOOL)ignoreMouse : (int)win
{
int extendedStyle = GetWindowLong((HWND)win, GWL_EXSTYLE);
int extendedStyle = GetWindowLongPtr((HWND)win, GWL_EXSTYLE);
if (ignoreMouse)
{
SetWindowLong((HWND)win, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);
SetWindowLongPtr((HWND)win, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);
}
else
{
SetWindowLong((HWND)win, GWL_EXSTYLE, extendedStyle & ~WS_EX_TRANSPARENT);
SetWindowLongPtr((HWND)win, GWL_EXSTYLE, extendedStyle & ~WS_EX_TRANSPARENT);
}
}

View file

@ -68,8 +68,8 @@
win->useHDC = NO;
// Save win internals structure pointer for window handle...
SetWindowLong(hwnd, GWL_USERDATA, (int)win);
SetWindowLongPtr(hwnd, IME_INFO, (LONG)ime);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)win);
SetWindowLongPtr(hwnd, IME_INFO, (LONG_PTR)ime);
[self windowbacking: type : (int)hwnd];

View file

@ -63,7 +63,7 @@
- (void) decodeWM_DESTROYParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
{
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
// Clean up window-specific data objects.

View file

@ -170,9 +170,9 @@
&& GetClassName(hi, buf, 32) == 18
&& strncmp(buf, "GNUstepWindowClass", 18) == 0)
{
if (GetWindowLong(hi, OFF_ORDERED) == 1)
if (GetWindowLongPtr(hi, OFF_ORDERED) == 1)
{
hl = GetWindowLong(hi, OFF_LEVEL);
hl = GetWindowLongPtr(hi, OFF_LEVEL);
s = [s stringByAppendingFormat: @"%d (%d)\n", hi, hl];
}
}
@ -200,8 +200,8 @@
{
if (GetClassName(hi, buf, 32) == 18
&& strncmp(buf, "GNUstepWindowClass", 18) == 0
&& GetWindowLong(hi, OFF_ORDERED) == 1
&& (hl = GetWindowLong(hi, OFF_LEVEL))
&& GetWindowLongPtr(hi, OFF_ORDERED) == 1
&& (hl = GetWindowLongPtr(hi, OFF_LEVEL))
> NSDesktopWindowLevel)
{
break;
@ -220,8 +220,8 @@
{
if (GetClassName(lo, buf, 32) == 18
&& strncmp(buf, "GNUstepWindowClass", 18) == 0
&& GetWindowLong(lo, OFF_ORDERED) == 1
&& (ll = GetWindowLong(lo, OFF_LEVEL))
&& GetWindowLongPtr(lo, OFF_ORDERED) == 1
&& (ll = GetWindowLongPtr(lo, OFF_LEVEL))
> NSDesktopWindowLevel)
{
break;
@ -275,7 +275,7 @@
* to ensure that they are at the bottom unless another
* desktop level window is inserted below them.
*/
if (GetWindowLong(hwnd, OFF_LEVEL) <= NSDesktopWindowLevel)
if (GetWindowLongPtr(hwnd, OFF_LEVEL) <= NSDesktopWindowLevel)
{
inf->hwndInsertAfter = HWND_BOTTOM;
}
@ -284,7 +284,7 @@
- (LRESULT) decodeWM_GETMINMAXINFOParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
{
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
MINMAXINFO *mm;
if (win != NULL)

View file

@ -33,10 +33,22 @@
#include "win32/WIN32Server.h"
#include "win32/WIN32Geometry.h"
// The Windows SDK declares BOOL as an int. Objective C defines BOOl as a char.
// Those two types clash. MinGW's implementation of the Windows SDK uses the WINBOOL
// type to avoid this clash. When compiling natively on Windows, we need to manually
// define WINBOOL.
// MinGW will define _DEF_WINBOOL_ if it has defined WINBOOL so we can use the same trick
// here.
// See https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/include/ntdef.h#L355
#ifndef _DEF_WINBOOL_
#define _DEF_WINBOOL_
typedef int WINBOOL;
#endif
static void
invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
{
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)hwnd, GWLP_USERDATA);
if (!win->useHDC || win->backingStoreEmpty)
{

View file

@ -453,9 +453,14 @@ NSLog(@"No glyph for U%d", c);
logfont.lfItalic = 1;
logfont.lfQuality = DEFAULT_QUALITY;
wcsncpy(logfont.lfFaceName,
(const unichar*)[familyName cStringUsingEncoding: NSUnicodeStringEncoding],
LF_FACESIZE);
if (familyName)
{
wcsncpy(logfont.lfFaceName,
(const unichar*)[familyName cStringUsingEncoding: NSUnicodeStringEncoding],
LF_FACESIZE);
}
hFont = CreateFontIndirectW(&logfont);
if (!hFont)
{

View file

@ -1449,7 +1449,7 @@ HBITMAP GSCreateBitmap(HDC hDC, NSInteger pixelsWide, NSInteger pixelsHigh,
return NULL;
}
win = (WIN_INTERN *)GetWindowLong((HWND)window, GWL_USERDATA);
win = (WIN_INTERN *)GetWindowLongPtr((HWND)window, GWLP_USERDATA);
if (win && win->useHDC)
{
hDC = win->hdc;
@ -1482,7 +1482,7 @@ HBITMAP GSCreateBitmap(HDC hDC, NSInteger pixelsWide, NSInteger pixelsHigh,
}
[self restoreStyle: hDC];
win = (WIN_INTERN *)GetWindowLong((HWND)window, GWL_USERDATA);
win = (WIN_INTERN *)GetWindowLongPtr((HWND)window, GWLP_USERDATA);
if (win && !win->useHDC)
ReleaseDC((HWND)window, hDC);
}

View file

@ -1977,10 +1977,21 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
events */
if ([NSApp isHidden])
{
/* This often occurs when hidding an app, since a bunch of
windows get hidden at once, and the WM is searching for a
window to take focus after each one gets hidden. */
NSDebugLLog(@"Focus", @"WM take focus while hiding");
if (generic.wm & XGWM_WINDOWMAKER)
{
/* If window receives WM_TAKE_FOCUS and application is in hidden
state - it's time to unhide. There's no other method to
tell us to unhide. */
NSDebugLLog(@"Focus", @"WM take focus while hidden - unhiding.");
[NSApp unhide: nil];
}
else
{
/* This often occurs when hidding an app, since a bunch of
windows get hidden at once, and the WM is searching for a
window to take focus after each one gets hidden. */
NSDebugLLog(@"Focus", @"WM take focus while hiding");
}
}
else if (cWin->ignore_take_focus == YES)
{

View file

@ -79,7 +79,6 @@
static BOOL handlesWindowDecorations = YES;
static int _wmAppIcon = -1;
#define WINDOW_WITH_TAG(windowNumber) (gswindow_device_t *)NSMapGet(windowtags, (void *)(uintptr_t)windowNumber)
/* Current mouse grab window */
@ -804,6 +803,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
XEvent xEvent;
unsigned long *extents;
Offsets *o = generic.offsets + (style & 15);
int windowIdent;
int repp = 0;
int repx = 0;
int repy = 0;
@ -859,7 +859,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
/*
* Mark this as a GNUstep app with the current application name.
*/
classhint.res_name = generic.rootName;
classhint.res_name = "CheckWindowStyle";
classhint.res_class = "GNUstep";
XSetClassHint(dpy, window->ident, &classhint);
@ -913,9 +913,6 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
// Use the globally active input mode
window->gen_hints.flags = InputHint;
window->gen_hints.input = False;
// All the windows of a GNUstep application belong to one group.
window->gen_hints.flags |= WindowGroupHint;
window->gen_hints.window_group = ROOT;
/*
* Prepare the protocols supported by the window.
@ -1135,6 +1132,11 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
}
}
/* Calling termwindow should cause the window to be destroyed,
* so we need to take a copy of the window identifier to check
* for events left in the queue about that window.
*/
windowIdent = window->ident;
[self termwindow: window->number];
XSync(dpy, False);
while (XPending(dpy) > 0)
@ -1142,7 +1144,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
XNextEvent(dpy, &xEvent);
NSDebugLLog(@"Offset", @"Destroying ... event %d window %lu\n",
xEvent.type, xEvent.xany.window);
if (xEvent.xany.window != window->ident)
if (xEvent.xany.window != windowIdent)
{
continue;
}
@ -1599,24 +1601,6 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
// FIXME: Need to set WM_CLIENT_MACHINE as well.
}
/* WindowMaker hack: We want to display our own app icon window in the
* icon window provided by WindowMaker. However, this only works when
* the icon window is the first window being mapped. For that reason,
* we create an empty icon window here before the code below eventually
* generates some temporary windows to determine the window frame offsets
* and reuse the icon window once the real app icon window is allocated.
*/
if ((generic.wm & XGWM_WINDOWMAKER) == XGWM_WINDOWMAKER
&& generic.flags.useWindowMakerIcons == 1)
{
NSDebugLLog(@"XGTrace", @"WindowMaker hack: Preparing app icon window");
_wmAppIcon =
[self window: NSZeroRect : NSBackingStoreBuffered
: NSIconWindowMask : defScreen];
[self orderwindow: NSWindowAbove : -1 : _wmAppIcon];
NSDebugLLog(@"XGTrace", @"WindowMaker hack: icon window = %d", _wmAppIcon);
}
/* We need to determine the offsets between the actual decorated window
* and the window we draw into.
*/
@ -1643,12 +1627,14 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
*/
if ([defs boolForKey: @"GSIgnoreRootOffsets"] == YES)
{
NSLog(@"Ignoring _GNUSTEP_FRAME_OFFSETS root window property.");
offsets = 0;
}
else
{
offsets = (uint16_t *)PropGetCheckProperty(dpy,
DefaultRootWindow(dpy), generic._GNUSTEP_FRAME_OFFSETS_ATOM, XA_CARDINAL, 16, 60, &count);
offsets = (uint16_t *)PropGetCheckProperty(dpy, DefaultRootWindow(dpy),
generic._GNUSTEP_FRAME_OFFSETS_ATOM,
XA_CARDINAL, 16, 60, &count);
}
if (offsets == 0)
@ -1683,7 +1669,8 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
off[count++] = (uint16_t)generic.offsets[i].b;
}
XChangeProperty(dpy, DefaultRootWindow(dpy),
generic._GNUSTEP_FRAME_OFFSETS_ATOM, XA_CARDINAL, 16, PropModeReplace,
generic._GNUSTEP_FRAME_OFFSETS_ATOM,
XA_CARDINAL, 16, PropModeReplace,
(unsigned char *)off, 60);
}
}
@ -1881,19 +1868,18 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
RContext *context;
NSDebugLLog(@"XGTrace", @"DPSwindow: %@ %d", NSStringFromRect(frame), (int)type);
/* WindowMaker hack: Reuse the empty app icon allocated in _setupRootWindow
* for the real app icon.
*/
if ((generic.wm & XGWM_WINDOWMAKER) == XGWM_WINDOWMAKER
&& generic.flags.useWindowMakerIcons == 1
&& (style & NSIconWindowMask) == NSIconWindowMask
&& _wmAppIcon != -1)
/* WindowMaker hack: Reuse the empty app icon allocated in _createWMAppiconHack
* for the real app icon. */
if ((style & NSIconWindowMask) == NSIconWindowMask && _wmAppIcon != -1)
{
int win = _wmAppIcon;
NSDebugLLog(@"XGTrace", @"WindowMaker hack: Returning window %d as app icon window", win);
NSDebugLLog(@"XGTrace",
@"WindowMaker hack: Returning window %d as app icon window", win);
_wmAppIcon = -1;
return win;
}
root = [self _rootWindow];
context = [self screenRContext];
@ -2304,7 +2290,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
return;
}
NSLog(@"styleoffsets ... guessing offsets\n");
NSDebugLLog(@"Frame", @"styleoffsets ... guessing offsets\n");
if ((generic.wm & XGWM_WINDOWMAKER) != 0)
{
*l = *r = *t = *b = 1.0;
@ -2608,7 +2594,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
window = [XGServer _windowWithTag: win];
[self _sendRoot: window->root
type: generic._WINDOWMAKER_WM_FUNCTION_ATOM
window: window->ident
window: ROOT
data0: WMFHideApplication
data1: CurrentTime
data2: 0
@ -3977,7 +3963,7 @@ swapColors(unsigned char *image_data, NSBitmapImageRep *rep)
{
unsigned int opacity;
opacity = (unsigned int)(alpha * 0xffffffffU);
opacity = (unsigned int)(alpha * (float)0xffffffffU);
XChangeProperty(window->display, window->ident, generic._NET_WM_WINDOW_OPACITY_ATOM,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char*)&opacity, 1L);
@ -4013,7 +3999,7 @@ swapColors(unsigned char *image_data, NSBitmapImageRep *rep)
if (num)
{
if (*num)
alpha = (float)*num / 0xffffffffU;
alpha = (float)*num / (float)0xffffffffU;
XFree(num);
}

View file

@ -151,12 +151,18 @@
{
/* Always returns a Latin-1 string according to the manpage */
count = XLookupString (event, buf, BUF_LEN, &keysym, NULL);
if (count)
if (count == 1)
{
keys = [[[NSString alloc] initWithBytes: buf
length: count
encoding: NSISOLatin1StringEncoding] autorelease];
}
else if (count > 1) // manpage lies and we suppose UTF-8
{
keys = [[[NSString alloc] initWithBytes: buf
length: count
encoding: NSUTF8StringEncoding] autorelease];
}
if (keysymptr)
*keysymptr = keysym;

View file

@ -804,7 +804,7 @@ _bitmap_combine_alpha(RContext *context,
img.pro_mul = 255;
break;
default:
NSLog(@"Bizzare number of bits per sample %d", bits_per_sample);
NSLog(@"Bizarre number of bits per sample %d", bits_per_sample);
return -1;
}

View file

@ -106,7 +106,7 @@ cache_name()
if ([mgr fileExistsAtPath: path isDirectory: &flag] == NO || flag == NO)
{
NSLog(@"Library directory '%@' not available!", path);
return NO;
return nil;
}
path = [path stringByAppendingPathComponent: @"Fonts"];
if ([mgr fileExistsAtPath: path] == NO)
@ -116,7 +116,7 @@ cache_name()
if ([mgr fileExistsAtPath: path isDirectory: &flag] == NO || flag == NO)
{
NSLog(@"Fonts directory '%@' not available!", path);
return NO;
return nil;
}
path = [path stringByAppendingPathComponent: @"Cache"];
if ([mgr fileExistsAtPath: path] == NO)
@ -126,7 +126,7 @@ cache_name()
if ([mgr fileExistsAtPath: path isDirectory: &flag] == NO || flag == NO)
{
NSLog(@"Fonts directory '%@' not available!", path);
return NO;
return nil;
}
cacheName = [path stringByAppendingPathComponent: file_name];
RETAIN(cacheName);

View file

@ -62,7 +62,7 @@ accessibleRectForWindow (gswindow_device_t* win)
&ignoreUInt,
&ignoreUInt))
{
NSDebugLLog (@"XGGeometry", @"invalide Drawable in gswindow_device");
NSDebugLLog (@"XGGeometry", @"invalid Drawable in gswindow_device");
return XGMakeRect (0, 0, 0, 0);
}

View file

@ -191,9 +191,20 @@
}
mgr = [NSFileManager defaultManager];
if ([mgr fileExistsAtPath: path] == NO)
{
NSError *err;
BOOL r;
r = [mgr createDirectoryAtPath: path
withIntermediateDirectories: YES
attributes: nil
error: &err];
if (r == NO)
NSLog(@"font_cacher: Library directory creation error: %@", err);
}
if ([mgr fileExistsAtPath: path isDirectory: &flag] == NO || flag == NO)
{
NSLog(@"Library directory '%@' not available!", path);
NSLog(@"font_cacher: Library directory '%@' not available!", path);
return nil;
}
path = [path stringByAppendingPathComponent: @"Fonts"];

View file

@ -38,7 +38,12 @@
#endif
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#else
#include <io.h>
#define strcasecmp _stricmp
#endif
#include <ctype.h>
#ifdef __MINGW__
@ -229,7 +234,8 @@ NSMutableDictionary *pasteboards = nil;
{
if (verbose)
{
NSLog(@"-data for %@", self);
NSLog(@"-data (%llu bytes) provided for %@",
(unsigned long long)[data length], self);
}
return data;
}
@ -285,7 +291,8 @@ NSMutableDictionary *pasteboards = nil;
ASSIGN(data, d);
if (verbose)
{
NSLog(@"-setData: for %@", self);
NSLog(@"-setData: (%llu bytes) for %@",
(unsigned long long)[data length], self);
}
}
@ -863,8 +870,8 @@ NSMutableDictionary *pasteboards = nil;
e = [self entryByCount: count];
if (verbose)
{
NSLog(@"%@ set data %p for type '%@' version %d in %@",
self, data, type, count, e);
NSLog(@"%@ set data %p (%llu bytes) for type '%@' version %d in %@",
self, data, (unsigned long long)[data length], type, count, e);
}
if (e)
{
@ -1292,7 +1299,7 @@ main(int argc, char** argv, char **env)
if (host == nil)
{
NSLog(@"gpbs - unknown NSHost argument ... %@ - quiting.", hostname);
NSLog(@"gpbs - unknown NSHost argument ... %@ - quitting.", hostname);
exit(EXIT_FAILURE);
}
a = [host names];

View file

@ -40,6 +40,18 @@
#include <sys/file.h>
#endif
// The Windows SDK declares BOOL as an int. Objective C defines BOOl as a char.
// Those two types clash. MinGW's implementation of the Windows SDK uses the WINBOOL
// type to avoid this clash. When compiling natively on Windows, we need to manually
// define WINBOOL.
// MinGW will define _DEF_WINBOOL_ if it has defined WINBOOL so we can use the same trick
// here.
// See https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/include/ntdef.h#L355
#ifndef _DEF_WINBOOL_
#define _DEF_WINBOOL_
typedef int WINBOOL;
#endif
@interface Win32PbOwner : NSObject
{
NSPasteboard *_pb;

File diff suppressed because it is too large Load diff

View file

@ -3,12 +3,12 @@
# The version number of this release.
GNUSTEP_BACK_MAJOR_VERSION=0
GNUSTEP_BACK_MINOR_VERSION=28
GNUSTEP_BACK_MINOR_VERSION=32
GNUSTEP_BACK_SUBMINOR_VERSION=0
# This numeric value should match above
VERSION_NUMBER=028.0
VERSION_NUMBER=032.0
# This numeric value should match the compatible gui interface version
INTERFACE_VERSION_NUMBER=028
INTERFACE_VERSION_NUMBER=032
GNUSTEP_BACK_VERSION=${GNUSTEP_BACK_MAJOR_VERSION}.${GNUSTEP_BACK_MINOR_VERSION}.${GNUSTEP_BACK_SUBMINOR_VERSION}
VERSION=${GNUSTEP_BACK_VERSION}

View file

@ -1,14 +1,17 @@
/* config.h.in. Generated from configure.ac by autoheader. */
#define SERVER_x11 1
#define SERVER_win32 2
#define GRAPHICS_xdps 0
#define GRAPHICS_art 1
#define GRAPHICS_xlib 2
#define GRAPHICS_winlib 3
#define GRAPHICS_cairo 4
#define GRAPHICS_opal 5
#define SERVER_x11 1
#define SERVER_win32 2
#define SERVER_wayland 3
#define SERVER_headless 4
#define GRAPHICS_xdps 0
#define GRAPHICS_art 1
#define GRAPHICS_xlib 2
#define GRAPHICS_winlib 3
#define GRAPHICS_cairo 4
#define GRAPHICS_opal 5
#define GRAPHICS_headless 6
/* Define to type of graphics context to build */
@ -41,27 +44,33 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `wayland-client' library (-lwayland-client). */
#undef HAVE_LIBWAYLAND_CLIENT
/* Define to 1 if you have the `Xext' library (-lXext). */
#undef HAVE_LIBXEXT
/* Define to 1 if you have the `Xft' library (-lXft). */
#undef HAVE_LIBXFT
/* Define to 1 if you have the `xkbcommon' library (-lxkbcommon). */
#undef HAVE_LIBXKBCOMMON
/* Define to 1 if you have the `Xmu' library (-lXmu). */
#undef HAVE_LIBXMU
/* Define to 1 if you have the `Xt' library (-lXt). */
#undef HAVE_LIBXT
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `shmctl' function. */
#undef HAVE_SHMCTL
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
@ -92,6 +101,9 @@
/* Define if you have XftDrawStringUtf8 */
#undef HAVE_UTF8
/* Define to 1 if you have the <wayland-util.h> header file. */
#undef HAVE_WAYLAND_UTIL_H
/* Define if you have the wgl library */
#undef HAVE_WGL
@ -101,6 +113,9 @@
/* Define to 1 if you have the <X11/extensions/sync.h> header file. */
#undef HAVE_X11_EXTENSIONS_SYNC_H
/* Define to 1 if you have the <X11/extensions/Xrandr.h> header file. */
#undef HAVE_X11_EXTENSIONS_XRANDR_H
/* Define to 1 if you have the <X11/extensions/XShm.h> header file. */
#undef HAVE_X11_EXTENSIONS_XSHM_H
@ -117,15 +132,18 @@
/* Define to 1 if you have 'XInternAtoms' function. */
#undef HAVE_XINTERNATOMS
/* Define to 1 if you have the <xkbcommon/xkbcommon.h> header file. */
#undef HAVE_XKBCOMMON_XKBCOMMON_H
/* Define to enable Xrandr support */
#undef HAVE_XRANDR
/* Define to enable Xshape support */
#undef HAVE_XSHAPE
/* Define to 1 if you have the `Xutf8LookupString' function. */
#undef HAVE_XUTF8LOOKUPSTRING
/* Define to enable Xrandr support */
#undef HAVE_XRANDR
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
@ -144,7 +162,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Define to enable glitz support */

4785
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -565,10 +565,10 @@ case $target_os in
esac
AC_ARG_ENABLE(server,
[ --enable-server=SRV Build server type: x11, win32],,
[ --enable-server=SRV Build server type: x11, win32, wayland, headless],,
enable_server=$BUILD_SERVER)
AC_ARG_ENABLE(graphics,
[ --enable-graphics=GPH Build graphics: xlib, xdps, winlib, art, cairo, opal],,
[ --enable-graphics=GPH Build graphics: xlib, xdps, winlib, art, cairo, opal, headless],,
enable_graphics="$BUILD_GRAPHICS")
BUILD_SERVER=$enable_server
@ -584,6 +584,8 @@ if test x"$BUILD_GRAPHICS" = "xcairo"; then
AC_MSG_WARN([can't find freetype, required for graphics=cairo])
if test $BUILD_SERVER = win32; then
BUILD_GRAPHICS=winlib
elif test $BUILD_SERVER = wayland; then
AC_MSG_ERROR([wayland backend requires cairo])
else
BUILD_GRAPHICS=xlib
fi
@ -592,6 +594,8 @@ if test x"$BUILD_GRAPHICS" = "xcairo"; then
AC_MSG_WARN([can't find cairo, required for graphics=cairo!])
if test $BUILD_SERVER = win32; then
BUILD_GRAPHICS=winlib
elif test $BUILD_SERVER = wayland; then
AC_MSG_ERROR([wayland backend requires cairo])
else
BUILD_GRAPHICS=art
fi
@ -642,8 +646,18 @@ if test x"$BUILD_GRAPHICS" = "xcairo"; then
CAIRO_LIBS="$CAIRO_LIBS $CAIRO_XLIB_LIBS $XFT_LIBS"
CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_XLIB_CFLAGS"
AC_MSG_RESULT(xlib)
else
AC_MSG_ERROR([Invalid Cairo installation])
elif test $BUILD_SERVER = wayland; then
AC_CHECK_HEADERS(wayland-util.h,,
[AC_MSG_ERROR([**** No wayland-util.h. Install libwayland-dev or equivalent.])])
AC_CHECK_LIB(wayland-client, wl_display_flush,,
[AC_MSG_ERROR([**** No wl_display_flush in libwayland-client. Install correct version of libwayland-dev or equivalent.])])
AC_CHECK_HEADERS(xkbcommon/xkbcommon.h,,
[AC_MSG_ERROR([**** No xkbcommon/xkbcommon.h. Required for wayland. Install libxkbcommon-dev or equivalent.])])
AC_CHECK_LIB(xkbcommon, xkb_context_new,,
[AC_MSG_ERROR([**** No xkb_context_new in libxkbcommon. Install correct version of libxkbcommon-dev or equivalent.])])
CAIRO_LIBS="$CAIRO_LIBS $XFT_LIBS"
CAIRO_CFLAGS="$CAIRO_CFLAGS"
LIBS="-lwayland-client -lwayland-cursor -lxkbcommon $LIBS"
fi
LIBS="$CAIRO_LIBS $LIBS"
CPPFLAGS="$CAIRO_CFLAGS $CPPFLAGS"
@ -701,6 +715,8 @@ elif test x"$BUILD_GRAPHICS" = "xopal"; then
fi
AC_MSG_NOTICE([Switching to $BUILD_GRAPHICS])
fi
elif test x"$BUILD_GRAPHICS" = "xheadless"; then
: # Nothing to do
else
AC_MSG_ERROR([Invalid graphics backend $BUILD_GRAPHICS])
fi
@ -741,14 +757,17 @@ if test $BUILD_SERVER = win32; then
fi
AH_TOP([
#define SERVER_x11 1
#define SERVER_win32 2
#define GRAPHICS_xdps 0
#define GRAPHICS_art 1
#define GRAPHICS_xlib 2
#define GRAPHICS_winlib 3
#define GRAPHICS_cairo 4
#define GRAPHICS_opal 5
#define SERVER_x11 1
#define SERVER_win32 2
#define SERVER_wayland 3
#define SERVER_headless 4
#define GRAPHICS_xdps 0
#define GRAPHICS_art 1
#define GRAPHICS_xlib 2
#define GRAPHICS_winlib 3
#define GRAPHICS_cairo 4
#define GRAPHICS_opal 5
#define GRAPHICS_headless 6
])
AC_DEFINE_UNQUOTED(BUILD_SERVER,SERVER_$BUILD_SERVER,
[Define to type of window server to build])

7
wayland-regenerate.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
# This script is used to regenerate xdg-shell-protocol public code and headers
# from the XML specification.
wayland-scanner public-code /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml Source/wayland/xdg-shell-protocol.c
wayland-scanner client-header /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml Headers/wayland/xdg-shell-client-protocol.h