Commit Graph

894 Commits

Author SHA1 Message Date
Olivier Fourdan 3cdac5ba07 mi: List extensions in usage message
Not all extensions can be enabled or disabled at runtime, list the
extensions which can from the help message rather than on error only.

v2:
 * Print the header message in the ListStaticExtensions() (Peter
   Hutterer)
 * Do not export ListStaticExtensions() as Xserver API

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2021-01-29 12:52:09 +00:00
Jon Turney bb7aab6afe hw/xwin: Fix building with -fno-common
Provide an actual definition of noDriExtension where used, rather than a
tentative definition in a header, to fix compilation with -fno-common
(the default with gcc 10).
2020-11-24 14:55:28 +00:00
Jon Turney 4c2d1fe045 hw/xwin: Update for renames in xserver/output API
Update commit ea47af87 renaming master_pixmap to primary_pixmap in
struct PixmapRec.
2020-07-29 20:36:35 +01:00
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Jon Turney 2fe13a1f44 hw/xwin: Drop call to setlocale()
Since we now only work with UTF-8 (or ISO8859-1) text in the clipboard,
we don't need to setlocale().
2020-04-15 14:13:58 +00:00
Jon Turney f269e01e1a hw/xwin: Consistently use BOOL type from Xmd.h
This avoids including Xdefs.h, which means we avoid all the issues with
_XSERVER64 effecting how types are defined by that.
2020-04-15 14:13:58 +00:00
Jon Turney 4055fed1e7 hw/xwin: Remove XSetAuthorization() for helper clients
All helper client code now uses xcb, so calling XSetAuthorization() is
no longer needed.

This is the last reference to libX11 from helper clients, so linking
with x11-xcb and libX11 is no longer required.

Also drop (unneeded?) linking with libXau.

Also drop installing these prerequistes on AppvVeyor.

Also move prototypes for functions in winauth.c from win.h into a new
header, winauth.h, and include that where needed.
2020-04-15 14:13:58 +00:00
Jon Turney 9e02e023b0 hw/xwin: xcbify clipboard integration
Convert clipboard integration code from libX11 to xcb

This drops support for COMPOUND_TEXT.  Presumably some ancient
(pre-2000) clients exist which support that, but not UTF8_STRING, but we
don't have an example to test with. (Given the nature of the thing, the
users of those clients probably work in CJK languages)

Supporting COMPOUND_TEXT would also involve writing (or extracting from
Xlib) support for the ISO 2022 encoding.

v2:
Fix the length of text property set by a SelectionRequest

The length of the text property is not neccessarily the same as the
length of the clipboard text before it is d2u converted (specifically,
if that contains any '\r\n' sequences, it will be shorter as they are
now just '\n')
2020-04-15 14:13:58 +00:00
Jon Turney f4936de73c hw/xwin: Remove nounicodeclipboard option
Always use CF_UNICODETEXT clipboard format.  Windows will automatically
down-convert to CF_TEXT for clients which request that.

This is subtly different in one way: if CF_TEXT is requested, we now
post CF_UNICODETEXT and it is converted to CF_TEXT *in the locale of the
requesting process*.  Previously, we would convert to CF_TEXT *in our
locale* and post that.

It looks like the code in the !X_HAVE_UTF8_STRING case didn't actually
work correctly, but fortunately that has never been true...
2020-04-15 14:13:58 +00:00
Jon Turney 9f51dfdec3 hw/xwin: Remove support for pre-Vista Win32 clipboard API
The original Win32 clipboard API is widely regarded as terrible, since
it relies on clients co-operatively managing the clipboard viewer chain,
and a single buggy client can break it for all other clients.

The last Windows version only supporting that API was Windows XP (5.1),
EOLed in 2014.

(This requires MinGW-w64 w32api 6.0.0 or later for
Add/RemoveClipboardListener correctly exported by the x86_64 user32
implib)
2020-04-15 14:13:58 +00:00
Jon Turney 9a4b62798b hw/xwin: Fix lingering uses of libX11 types and values 2020-04-15 14:13:58 +00:00
Jon Turney d7010cd93a hw/xwin: Warn about too large Windows -> X clipboard pastes
XChangeProperty() requests larger than the ~16MB permitted even with
BigReq will fail BadLength
2020-04-15 14:13:58 +00:00
Jon Turney 56a91f2067 hw/xwin: Implement INCR protocol for X clipboard -> Windows clipboard
Also, relax the timeout mechanism so it allows 1 second between events,
rather than 1 second for the entire transfer, as transfers of large
pastes can take more than 1 second.

