Commit graph

987 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Marcus Müller
df63d305ac Fix ALPHA_THRESHOLD typo 2020-01-21 23:59:26 +01:00
Sergii Stoian
19a68d2d85 * Source/art/ftfont.m: removed commented out #include and #include
moved into ftfont.h.
2020-01-19 01:31:21 +02:00
Sergii Stoian
2657c4437c * Source/art/shfill.m:,
* Source/art/path.m:,
* Source/art/image.m (DPSimage:::::::::::):
  fixed type formatting specifiers.

* Source/art/ftfont.m: removed include to ftfont-old.m.
  (drawString:at::to::::::::color::::transform:deltas:::widthChar:drawinfo:):,
  (drawGlyphs::at::to::::::color::::transform:drawinfo:):,
  (drawGlyphs::at::to::::::alpha::color::::transform:drawinfo:):,
  (bezierpath_funcs):,
  fixed type formatting specifiers; moved interface declaration of FTFontInfo
  to ftfont.h; removed GCCism.

* Source/art/ftfont.h: moved interface declaration of FTFontInfo here.
* Source/art/composite.m: fixed type formatting specifiers.
* Source/art/FTFontEnumerator.m (load_font_configuration): fixed type
  formatting specifiers.
2020-01-17 17:23:07 +02:00
Sergii Stoian
9cc708e9e8 * Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:): key_window
definition moved to the `if` block where it's used.
2020-01-16 19:47:48 +02:00
Sergii Stoian
a1f08ad8ca * Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:): tiny
formatting fix.
2020-01-16 11:44:28 +02:00
Sergii Stoian
4e5f2ddbb1 * Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:): use
`cWin` instead of `this_window`
* ChangeLog: updated.
2020-01-16 11:41:02 +02:00
Sergii Stoian
124a18f026 * Source/x11/XGServerEvent.m (_handleTakeFocusAtom:forContext:):
- use lowerCamelCase for objects and underscores for primitive types;
  - added and used `this_window` variable - represents window that has
    received TakeFocus event - instead of `cWin` (last used window by
    backend);
  - do not ignore TakeFocus request if now key window was set
    and if main application menu received request.
2020-01-16 00:54:34 +02:00
Sergii Stoian
d1dd3f0f5c * Source/x11/XGServerWindow.m (ALPHA_THRESHOLD): removed duplicate of
definition.
2020-01-14 10:52:59 +02:00
Sergii Stoian
9e298b2142 * Source/x11/XGServerWindow.m (alphaMaskForImage):
(imagecursor:::): renamed missed image_mask() call.
2020-01-14 02:05:07 +02:00
Sergii Stoian
f9a9d6679b * Source/x11/XGServerWindow.m (alphaMaskForImage): renamed from
image_mask().
  (swapColors): new function to convert colors from ARGB order into RGBA
  (big-endian systems) or BGRA (little-endian systems).
  (_createAppIconPixmaps): use swapColors() and remove unused code.
  (restrictWindow:toImage:): use alphaMaskForImage().
  (imagecursor:::): use swapColors() and remove unused code.
2020-01-14 01:58:30 +02:00
Sergii Stoian
528660834c * Source/x11/XGServerWindow.m (_createNetIcon:result:size:): fixed
off-by-one mistake during alpha handling. Enable disabled code and
  remove temprorary one.
  (window::::): set NetWM icon to window for all EWMH capable WMs even
  it's WindowMaker.
  (image_mask): new function to create alpha mask for image. It's based
  on xgps_cursor_mask() code with additional argument `alpha_treshold`.
  This function may be used for images (alpha_treshold == 0) with real
  alpha mask and for cursors (if no Xcursor library is used - no alpha
  is used, no shadows in cursors, alpha_treshold == 158 is used to cut
  transparent pixels).
  (_createAppIconPixmaps): icon pixmap creation rewritten to support
  images with alpha channel using wraster functions. Use image_mask().
  (restrictWindow:toImage:): use image_mask() instead of
  xgps_cursor_mask().
  (xgps_cursor_mask): removed as image_mask() replaced it.
  Guard xgps_cursor_image( with #if - will not be compiled if Xcursor
  is used.
  (imagecursor:::): use image_mask() instead of xgps_cursor_mask().
2020-01-13 01:34:11 +02:00
fredkiefer
de86246567 * Source/cairo/CairoFontInfo.m: Revert to the old defaults for
hinting and allow for all possible values to be set.
2019-12-24 14:10:02 +01:00
fredkiefer
36283735ab * Source/cairo/CairoFontInfo.m,
* Source/fontconfig/FCFontEnumerator.m: Small cleanup of last pull
request.
2019-05-19 22:56:48 +02:00