1038 Commits

Author SHA1 Message Date
Jon Turney
3ac5886879 hw/xwin: Allow DefWindowProc to SetFocus() as needed after WM_ACTIVE
Don't indicate we've processed WM_ACTIVATE, so DefWindowProc can do
not-clearly specified default things with the focus.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/736>
2026-03-16 13:12:29 +01:00
Jon Turney
0decf12c56 hw/xwin: More adjustments to multiwindow mode focus handling
The previous change is not enough, as WM_KILLFOCUS can apparently be
sent to the window losing focus after WM_ACTIVATE has been sent to
the window gaining focus.

Try using WM_SETFOCUS instead, as that has the correct ordering and seems
more logical.

The test "!pWin || !pWin->overrideRedirect" is confusingly written: It's
true if:

(a) pWin is NULL (= X window doesn't exist, shouldn't happen), or
(b) pWin->overrideRedirect is FALSE

i.e. the intended effect is "don't give focus to override redirect windows"

There seem to be some cases where this still isn't quite correct: A
reproduction isn't known, but it seems to be related to minimizing a
maximized Windows window, and having window activation move to a
maximized X window beneath it.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/736>
2026-03-16 13:12:29 +01:00
Jon Turney
0adc6ff90f hw/xwin: Always set the X input focus to none when an X window loses focus
In the multiwindow WM, we need to cancel the X input focus if the
Windows input focus has gone to the desktop, or another application's
window.

We could maybe avoid some unneeded work by not doing this if the
WM_KILLFOCUS wParam is another window owned by us, which is immediately
going to be given the X input focus.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/736>
2026-03-16 13:12:29 +01:00
Jon Turney
3954f766af hw/xwin: Use revert-to-parent X focus mode in multiwindow WM
Use revert-to-parent X focus mode, as recommended in ICCCM 4.1.7

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/736>
2026-03-16 13:12:29 +01:00
Diego Viola
639551d032 treewide: fix typos
Signed-off-by: default avatarDiego Viola <diego.viola@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2138>

---------------------------------------------------------------------------

One of the spelling errors was moved to another file and fixed there

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-03-16 13:11:07 +01:00
stefan11111
e6a0fa4b0c Treewide: Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2134>

----------------------------------------------------------------------------

This commit is the result of `git apply commit.diff --reject`
applied on e8f4522312

67c82078fe does not
apply to Xlibre

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-03-16 13:11:07 +01:00
Enrico Weigelt, metux IT consult
65472d1964 xfree86: move over public SDK headers to include/
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-12 16:21:02 +01:00
Enrico Weigelt, metux IT consult
a67c578486 xwin: replace putenv() by setenv()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-11 19:00:50 +01:00
Enrico Weigelt, metux IT consult
bf107bc06b xwin: drop obsolete HAVE_XWIN_CONFIG_H
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-11 16:34:22 +01:00
Enrico Weigelt, metux IT consult
daefb2a3ad xwin: win.h: document purpose of NONAMELESSUNION
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-11 15:59:42 +01:00
Enrico Weigelt, metux IT consult
0b436c1ef1 xwin: drop DUMMYUNIONNAME*
No need for weird hacks trying create nameless unions (which aren't
even done consequently), just give them trivial names and done.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-11 15:59:42 +01:00
Enrico Weigelt, metux IT consult
95b6716b6c xwin: winprefs: use safer setenv() instead of putenv()
putenv() is deprecated due several drawbacks: the passed buffer becomes
part of the environment (not copied), thus the caller needs to allocate
a permanent buffer first - and has no way to know whether it might
become used later. And it has to fill in the new entry in the correct
form (<name>+"="+<value>)