Also, prefer UTF8_STRING encoding to COMPOUND_TEXT encoding
2020-04-15 14:13:58 +00:00
dslater38 71c3a97142 XWin: Fix infinite loop in GetShift()
GetShift(int mask) can be called with mask==0, causing
it to go into an infinite loop.

Note: GetShift(mask) will return 0 for a mask of
both 0 and -1. The assumption is that if mask == 0,
then the corresponding bits for which we're calculating
the shift, are also 0.
2019-12-12 04:54:46 +00:00
Jon Turney bcf2dd0cd2 hw/xwin: Add -icon option to set the screen window icon in windowed mode
Add an -icon option to set the screen window icon in windowed mode

Allow cygwin paths in an icon-specification

Update man pages and system.XWinrc appropriately

Also, log an error if the icon specified for TRAYICON cannot be loaded

Also, fix a bug in appending a '\' to IconDirectory only if it doesn't
already end with one, which was fortunately benign.

Note: LoadImageComma would be simpler if we just stated that XWinrc
paths are Cygwin paths on Cygwin, Windows paths on MinGW, but that could
break existing .XWinrc files

Note: Given that we can specify paths in an icon-specifier, I'm not sure
what IconDirectory wins us.

v2:
Fix formatting problems in man page additions

v3:
Fix some more s/_/@/g in man pages
2019-09-18 19:11:45 +00:00
Adam Jackson 454b3a826e hw: Rename boolean config value field from bool to boolean
"bool" conflicts with C++ (meh) and stdbool.h (ngh alright fine). This
is a driver-visible change and will likely break the build for mach64,
but it can be fixed by simply using xf86ReturnOptValBool like every
other driver.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2019-07-22 20:28:27 -04:00
Yaakov Selkowitz 011b87a8c6 hw/xwin: Add EWMH properties for describing multiple desktops to the root window
mate-terminal apparently requires these to be present to work

We just set them to describe one desktop, for the moment.

It seems we can safely ignore the _NET_WM_DESKTOP property on child
windows, and any _NET_WM_DESKTOP messages, as we only support one
desktop for windows to be on.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2019-07-21 14:44:26 +01:00
Colin Harrison 3d493e91ab hw/xwin: Respect -notrayicon option on taskbar restart 2019-07-21 14:44:24 +01:00
Jon Turney a588e6f81b hw/xwin: Rename WM_WM_MAP{2,3} to WM_WM_MAP_{UN,}MANAGED
WM_WM_MAP was removed in 52e05b92

Rename WM_WM_MAP2 as WM_WM_MAP_UNMANAGED (meaning an override-redirect
window, which manages it's own activation)

Rename WM_WM_MAP3 as WM_WM_MAP_MANAGED (meaning a normal window, which
is activated when clicked)
2019-07-21 14:44:23 +01:00
Jon Turney a47e7eb247 hw/xwin: Log counts of pixel formats which couldn't be used
Log a count of pixel formats which couldn't be used for various reasons
2019-07-21 14:44:21 +01:00
Jon Turney ff6b771eee hw/xwin: Improve data returned for RANDR queries
Set a linear gamma ramp.  This avoids the xrandr command always warning
'Failed to get size of gamma for output default'
(perhaps we should be using GDI GetDeviceGammaRamp(), if possible?)

Make CRTC report non-zero physical dimensions initially
2019-06-28 17:44:58 +00:00
Jon Turney 2549ab2065 hw/xwin: Always keep RANDR fake mode information up to date
The rrGetInfo hook is not called for all RANDR requests (e.g.
RRGetOutputInfo), so we must always keep the fake mode information up to
date, rather than doing it lazily in the rrGetInfo hook)

Because we are so bad, most GTK+3 versions treat the output name 'default'
specially, and don't try to use RANDR with it.  But versions 3.21.6 to
3.22.24, don't do this, and get badly confused by a CRTC with size 0x0.

See:
https://bugzilla.gnome.org/show_bug.cgi?id=771033
https://bugzilla.gnome.org/show_bug.cgi?id=780101

Future work: Rather than reporting a single fake CRTC with a mode matching
the entire virtual display, the fake CRTCs we report should match our
'pseudo-xinerama' monitors
2019-06-28 17:44:58 +00:00
Jon Turney b078e03410 hw/xwin: Make QueryMonitor() slightly less insane
Make QueryMonitor() slightly less insane, making it return TRUE if the
specified monitor exists, rather than always returning TRUE (which we
are uselessly checking, and then also checking if the specified monitor
exists)

(Note that EnumDisplayMonitors() doesn't seem to have meaningful way to
return errors, see 5940580f)

