Commit graph

1334 commits

Author SHA1 Message Date
Sergii Stoian
0e811399dc * Source/x11/XGServerEvent.m (mouseLocationOnScreen🪟): use xScreenSize
instead of DisplayHeight. Fixes mouse events handling on multi-monitor
  configuration with vertical layout.
2020-02-26 01:45:47 +02:00
Sergii Stoian
983035a7a6
Merge pull request #22 from gnustep/randr
Window positionning: rely on internal variable not the GUI's one
2020-02-24 23:56:44 +02:00
Sergii Stoian
70e4222ece * Source/x11/XGServerWindow.m (placewindow::): move NSWindow fetching
code closer to its usage.
2020-02-24 23:53:57 +02:00
Sergii Stoian
f080ecdf78 Merge branch 'master' into randr
Conflicts:
	ChangeLog
2020-02-24 01:35:28 +02:00
Sergii Stoian
4c9ca90eac * Source/x11/XGServerWindow.m (placewindow::): use window->xframe
as current window frame instead of NSWindow's frame because
  `_frame` ivar may be already changed to target value.
2020-02-24 01:20:54 +02:00
fredkiefer
4924e11a0b * Source/x11/XGServerWindow.m (-_createAppIconPixmaps): Made
preconditions of new code explicit.
* Source/x11/XGServerWindow.m (-orderwindow:::): Set icon pixmap
only for WindowMaker.
2020-02-21 16:35:04 +01:00
Sergii Stoian
638940fb28 * Headers/x11/XGServer.h (GSDisplayServer): added new ivar xScreenSize
to hold Xlib screen size dimensions.

* Source/x11/XGServerWindow.m: 
  (_OSFrameToXFrame:for:): use xScreenSize instead of DisplayHeight.
  (_OSFrameToXHints:for:): ditto.
  (_XFrameToOSFrame:for:): ditto.
  (movewindow::): ditto.
  (_screenSize): new static function to get dimensions of Xlib screen from
  root window.
  (screenList): use xScreenSize instead of DisplayHeight/DisplayWidth.
2020-02-20 19:13:06 +02:00
fredkiefer
bf2b88f16e * Source/x11/XGServerWindow.m (screenList): Clean up implementation again. 2020-02-14 17:05:36 +01:00
Sergii Stoian
c3e7b37ac0 ChangeLog: update. 2020-02-12 00:36:18 +02:00
Sergii Stoian
00a79638cf * Source/x11/XGServerWindow.m (screenList): revert back to old code
logic: if XRandR available but can't get screens info for some reasons,
  return array with one element (Xlib screen info).
2020-02-12 00:35:45 +02:00
Fred Kiefer
6923a62820
Merge pull request #21 from gnustep/randr
Align screens origin to OpenStep coordinate system.
2020-02-11 23:19:17 +01:00
Sergii Stoian
230006323d * Source/x11/XGServerWindow.m (screeList): remove usage of intermediate frame variable. 2020-02-11 23:56:39 +02:00
Sergii Stoian
2fdced823c Merge branch 'master' into randr
Conflicts:
	ChangeLog
	Source/x11/XGServerWindow.m
2020-02-11 23:38:52 +02:00
Sergii Stoian
9c4f9ce7fc * Source/x11/XGServerWindow.m (screenList): Transform screen
origin into unflipped (OpenStep) coordinate system for XRandR capable
  systems. After this change windows and screen will use the same start
  of coordinate system for their origins.
2020-02-11 18:21:34 +02:00
fredkiefer
2c99cfc730 Fixes after Xrandr change to get xlib backend to compile again. 2020-02-08 21:30:54 +01:00
fredkiefer
f9d3dd7f96 * Source/x11/XGServerWindow.m (screenList): Clean up implementation. 2020-02-08 13:35:43 +01:00
Sergii Stoian
74bab329ba
Merge pull request #19 from gnustep/randr
Screens handling with RandR fixes
2020-02-08 02:51:58 +02:00
Sergii Stoian
519d267d60 * Source/x11/XGServerWindow.m (resolutionForScreen:): fixed parameter
name in comment.
2020-02-08 01:54:18 +02:00
Sergii Stoian
e6108e05f7 * Source/x11/XGServerWindow.m (_XFrameToOSFrame:for:): use Xlib
screen height instead of monitor's because we convert coordinates
  from Xlib area.
  (movewindow::): use Xlib screen height because we're operating in
  Xlib coordinate system.
  (screenList): fill monitor depth with value returned by
  windowPathForScreen with monitor at index 0 (screen_id already set so
  method will get correct screen_id).