setenv() instead is damn simple: pass env variable name and value
separately, and no need to care what's going on under the hood.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-11 14:46:50 +01:00
Enrico Weigelt, metux IT consult
3ea028279a xwin: drop useless including of mman.h
We don't use mmap() anyhwere, so no need for that include.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-11 13:03:57 +01:00
Enrico Weigelt, metux IT consult
14f03de002 xwin: move winsock specific errno checks into ossock
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-11 12:02:44 +01:00
Enrico Weigelt, metux IT consult
b7e1858e4f xwin: replace DDXPoint by xPoint
DDXPoint is just an alias to xPoint

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-10 15:59:35 +01:00
Enrico Weigelt, metux IT consult
bfa074f066 xwin: drop dead XWIN_XF86CONFIG code pathes
These never seemed to be actually active, ever. Since nobody ever seemed
to have an actual desire to use an xf86-style config file for Xwin,
let's just drop all that ancient dead code.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-10 13:24:19 +01:00
Enrico Weigelt, metux IT consult
e835d2a000 xwin: glx: fix VLA issue
We don't wanna use VLAs, because they're inherently unsafe.
Since the values[] array can never be bigger than attrs,
just use attr's size here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-10 11:47:39 +01:00
b-aaz
2c9d6b38d1 xwin: ddraw: Moved the include guard to its correct location.
The include guard in this file has been incorrectly moved up breaking
the #include_next behavior on MS Windows builds.
Moved it to its correct location.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-12-21 12:59:03 +01:00
b-aaz
7f7efe8195 Revert 9a82f5c, bring back Cygwin support.
Brought back the code removed in that commit so that we can bring back
Cygwin support.
Small changes are done in the process of resolving conflicts against the
current head.

Some checks have not been reverted, because they were not necessary
anymore.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-12-21 12:59:03 +01:00
Enrico Weigelt, metux IT consult
aefde94a2d meson: drop obsolete vendor information options
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-17 13:52:37 +01:00
Enrico Weigelt, metux IT consult
43c5b45f4a mingw32: fix winsock2.h include
winsock2.h needs to be included before windows.h