Also: Spamming the long UseMsg() after "Invalid monitor number" isn't very
helpful.

Also: If we are exiting in ddxProcessArgument() due to an error in
options, use a non-zero exit status.
2019-06-28 17:44:58 +00:00
Jon Turney 8f7e4b56d2 hw/xwin: Fix transposed RaiseVolume and LowerVolume scan codes 2019-06-28 17:38:36 +00:00
Colin Harrison bfcaaecc55 hw/xwin: Add the Belgian (Comma) keyboard layout 2019-06-28 17:38:36 +00:00
Colin Harrison 188f461463 hw/xwin: Add Russian keyboard layout 2019-06-28 17:38:36 +00:00
Jon Turney 2afee831a4 hw/xwin: Add an option to use alpha channel in multiwindow mode
Add an option to turn on the use of the X window's alpha channel in
multiwindow mode, i.e. this uses the X window's alpha channel for
compositing into the native desktop.

This works on W7/Vista (using DwmEnableBlurBehindWindow()), and Windows
10 (using the undocumented SetWindowCompositionAttribute()), but not on
Windows 8/8.1

-compositewm must be enabled for this to be useful, as we only have a
pixmap with an alpha channel for the X window in that case.  The
framebuffer/root window doesn't have one (unless perhaps you are using
the rootless extension, maybe...).

v2:
Update meson.build

Future work:

A window property to control use of alpha?
Option to turn off blur on W7/Vista
Implement _NET_WM_WINDOW_OPACITY
2019-06-17 21:56:35 +00:00
Jon Turney 2e1bc74373 hw/xwin: Set convenience variables for WM_CREATE as well
Set convenience variables in winTopLevelWindowProc() for WM_CREATE as
well.
2019-06-17 21:56:35 +00:00
Jon Turney f67918353a hw/xwin: Improve performance of -compositewm
I think that a major cost in the current implementation is doing a
CreateDIBSection()/DestroyObject() on every refresh.  So provide our own
CreatePixmap() instead, which does the CreateDIBSection(), once.

Testcase: glxgears or foobillard with direct swrast
Testcase: scrolling in a full-screen xterm

v2:
Fix handling of RENDER Scratch Pixmaps
(A problem easily shown with gitk or emacs)

v3:
Note that we don't own screen pixmap to release in DestroyPixmap
Log if unimplemented slow-path ever gets hit
2019-06-17 21:56:35 +00:00
Jon Turney 6865fe7147 hw/xwin: Avoid artefacts when resizing a window
Fill the area outside the current window size with black, rather than
leaking framebuffer contents or leaving it undrawn.
2019-06-17 21:56:35 +00:00
Jon Turney ebcea16e71 hw/xwin: A simpleminded attempt at composition
Rather than drawing the window contents from the shadow framebuffer, use
Composite extension redirection to cause the server to maintain a bitmap
image of each top-level X window, and draw the window contents from
that, so that window contents which are occluded in the framebuffer show
correctly in the task bar and task switcher previews.

v2:
Fix incorrect use of memset() found by gcc5

hw/xwin/winshadgdi.c: In function ‘winBltExposedWindowRegionShadowGDI’:
hw/xwin/winshadgdi.c:861:9: warning: ‘memset’ used with constant zero length parameter; this could be due to transposed parameters [-Wmemset-transposed-args]

v3:
Turn on -compositewm by default

v4:
Ignore -swcursor if -compositewm

-swcursor is not compatible with -compositewm (because the window
contents are drawn from an off-screen pixmap, not from the screen
pixmap, where the software cursor will be drawn).

v5:
Update meson.build also
Add -compositewm option to help output
Update CI to install prerequisites
2019-06-17 21:56:35 +00:00
Jon Turney adebc376b9 hw/xwin: Push multiwindow wndproc WM_PAINT down into drawing engine
Push the multiwindow wndproc WM_PAINT handling down into the drawing
engine.  Only the GDI engine is supported in multiwindow mode currently,
so we only need to do this in the GDI engine.
2019-06-17 21:56:35 +00:00
Jon Turney 065f73353b hw/xwin: Align winBltExposedRegionsShadowGDI with winTopLevelWindowProc's WM_PAINT
Make winBltExposedRegionsShadowGDI() do the same stuff that
winTopLevelWindowProc()'s WM_PAINT handler does.

Note that winBltExposedRegionsShadowGDI() is currently used 1) in
windowed mode when the GDI engine is selected, and 2) in multiwindow
mode when "Hide Root Window" is off.
2019-06-17 21:56:35 +00:00
Jon Turney b4ed20c4f1 Promote file containing date & time build was configured to top-level
Promote the generated file containing the date & time build was
configured to top-level.