* Source/x11/XGServerEvent.m (processEvent:): fixed indentaion.
2020-02-07 19:00:27 +02:00
Sergii Stoian
bcf71f2302 Merge remote-tracking branch 'origin/master' into randr
Conflicts:
	ChangeLog
	Source/x11/XGServerWindow.m
2020-02-07 16:30:52 +02:00
Sergii Stoian
82931a4a61 * Source/x11/XGServerWindow.m (_OSFrameToXFrame:for:):,
(_OSFrameToXHints:for:): use Xlib screen height instead of monitor's
  because we convert coordinates to Xlib area.

* Source/x11/XGServerEvent.m (processEvent:): update monitor_id from
  NSWindow's screen number (it could change after event processing).
  (mouseLocationOnScreen🪟): use Xlib screen height instead of
  monitor's. Added comment to code that should be probably removed
  later.
2020-02-07 16:01:03 +02:00
fredkiefer
c79b2a7b09 * Source/x11/XGServerWindow.m (swapColors): Made code more
explicit and removed additional copy before calling this function.
This function should now do what the comment above it says.
(alphaMaskForImage): Slightly cleaner code.
2020-02-07 10:13:48 +01:00
Sergii Stoian
84ec2f0110 * Source/x11/XGServerWindow.m (screenList): do not create monitors as
sparse array. This is usefull when -boundsToScreen: called with paramter
  value `0` and there is no monitor connected to first RandR ouput.
2020-02-04 02:45:14 +02:00
Sergii Stoian
1065e45869 * Source/x11/XGServerWindow.m (screenList): fixed comment.
(resolutionForScreen:): parameter renamed.
2020-02-03 23:25:03 +02:00
Sergii Stoian
6a1c1600a2 * Source/x11/XGServerWindow.m (screenList): insert primary (main)
monitor index into index 0 of returned array.
2020-02-03 18:24:54 +02:00
Sergii Stoian
e3da99fb5e * Source/x11/XGServerWindow.m (screenList): call windowDepthForScreen:
with monitor index, not screen ID (screen_id field has already set
  to defScreen above).
  (windowDepthForScreen:): get Xlib screen with screen_id from monitor
  lit.
2020-02-03 15:27:40 +02:00
Sergii Stoian
904739eb0c * Source/x11/XGServerWindow.m (screenList): update comment.
(nativeWindow:::::): assign `*screen` to `screen_id`, `monitor_id` is
set to `0`.
2020-02-03 14:29:25 +02:00
Sergii Stoian
87da2f0a28 * Source/x11/XGServer.m: use #pragma clang only if clang
compiler is used.
2020-02-03 13:56:18 +02:00
Sergii Stoian
8b66164d88 * Source/x11/XGServer.m (getForScreen:pixelFormat:masks:::):
removed unused code.
2020-02-03 13:31:27 +02:00
Sergii Stoian
c1ab242c9e * gswindow_device_t structure element screen was renamed to
`screen_id`; `monitor_id` element was added. Made use of
  `screen_id` and `monitor_id` where it's appropriate.

* Removed `screen` parameter from methods which contains it in name.
  Methods were renamed to remove `Screen` and `FromScreen`.

* Source/x11/XGServerWindow.m (screenList): change with assumption
  that Xlib screen is one per application.
  Failback code to RandR-related always creates arrays with one element
  (no enumeration needed). Create `monitor` structure in failback (non-RandR)
  code. Use `screen_id` MonitorDevice structure element to hold	Xlib screen
  ID.
  (windowDepthForScreen:): assume that `screen` parameter is a Xlib screen ID,
  simplify code - `screen` will be used with RandR or not.
  (availableDepthsForScreen:): changed with assumption that `screen` is a index
  of element in `monitors` structure.

* Source/x11/XGServer.m (_initXContext): initialize `monitors` array
  early here before first use (calls to XGServerWindow methods).
2020-02-03 01:21:52 +02:00
Sergii Stoian
3e53e04c58 * Source/x11/XGServerWindow.m (screenList): join RandR and non-RandR
code. Failback to Xlib generic method if any no RandR available or
  RandR function call was unsuccessful. In Xlib generic method fill in
  monitors array with values.
  (boundsForScreen:): use values from cached `monitors` array since
  -screenList fills it on both cases with or without RandR available.
2020-01-31 19:28:32 +02:00
Sergii Stoian
022a988e97 * Source/x11/XGServerWindow.m (boundsForScreen:): check for number of
XRandR's ouputs.
2020-01-31 18:59:49 +02:00
Riccardo Mottola
ae3510f385 Check if Xrandr did not succeed and provide fallback. 2020-01-31 16:29:01 +01:00
Sergii Stoian
7e6dfa39e8 * Source/x11/XGServerWindow.m (screenList): fixed missed rename count
into `monitorsCount` on non-RandR code.
2020-01-30 14:08:59 +02:00
Sergii Stoian
c4631e0fc3 * Source/x11/XGServerWindow.m:
(windowDepthForScreen:): renamed method parameter; append `x_` prefix to
  `Screen *` internal variable; validate `screen` parameter value; use
  `defScreen` for RandR enabled code.
  (availableDepthsForScreen:): ditto.
  (resolutionForScreen:): renamed method parameter; validate `screen`
  parameter value.
  (boundsForScreen:): renamed method parameter.