> /usr/share/mingw-w64/include/winsock2.h:15:2: error: #warning Please include winsock2.h before windows.h [-Werror=cpp]
>    15 | #warning Please include winsock2.h before windows.h
>       |  ^~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-12 19:41:55 +01:00
Enrico Weigelt, metux IT consult
01768051cf xwin: drop wrapping on ScreenRec->CloseScreen()
Instead of complicated wrapping, just call fbCloseScreen() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-11 20:33:13 +01:00
Enrico Weigelt, metux IT consult
2e631d1454 xwin: fix compiler warning on potential buffer read overflow
> ../hw/xwin/InitOutput.c: In function ‘XwinExtensionInit’:
> ../hw/xwin/InitOutput.c:142:5: warning: ‘LoadExtensionList’ reading 12 bytes from a region of size 0 [-Wstringop-overread]
>   142 |     LoadExtensionList(xwinExtensions, ARRAY_SIZE(xwinExtensions), TRUE);
>       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../hw/xwin/InitOutput.c:142:5: note: referencing argument 1 of type ‘const ExtensionModule[0]’
> In file included from ../include/extnsionst.h:53,
>                  from ../randr/randrstr.h:40,
>                  from ../hw/xwin/win.h:174,
>                  from ../hw/xwin/InitOutput.c:35:
> ../include/extension.h:100:23: note: in a call to function ‘LoadExtensionList’
>   100 | extern _X_EXPORT void LoadExtensionList(const ExtensionModule ext[],
>       |                       ^~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-04 15:10:51 +01:00
Enrico Weigelt, metux IT consult
beb15972d3 xwin: silence warning on missing prototype for OsVendorFatalError()
Just need to include ddx_priv.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-04 14:50:05 +01:00
Enrico Weigelt, metux IT consult
a2304300aa xwin: silence const char* assignment warnings
the target struct type defines char* fields, but we're sure they'll
never be written into, so just add typecast for silencing the warning.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-04 14:27:01 +01:00
Enrico Weigelt, metux IT consult
d877b4830c xwin: drop unused variable
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 11:05:24 +01:00
Enrico Weigelt, metux IT consult
33729b1361 include: windowstr.h: unexport w*() macros
These aren't used by any drivers, so no need to keep them public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:54:42 +01:00
Enrico Weigelt, metux IT consult
9b8d7d1eb9 treewide: don't include <region.h> anymore
Nothing in there that we need, include <regionstr.h> instead.
But keeping the file in place, until all external consumer have
been migrated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:27:27 +01:00
Mike Gelfand
84a2fc014d hw: move include guards up to wrap the whole file
See: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
Signed-off-by: Mike Gelfand <mikedld@mikedld.com>
2025-11-21 15:20:11 +01:00
Enrico Weigelt, metux IT consult
1ae9646936 pseudoramiX: unexport noPseudoramiXExtension
Not used by any driver (not even by xf86 at all), so no need to
keep it exported. Also disposing the now empty nonsdk_extinit.h,
which also isn't used by any drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-19 13:32:31 +01:00
Chase
fcbb2bafce treewide: replace __FUNCTION__ by __func__
prefer C99 standard over non-standard legacy symbols

Signed-off-by: Chase <chinkle3@illinois.edu>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-18 13:29:47 +01:00
Enrico Weigelt, metux IT consult
962580a15a treewide: macros lambda-esque screen iteration
iterating over screen list via lambda-esque macros calls like this

    DIX_FOR_EACH_SCREEN({
        do_something
    });

withing the body, the iterator variables `walkScreenIdx` and `walkScreen`
are defined and can be directly used (read-only). the code inside the body
is running in a separate scope.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-01 11:40:34 +02:00
Enrico Weigelt, metux IT consult
b2a85f070d xwin: dri: inline byte-swapping
No need for having extra functions and redundant code when it can
be done with just few LoC.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 12:34:42 +02:00
Enrico Weigelt, metux IT consult
ca484055c7 dix: unexport screen saver parameters
Not used by any external drivers, so no need to keep them in public
SDK headers. Since they're never used by drivers, it's effectively
not an ABI change, so can safely be done within ABI-25.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 11:01:21 +02:00
Enrico Weigelt, metux IT consult
2112cbb876 xwin: fix missing includes of extinit.h
Don't rely on this file just being included indirectly by somebody else
just by accident.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 13:49:05 +02:00
Enrico Weigelt, metux IT consult
36facd71b5 dix: move request/response related functions to new request_priv.h header
Move functions/macros dealing with request parsing or reply assembly/write
out of the big dix_priv.h into their own headers. This new header will also
get more of those function/macros soon (yet still in the pipeline).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:32:50 +02:00
Enrico Weigelt, metux IT consult
56c4d68140 treewide: drop ScreenInfoPtr parameter from InitOutput()
Nobody's using this pointer anymore, everybody's using the global
screenInfo structure.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 19:49:23 +02:00
Enrico Weigelt, metux IT consult
358f76f2ad treewide: fix misleading firstScreen variable naming to masterScreen
Follow-up on renaming dixGetFirstScreenPtr() to dixGetMasterScreen():
also rename the target variables for correct technical terminology.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 11:44:05 +02:00
Enrico Weigelt, metux IT consult
b0ffa7b286 treewide: rename dixGetFirstScreenPtr() to dixGetMasterScreen() for correct semantics
In Xinerama/Panoramix configuration there's one screen that's having special
meaning - it's used for simulating as the frontend for all client operations:
the clients (should) only talk to that screen, while panoramix subsystem is
proxying those operations to all the other screens (with certain changed
applied, eg. coordinate transformations).

Historically, this screen happens to be the first one in the system (some of
it's proc's are hooked up in order to achieve desired behaviour). That's why it
used to be accessed via screenInfo.screens[0] - that already had been encapsulated
into a tiny helper `dixGetFirstScreen()`.

a) the correct terminus technicus for a situation where one device (or SW entity)
   entirely controlling others is a master-slave-relationship: the controlling
   device/entity is `master`, the controlled ones are `slave` (to that specific
   master).