Rename it from xf86Build.h to buildDateTIme.h.

Use it as well in XQuartz, stringize BUILD_DATE when needed.
2019-05-02 15:42:58 +00:00
Adam Richter 99904a3a7b hw/xwin/glx/indirect.c glxWinScreenProbe(): Add free(screen) that was missing from an error path. Caught by cppcheck. 2019-05-01 15:21:48 -07:00
Jon Turney a2302de6fe hw/xwin: Remove mwextwm mode
This has always been described as 'experimental'

We don't think this has any users: This mode has been disabled in Cygwin
packages since March 2016. We've never provided the xwinwm WM for x86_64
Cygwin. No one has even asked where the option has gone.

This leaves XQuartz as the only user of the rootless extension.

Remove --enable-windowswm configure option
Remove multiwindowextwm stuff from Makefiles
Remove -mwextwm option
Remove -mwextwm from man-page and help
Un-ifdef XWIN_MULTIWINDOWEXTWM

v2:
Remove rootless include paths
Remove windowswmproto from meson.build
2019-05-01 14:06:15 +00:00
Jon Turney 92a52611f6 meson: Link with ws2_32 for socket functions on Windows 2019-04-30 20:07:51 +00:00
Jon Turney 93a1cdcc78 meson: Fix hw/xwin for -Dglx=false
hw/xwin/meson.build:140:0: ERROR:  Unknown variable "xwin_windowsdri".
hw/xwin/meson.build:141:0: ERROR:  Unknown variable "xwin_glx".
2019-04-30 20:07:51 +00:00
Alan Coopersmith 4ad21c3247 Add ddxInputThread call from os layer into ddx layer
Allows ddx's to run additional code as necessary to set up the
input thread.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-02-25 15:48:03 +00:00
Michel Dänzer f9bbc9d5ea glx,xquartz: Fix make distcheck
Guard BUILT_SOURCES and CLEANFILES by XWIN_GLX_WINDOWS/XQUARTZ.
2019-02-22 10:21:27 +01:00
Adam Jackson 03b2125005 dix: Remove LegalModifier()
This hasn't done anything besides return TRUE in a long long time.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-28 16:25:17 -04:00
Adam Jackson a23eba2a91 dix: Merge AbortDDX into ddxGiveUp
These are so close to identical that most DDXes implement one in terms
of the other. All the relevant cases can be distinguished by the error
code, so merge the functions together to make things simpler.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-28 16:25:12 -04:00
Adam Jackson d78ac2f159 mi: Factor out miSaveScreen
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-28 16:25:01 -04:00
Jon Turney 2f424df0ca hw/xwin/glx: Fix logging about WGL pxfs with overlays
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2018-09-25 16:02:09 +01:00
Jon Turney d63f9dddeb hw/xwin/glx: Use multisample attributes with wglChoosePixelFormatARB()
Seems like this was omitted in error

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2018-09-25 16:02:09 +01:00
Jon Turney e3398d921b hw/xwin/glx: Add GLX_ARB_framebuffer_sRGB extension
v2:
Fix a bogus warning about a missing pixelformat attribute issued for every
pixelformat when WGL_ARB_framebuffer_sRGB isn't available

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2018-09-25 16:02:09 +01:00
Jon Turney 1fc240c687 hw/xwin/glx: publish GLX create_context extensions
Future work: To properly support GLX_ARB_create_context in indirect mode, we
need to use wglCreateContextAttribsARB() rather than wglCreateContext(),
when attribs are provided, rather than just dropping attribs on the floor,
as we currently do.

That probably entails removing the deferred context creation and instead
using a temporary window, as direct WGL does.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2018-09-25 16:02:09 +01:00
Jon Turney 67b47d50df hw/xwin/glx: Add support for float format fbconfig GLX extensions
v2:
Set renderType more correctly

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2018-09-25 16:02:09 +01:00
Jon Turney 6be9681eb9 hw/xwin/glx: Make WGL -> GLX extension mapping table-driven
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2018-09-25 16:02:09 +01:00
Jon Turney ad6b4113cd hw/xwin/glx: Fallback to ChoosePixelFormat() if wglChoosePixelFormatARB() fails
In glxWinSetPixelFormat() handle the case where wglChoosePixelFormatARB()
fails and fallback to ChoosePixelFormat()

It seems for some drivers, wglChoosePixelFormatARB() can fail when the
provided DC doesn't belong to the driver (e.g. it's a compatible DC for a
bitmap, so allow a fallback to ChoosePixelFormat() if it fails.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2018-09-25 16:02:09 +01:00