Commit graph

359 commits

Author SHA1 Message Date
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
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
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
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
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
Sergii Stoian
00a1180684 * Source/x11/XGServerWindow.m (standardcursor::): Getting of
XC_fleur as GSCloseHandCursor was removed because it loads in
NSCursor as image.
2019-04-20 02:01:40 +03:00
Sergii Stoian
39e2e16bec * Source/x11/XGServerWindow.m (standardcursor::): revert resizing
cursor names to the old values upon request of project owner.
2019-04-18 01:22:57 +03:00
Sergii Stoian
d4a4888b9d * Source/x11/XGServerWindow.m (getStandardBitmap): send bitmapFormat
to _convertToFormatBitsPerSample::::::::. Fixes display of colored
mouse cursor images.
(standardcursor::): cleanup in Xlib cursors handling. Additional
cursor types were added: GSClosedHandCursor, GSOpenHandCursor.
Removed GSDisappearingItemCursor type handling - it loads in NSCursor
from image.
2019-04-17 18:06:19 +03:00
Sergii Stoian
b5003272a7 * Source/x11/XGServerEvent.m (mouseOptionsChanged:): change double-click
minimum value to 200 and default to 300.
2019-04-12 15:45:39 +03:00
Sergii Stoian
59b1f51e5f * Source/x11/XGServerEvent.m (processEvent:): do not send event if
disabled menu mouse button was released.
2019-04-11 13:15:09 +03:00
Sergii Stoian
7981c3e41c * Source/x11/XGServerEvent.m (initializeMouse): new method. Calls -mouseOptionsChanged:
and setups observer for defaults changes.
(mouseOptionsChanged:): new method. Read mouse properties from user defaults.
(processEvent:): respect mouse options on ButtonPress and ButtonRelease events.

* Source/x11/XGServer.m (dealloc): remove notification observer.
2019-04-11 01:50:30 +03:00
Sergii Stoian
2f4c96f9d1 hidewindow method was renamed to hideApplication. 2019-04-06 22:32:29 +03:00
Sergii Stoian
b492ac87cd Added support for WindowMaker's WMFHideApplication action. 2019-04-05 14:46:05 +03:00
Sergii Stoian
f9958176db Do not send NSEvent only for single-click on appicon and minindow in WindowMaker environment. 2019-04-04 12:10:47 +03:00
Sergii Stoian
21f38f8060 Send double-click on appicon to the WindowMaker. Old code sent to WM only single-click. 2019-04-04 01:22:25 +03:00
Sergii Stoian
233c129a5c WM_IGNORE_FOCUS_EVENTS atom was added. Use new atom in orderwindow::: code added in last commit. 2019-04-03 19:13:30 +03:00
Sergii Stoian
a6595e320d Map application icon window without focus switch for applications executed with argument -autolaunch YES in WindowMaker environment. 2019-04-02 19:38:44 +03:00
Sergii Stoian
0374820172 Set Utility window type for NSFloatingWindowLevel. 2019-03-26 17:12:55 +02:00
Pavel Shlyak
3b7f8f0e84
Fix memory leaks in convert.c 2018-12-31 23:42:17 +04:00
fredkiefer
7ee9b40793 * Source/x11/XGServerWindow.m (_setupRootWindow): Make sure the
root name variable is null terminated.
2018-07-16 08:39:55 +02:00
fredkiefer
6e797c9e6d * Source/x11/XGServerWindow.m: Check for bytes_after_ret in
PropGetCheckProperty. Attempt to improve the window border detection.
Based on idea by Tom MacSween <Tom.MacSween@crins-sinrc.ca>
2018-06-20 07:49:36 +02:00
fredkiefer
b9e9f461ab Restructure Atom handling to get all atoms at once.
Add new method on XGServer to get the name of the window manager.
2018-05-01 23:08:35 +02:00
fredkiefer
969b77a6c1 * Source/x11/XGServer.m (_initXContext): Call XInitThreads to
enable drawing in secondary threads.
2018-02-09 21:56:01 +01:00
Fred Kiefer
3adb72d6e2 Fix some clang static analyser warnings reported by
Sebastian Reitenbach <sebastia@l00-bugdead-prods.de>.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@40485 72102866-910b-0410-8b05-ffd578937521
2017-04-16 11:57:05 +00:00
Fred Kiefer
9f84d3e7fc * Headers/x11/XGGeneric.h: Remove obsolte atom.
* Source/x11/XGServerWindow.m: Clean up code.
	* Source/x11/XGServerWindow.m (-setwindowlevel::): Try to set
	better level for tool tip windows.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@40295 72102866-910b-0410-8b05-ffd578937521
2017-01-17 22:01:52 +00:00
Fred Kiefer
168e6f1347 * Source/x11/XGServerWindow.m (-_checkStyle:): Ignore invalid
border information.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@40286 72102866-910b-0410-8b05-ffd578937521
2017-01-08 21:01:01 +00:00
Riccardo Mottola
cc7fa76c5e Enable Sync only on explicit presence of sync.h, not just Xext.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@39198 72102866-910b-0410-8b05-ffd578937521
2015-11-24 23:47:25 +00:00
Wolfgang Lux
1e1185abb3 Create an empty app icon window before eventually checking the window
frame offsets when using WindowMaker. This fixes the issue that the
first GNUstep application started under WindowMaker did not get a
proper application menu.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@39171 72102866-910b-0410-8b05-ffd578937521
2015-11-13 15:30:15 +00:00
Fred Kiefer
2478d0b17b Revert part of the repeated key handling as requested by Riccardo.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@39131 72102866-910b-0410-8b05-ffd578937521
2015-11-03 08:42:47 +00:00
Fred Kiefer
3d95b4d8b2 * Source/x11/XGServerEvent.m (-processEvent:): Move repeate key
detection from process_key_event() to here to enable filtering
        out keyUp events as Cocoa does.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@39078 72102866-910b-0410-8b05-ffd578937521
2015-10-16 22:07:24 +00:00
Sebastian Reitenbach
23b53d84c0 * Source/cairo/CairoGState.m
abs -> fabs
        * Source/x11/XGGLContext.m
          format string fix
        * Headers/x11/XGOpenGL.h
          glxminorversion is int, not long int

Looks good, Ivan Vucica



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@38554 72102866-910b-0410-8b05-ffd578937521
2015-05-26 12:00:49 +00:00
Fred Kiefer
042f6f3761 * Source/x11/XGServerEvent.m (-processEvent:): Reenable
Richard's frontend based expose code.
        * Source/x11/XGServerWindow.m (-window::::, -_checkStyle:):
        Don't use CWBackPixel, as the window background may be different.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@38419 72102866-910b-0410-8b05-ffd578937521
2015-03-22 15:15:20 +00:00
Fred Kiefer
59723d8e42 * Headers/x11/XGGeneric.h
* Source/x11/XGServerWindow.m: Correct name for atom
        net_wm_state_modal_atom. Use this atom to try to set the sate
        for dialog windows to modal.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@38417 72102866-910b-0410-8b05-ffd578937521
2015-03-21 18:53:46 +00:00