b) the term "first screen" is inacurate and misleading here: what the caller's are
   actually interest in isn't the first entry in the screen array, but the screen
   that's controlling the others. With upcoming refactoring of the Xinerama/Panoramix
   subsystem, this might well be a different array index than 0.

c) the term `default` also wouldn't match: `default` implies there's a real practical
   choice, and such value applies when no explicit choice has been made. But in this
   case, it practically doesn't make sense (except perhaps for debugging purpose)
   for a client to use any different screen.

Therefore fixing the function name to the correct technical terminology.
(for sake of patch readability, renaming corresponding variables is left to
subsequent patches).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 11:44:05 +02:00
Enrico Weigelt, metux IT consult
850aebf5bc xwin: use screenInfo insead of pointer passed to InitOutput()
We only have one global screenInfo struct ever, and many other parts of the
Xserver can only operate on global screenInfo, so it's time to phase out
this extra pointer. Once the same has done on the other DDXes, it will
be dropped from InitOutput()'s parameter list.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 11:50:02 +02:00
Enrico Weigelt, metux IT consult
6bc438ab5a treewide: use inline helper for accessing first screen
Instead of everybody directly accessing the (internal) screenInfo struct,
let those consumers only interested in first screen use a little helper.

Also caching the value if it's needed several times.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 13:45:05 +02:00
Enrico Weigelt, metux IT consult
48cb1118ee treewide: drop unnecessary pixmap field initialization
The PixmapRec is already calloc()'ed, so no need for additional zero-writes
into individual fields. This also removes some unncessary #ifdefs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-01 13:31:52 +02:00
Enrico Weigelt, metux IT consult
2044c1506a xwin: use X_SEND_REPLY_SIMPLE() for simple replies
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-01 10:53:11 +02:00
Enrico Weigelt, metux IT consult
3e76baff89 xwin: canonical walkScreen variable on screen list iterations
When iterating screen lists, consistently use the same variable name
`walkScreen` for holding current screen pointer everywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-18 10:52:49 +02:00
Enrico Weigelt, metux IT consult
34c3a9c7e2 treewide: fix serverGeneration int type mismatch
The global (exported) serverGeneration field is `unsigned long`, while
many other places copy it and compare it two other integer types, eg.
plain `int` (which is signed). Even if it's unlikely ever reaching such
high number of generations that it will ever make trouble, it's still
a good idea to clean this up and use the same type everywhere.

For clearity, introducing a typedef `x_server_generation_t` which is
used everywhere, instead of raw `unsigned long`.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:52:03 +02:00
Enrico Weigelt, metux IT consult
967ae609b6 dix: drop DDXBEFORERESET symbol
Reduce complexity for things that really don't matter much:

The ddxBeforeReset() function is called when the Xserver going to reset
(new server generation). Right now, the only DDX really needing that is
Xwin, on all the others it's just no-op.

We've got an extra complicated build logic, which ifdef's out this all when
Xwin isn't built at all. The saving is extremely minimal - just skipping
few stub functions, which in most sessions aren't even called.

Therefore, get rid of this extra complexity that isn't giving us any
notable gain.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 11:41:48 +02:00
Enrico Weigelt, metux IT consult
3ac1db8b5e xwin: fix unused variables in winSetShapeMultiWindow()
Fix warnings on unused variables.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 17:05:29 +02:00
Enrico Weigelt, metux IT consult
f1c1293803 xwin: win.h: missing include of dix/dix_priv.h
Needed for dixAddAtom()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-30 20:40:38 +02:00
Enrico Weigelt, metux IT consult
0888156f31 xwin: fix missing prototype of parse_file()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-30 20:40:21 +02:00
Enrico Weigelt, metux IT consult
8454c94773 xwin: use dixAddAtom()
Use the new helper for creating atoms on demand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-23 12:24:27 +02:00