Commit Graph

86 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 7501ca09b9 dix: rename dixLookupClient() to dixLookupResourceOwner()
Choose a bit more precise / descriptive name for that function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:07 +02:00
Enrico Weigelt, metux IT consult a6ec907b22 miext: use calloc() instead of malloc()
Using calloc() instead of malloc() as preventive measure, so there
never can be any hidden bugs or leaks due uninitialized memory.

The extra cost of using this compiler intrinsic should be practically
impossible to measure - in many cases a good compiler can even deduce
if certain areas really don't need to be zero'd (because they're written
to right after allocation) and create more efficient machine code.

The code pathes in question are pretty cold anyways, so it's probably
not worth even thinking about potential extra runtime costs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:49:32 +02:00
Enrico Weigelt, metux IT consult eca6201e98 rootless: use window position notify hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window position notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:44:39 +02:00
Enrico Weigelt, metux IT consult f061315afa rootless: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:44:19 +02:00
Enrico Weigelt, metux IT consult 31548e3705 fb: unexport fbValidateDrawable()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:39:59 +02:00
Aki Sakurai da0de21b72 xquartz: fix compilation
Fixes #1788

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1777>
2025-02-10 19:37:18 +08:00
Enrico Weigelt, metux IT consult 143a6a21e1 miext: rootless: fix unused variables
Compiling w/ -Werror (which our CI does) breaks compile due a buch of
unused variables.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1703>
2025-02-08 15:15:57 +00:00
Enrico Weigelt, metux IT consult 8d07450904 mi: unexport miSendExposures()
Not used by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult a917f6a8a8 drop obsolete HAVE_DIX_CONFIG_H
The symbol controls whether to include dix-config.h, and it's always set,
thus we don't need it (and dozens of ifdef's) anymore.

This commit only removes them from our own source files, where we can
guarantee that dix-config.h is present - leaving the (potentially exported)
headers untouched.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00
Jeremy Huddleston Sequoia 16e7cdba48 rootless: Use screen_x and screen_y instead of pixmap pointer hacks
This updates rootless to treat pixmaps consistently with COMPOSITE,
using the screen_x and screen_y values rather than doing hacky math.

This will allow for proper bounds checking on a given PixmapRec.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 820b1dc461 rootless: Dead code removal (RootlessResizeCopyWindow)
This should no longer be necessary since we only support implementations
that handle preserving the bits across resize.  We can use
RootlessNoCopyWindow instead.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 40c56932a5 rootless: Remove an unnecessary memory copy when handling resize with gravity RL_GRAVITY_NONE (border width changes)
This should no longer be necessary since we only support implementations that handle preserving the bits across resize

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia a06cea245b rootless: Dead code removal (resize_after in StartFrameResize / FinishFrameResize)
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 1b36a10bd4 rootless: Remove the special case for northwest gravity in StartFrameResize
I don't see a reason why we would want to preserve pixels that are going to
not be visible anyways.  The rootless implementation already handles
preserving the relevant bits for us.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 305e627c01 rootless: Use RL_GRAVITY_NORTH_WEST for min/max/zoom resizing
If none of the four corners is fixed, we can use RL_GRAVITY_NORTH_WEST weighting
for the operation to let the implementation presetve the window bits for us.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 65ee3248f5 rootless: Ensure gResizeDeathPix is stored in locally-managed memory rather than re-using the implementation's backing store
The implementation owns the pointer during RootlessStopDrawing and
RootlessStartDrawing and is free to (does) change it.  Rootless
cannot assume ownership of this memory region.  This is possibly
the cause of some hard to diagnose crashes in XQuartz over the
years.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia f71ef2f02f rootless: Remove option to disable ROOTLESS_RESIZE_GRAVITY
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 20f5b270d3 rootless: Fixup some format errors in debug logging
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00: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
Adam Jackson cbd3cfbad3 dix: Restore PaintWindow screen hook
Removes the last cpp conditional on ROOTLESS from dix code.

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08 16:41:28 -04:00
Adam Jackson 6f3332b9f4 dix: unifdef pWin->rootlessUnhittable
No reason to vary the dix ABI over this.

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08 16:41:28 -04:00
Alan Coopersmith 7ac2802874 Convert mi & miext to new *allocarray functions
v2: remove now useless parentheses

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:58:08 -07:00
Peter Hutterer 732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Keith Packard 60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Jeremy Huddleston Sequoia c5f8eb968e rootless: Use miCopyRegion instead of fbCopyRegion
Fixes regression introduced by e657635dbe

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2013-10-06 09:18:15 -07:00
Keith Packard 9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Cyril Brulebois 99275ad2fa Remove superfluous if(p!=NULL) checks around free(p); p=NULL;
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@
-  if (E != NULL) {
-   free(E);
(
-   E = NULL;
|
-   E = 0;
)
-  }
+ free(E);
+ E = NULL;