2020-01-30 13:58:34 +02:00
Sergii Stoian
66f1e75c50 ChangeLog: fix date in last change. 2020-01-30 01:29:56 +02:00
Sergii Stoian
62bef72ac0 * Headers/x11/XGServer.h: monitorsCount ivar was added to hold
`monitors` array items.
* Source/x11/XGServerWindow.m: use `monitorsCount` instead of local
  variable `count` or ScreenCount() value.
* ChangeLog: update to the latest changes.
Mark methods where usage of X Screen as parameter is correct and where isn't.
2020-01-30 01:27:11 +02:00
Sergii Stoian
7ebd2468b1 * Headers/x11/XGServer.h,
* Source/x11/XGServer.m,
* Source/x11/XGServerWindow.m: hold the cache of connected monitor devices
  parameters - `monitors` - a an array structures.
2020-01-29 19:23:52 +02:00
Sergii Stoian
88bc2a4efd
Merge pull request #18 from gnustep/randr
Dynamic screen resolution change support
2020-01-29 14:55:09 +02:00
Sergii Stoian
f38d8a33bd * Source/x11/XGServerEvent.m (processEvent:): add space after comma in
XSync call.
* Source/x11/XGServerWindow.m (boundsForScreen:): use NSZeroRect.
2020-01-28 12:04:03 +02:00
Sergii Stoian
8d9223aa1e Merge branch 'randr' of https://github.com/gnustep/libs-back into randr 2020-01-28 11:53:11 +02:00
Sergii Stoian
6947c49951 * Headers/x11/XGServer.h: split RandR variables defintion into separate
lines.
2020-01-28 11:52:24 +02:00
Fred Kiefer
f0395f07ce
Merge branch 'master' into randr 2020-01-27 23:19:03 +01:00
Sergii Stoian
b5c563a400 * Source/x11/XGServerWindow.m (boundsForScreen:): use screen variable
to identify output in RandR screen resources. Use `boundsRect` local
  variable as return vaalue storage. Cleanup.
2020-01-26 23:56:00 +02:00
Sergii Stoian
111add7ec2
Merge pull request #16 from trunkmaster/master
Clang warnings fix for ART backend
2020-01-26 22:52:55 +02:00
Sergii Stoian
72284c1d37 * Source/art/ftont-old.m: is unused, so removed. 2020-01-26 22:51:22 +02:00
Sergii Stoian
78a5f6a380 * Source/x11/XGServerEvent.m (processEvent:),
* Source/x11/XGServer.m (_initXContext): catch and process RandR event
  on default screen.
2020-01-26 02:55:34 +02:00
Sergii Stoian
7f24ad7d89 * Source/x11/XGServerWindow.m (_OSFrameToXFrame:for:): use
-boundsForScreen: to get correct screen dimensions if RandR is supported.
(_OSFrameToXHints:for:): ditto.
(_XFrameToOSFrame:for:): ditto.
(movewindow::): ditto.
(windowbounds:): ditto.
(setMouseLocation:onScreen:): ditto.
* Source/x11/XGDragView.m: ditto.

* Source/x11/XGServerEvent.m (processEvent:): destroy NSScreen screens
list to be regenereated on next call. This change updates ivars of
NSScreen (_frame, _depth) by recreating NSScreen instances.
(mouseLocationOnScreen🪟): use -boundsForScreen: to get correct
screen dimensions if RandR is supported.
2020-01-24 19:43:09 +02:00
Sergii Stoian
64335397b5 * Headers/x11/XGServer.h (GSDisplayServer): RandR event and error base
ivars were added.
* Source/x11/XGServer.m (_initXContext): get RandR event and error base.
* Source/x11/XGServerEvent.m (processEvent:): pack several RandR events
  into one notification post.
2020-01-23 19:03:34 +02:00
Sergii Stoian
501c6eb018 * Source/x11/XGServerWindow.m (boundsForScreen:): if Xrandr support
enabled get screen dimensions using Xrandr objects.
* Source/x11/XGServerEvent.m (processEvent:): process Xrandr event and
  send NSApplicationDidChangeScreenParametersNotification.
* Source/x11/XGServer.m	(_initXContext): subscribe to the Xrandr event.
2020-01-23 02:02:52 +02:00