Signed-off-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 08:22:59 +10:00
Jamey Sharp 58d1ec0fe8 rootless: ROOTLESS_GLOBAL_COORDS is always set, so unifdef it.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Jeremy Huddleston <jeremyhu@apple.com>
Cc: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-09-13 15:58:08 -07:00
Jamey Sharp 35ce892a70 rootless: ROOTLESS_TRACK_DAMAGE is never set, so unifdef it.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Jeremy Huddleston <jeremyhu@apple.com>
Cc: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-09-13 15:58:08 -07:00
Jeremy Huddleston 4fc4cab98d XQuartz: Make application switching work better for the no-spaces case
We still have the issue with not raising the frontmost window for the case
when spaces is enabled, and the AppleSpacesSwitchOnActivate preference is
disabled.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-08-12 20:26:36 -10:00
Jan Hauffa 95756f410c rootless: Adjust the frame size of the native root window in RootlessResizeWindow
If the native root window isn't resized as well, we will likely crash the
next time we draw to the root.  On OS X, this can be seen by:

1) Put the display preferences in the menu bar and set X11's preferences so you
   can access the menu bar in fullscreen mode
2) Set the resolution of your screen lower than normal.
3) Start X11 in fullscreen mode.  The root window will cover the screen as
   expected.
4) Use the menu bar to increase the resolution of the display.  The root
   window will now cover the old area and not the full screen, but
   'xwininfo -root' will report the full width.
5) Run 'xsetroot -solid red', and we have the crash you mention above.

Leaving/entering fullscreen after #4 will fix the problem.  This is because the
WINREC is erased when we leave fullscreen mode and it is recreated upon
re-entry:

RootlessUpdateRooted(FALSE)
    RootlessDisableRoot(screenInfo.screens[0])
        RootlessDestroyFrame (pRoot, winRec);
RootlessUpdateRooted(TRUE)
    RootlessEnableRoot(screenInfo.screens[0])
        RootlessEnsureFrame(screenInfo.screens[0]->pRoot)
            creates a new WINREC...

Signed-off-by: Jan Hauffa <hauffa@in.tum.de>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Acked-By: Jon TURNEY <jon.turney@dronecode.org.uk>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-07-19 19:11:26 -07:00
Jamey Sharp a0fe6987b5 Clean up after removal of screen parameters from region macros.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-06-05 22:07:21 -07:00
Keith Packard 2dc138922b Rename region macros to eliminate screen argument
This is a combination of a huge mechanical patch and a few small
fixups required to finish the job. They were reviewed separately, but
because the server does not build without both pieces, I've merged
them together at this time.

The mechanical changes were performed by running the included
'fix-region' script over the whole tree:

$ git ls-files | grep -v '^fix-' | xargs ./fix-region

And then, the white space errors in the resulting patch were fixed
using the provided fix-patch-whitespace script.

$ sh ./fix-patch-whitespace

Thanks to Jamey Sharp for the mighty fine sed-generating sed script.

The hand-done changes involve removing functions from dix/region.c
that duplicate inline functions in include/regionstr.h, along with
their declarations in regionstr.h, mi.h and mispans.h.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-05 18:59:00 -07:00
Jeremy Huddleston 1768e51976 rootless: Fix SetShape regression
This fixes a regression in miext/rootless from 643cb6e87c

Found-by: tinderbox
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Pierre-Loup A. Griffais <pgriffais@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-05 17:13:34 -07:00
Jamey Sharp a83cff9f4d Move each screen's x/y origin into ScreenRec.
Many references to the dixScreenOrigins array already had the
corresponding screen pointer handy, which meant they usually looked like
"dixScreenOrigins[pScreen->myNum]". Adding a field to ScreenRec instead
of keeping this information in a parallel array simplifies those
expressions, and eliminates a MAXSCREENS-sized array.

Since dix declared the dixScreenOrigins array, I figure allocating a
screen private for these values is overkill.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
2010-06-03 14:03:23 -07:00
Jamey Sharp e7fae9ecc4 Move each screen's root-window pointer into ScreenRec.
Many references to the WindowTable array already had the corresponding
screen pointer handy, which meant they usually looked like
"WindowTable[pScreen->myNum]". Adding a field to ScreenRec instead of
keeping this information in a parallel array simplifies those
expressions, and eliminates a MAXSCREENS-sized array.

Since dix uses this data, a screen private entry isn't appropriate.

xf86-video-dummy currently uses WindowTable, so it needs to be updated
to reflect this change.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
2010-06-03 14:03:23 -07:00
Mikhail Gusarov 3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Jeremy Huddleston 4d3789c9b3 rootless: Remove an unneeded comment
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-05-02 15:27:29 -07:00
Rami Ylimaki 5b9a52be7e os: Prevent core dump from being truncated.
The problem fixed by this patch can be reproduced on Linux with the
following steps.
- Access NULL pointer intentionally in ProcessOtherEvent on key press.
- Instead of saving core dump to a file, write it into a pipe.
  echo "|/usr/sbin/my-core-dumper" > /proc/sys/kernel/core_pattern
- Dump the core by pressing a key.

While the core is being dumped into the pipe, the smart schedule timer
will cause a pending SIGALRM. Linux kernel stops writing data to the
pipe when there are pending signals. This causes the core dump to be
truncated. On my system I'm expecting a 6 MB dump but the size will be
60 kB instead. The problem is solved if we block the SIGALRM caused by
expired smart schedule timer.

I haven't been able to reproduce this problem in the following cases.
- Save core dump to a file instead of a pipe.
- kill -SEGV `pidof Xorg`
- Press a key to dump core while gdb is attached to Xorg.
- Give option -dumbSched to Xorg.

Also note that the fix works only when NoTrapSignals has the default
value FALSE. The problem can still be reproduced if error signals
aren't trapped. In addition to pending SIGALRM, there is a similar
problem with pending SIGIO from the keyboard driver during core dump.

Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-02-17 23:20:52 -08:00
Jeremy Huddleston 5b91dfac6f Rootless: Abstract some of the Xplugin specific stuff which has crept into rootlessWindow.c
The rootless extension now directly calls some Xplugin functions, and relies
on types defined in Xplugin.h, which isn't very abstracted :-)

This patch is a start at abstracting some of the Xplugin specific stuff which
has crept into rootlessWindow.c.  This has been done in a pretty mindless fashion,
without much thought as to if the additions to the generic rootless interface are
the correct ones

There is some confusion as to if RootlesscolormapCallback() returns a Bool or
xp_error_enum value (not so abstact), but I have no way of checking, of finding
out if Xplugin actually checks the result :-)

Based on patches from Colin Harrison, Jon Turney and Yaakov Selkowitz

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-10-13 13:59:57 -07:00
Jeremy Huddleston b3415187e9 Rootless: Correct border rendering on parent-relative windows
Resurected code from the punted RootlessPaintBackground/Border and added it conditionally to miPaintWindow
(cherry picked from commit cf2e3312cff3f341e9edba8c321a4ca7ffd8748e)
2009-09-27 23:31:50 -07:00
Jeremy Huddleston fc24a97a8d Rootless: Use serverClient instead of NullClient
This seems to stop the crash when moving windows.
(cherry picked from commit fcd857c8e295ac7a2b0e58d49dc71251ed9d1266)
2009-06-06 22:23:56 -07:00
Jeremy Huddleston dfb0d7aefb XQuartz: Update window levels when changing rootless state
(cherry picked from commit 1359ded5bfc14a80fb998b01a54ecacb96c4ff88)
2009-04-10 00:47:40 -07:00
Jeremy Huddleston 15146b8637 XQuartz: Properly set the window level for the root window
(cherry picked from commit bdf9286d1cbfeaaf8eaf03d28091e91ee587ee25)
2009-04-10 00:47:16 -07:00
Jeremy Huddleston 83edcc08de XQuartz: Get rid of white rectangle bug
(cherry picked from commit 3269959033ed0c675a3a906666454df34086896a)
2008-12-21 21:34:38 -08:00
Jeremy Huddleston 20239a4dee Rootless: LP64 related casting fixes from Bob Murphy
(cherry picked from commit 40441c4e31167932721a79d7ca572caaa1d36e72)
2008-10-31 19:03:32 -07:00
Jeremy Huddleston 4e762b8aa3 Rootless: Force initialization of static variable before use.
(cherry picked from commit cece29317269385aa7a0d3047e6f90e6a17d01eb)
2008-10-31 15:49:59 -07:00
George Peter Staplin b397cc7277 miext/rootless: Fix the usage of DeleteProperty so that this builds again.
(cherry picked from commit 3de250e28a9a86bcae4464a15c2025805877ce1e)
2008-10-23 16:31:44 -07:00
Jeremy Huddleston d13c3cbd43 XQuartz: Some motion made towards supporting fullscreen.
(cherry picked from commit 99be3d68b64059caada739a373e5e01844c776e0)
2008-10-08 18:45:17 -07:00
Jeremy Huddleston 6548a55ebd XQuartz: 256 color support
(cherry picked from commit 8dd6d5c825d457f26b41b79d02d57ed4a5ecf1f5)
2008-09-12 15:26:13 -07:00