Commit Graph

1451 Commits

Author SHA1 Message Date
Adam Jackson
cb61cf5c99 resource: Remove expectID hack
This is clearly meant to short-circuit the (modestly) expensive resource
lookup in LegalNewID.  The problem is that long-lived clients will
eventually run completely through their XID space and start asking
XC-MISC for IDs to reuse.  Once that happens, the comparison against
expectID will always be true, and we'll no longer catch XID collisions
at all.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-01-20 21:08:17 -05:00
Adam Jackson
3282e3c627 resource: s/NullResource/NULL/g
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-01-20 21:08:17 -05:00
Ville Syrjälä
f3480286ae composite: Support updating an arbitrary subtree
Rename compUpdateWindow to compPaintWindowToParent and split the child
walk to compPaintChildrenToWindow. Calling compPaintChildrenToWindow
allows an arbitrary subtree to be updated, instead of having to update
all the windows. This will be used to make sure all the descendants are
copied to the parent when the parent window contents need to be accessed
in IncludeInferios sub-window mode.

WindowRec has a new member 'damagedDescendants' that is used to keep
track of which subtrees need updating. When a window is damaged,
'damagedDescendants' will be set for all the ancestors, and when a
subtree is updated, the tree walk can be stopped early if no damaged
descendants are present.

CompScreenRec no longer needs the 'damaged' member since the root
window's 'damagedDescendants' provides the same information.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-01-05 11:57:31 -08:00
Daniel Stone
91beeee05f DIX: Reset window properties when freeing them
This enables us to reliably inspect properties when destroying windows.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Fernando Carrijo <fcarrijo@freedesktop.org>
2010-12-31 12:52:50 +00:00
Chase Douglas
4781828798 Make EventIsDeliverable non-static
Will be used outside dix/events.c in proceeding XI 2.1 MT changes.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-12-31 12:36:44 +00:00
Daniel Stone
f7d8ade3c5 Resources: Move rClient to resource.h
The definition of rClient was duplicated across three source files, so
move it to resource.h.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-12-31 12:36:44 +00:00
Adam Jackson
7a9062f2f0 fonts: Fix typo in async ListFonts logic
This was introduced in 3ab6cd31cb.  Mea
culpa.  This logic is still incorrect [1], but at least it's less
incorrect.

[1] - https://bugzilla.redhat.com/658587

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2010-12-20 12:12:09 -05:00
Peter Hutterer
0d440a1c6e dix: allow for button-only input devices (#21457)
Add a few checks for the existence of a valuator class on the device to
avoid null-pointer dereferences for button events from devices without a
valuator class.

X.Org Bug 21457 <http://bugs.freedesktop.org/show_bug.cgi?id=21457>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-12-10 10:57:55 +10:00
Peter Hutterer
aba8133c9c dix: clear up an overly convoluted if statement.
No functional changes, just improves readability. This statement had things
added to/removed from it for a few server releases while the input event
queue was revamped. What made sense once is now mainly confusing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-12-09 10:03:26 +10:00
Keith Packard
519d243f0c Merge remote branch 'alanc/master' 2010-12-07 13:39:58 -08:00
Alan Coopersmith
d2c42b1027 Replace alloc+strcpy+strcat with asprintf() & XNFasprintf() calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-12-07 11:10:35 -08:00
Alan Coopersmith
03e8bfa1d1 Convert existing Xprintf style calls to asprintf style
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-12-07 11:10:35 -08:00
Alan Coopersmith
2db6951763 Sun's copyrights now belong to Oracle
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-12-07 11:10:35 -08:00
Cyril Brulebois
9f9c732311 dix: Fix logic for displaying deprecation warning only once.
As pointed out by Jamey Sharp (again), the logic is faulty: --warn is
always going to be false. Replace it with warn-- accordingly, so that
there's (at least, but also only) one warning showing up.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2010-12-07 18:42:45 +01:00
Cyril Brulebois
a937803c1f dix: Simplify deprecated *Lookup* wrappers around dixLookup*.
As pointed out by Jamey Sharp: “the result pointer is already guaranteed
to be NULL if the return value is not Success”, so get rid of the
variable used to catch the return value, and used in a ternary operation
to decide whether to return the pointer or NULL. Always return the
result pointer instead.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2010-12-07 18:42:45 +01:00
Keith Packard
f5b8bd620f Merge remote branch 'jajones/for-keith' 2010-12-06 19:51:06 -08:00
James Jones
1c4a0db2c6 Add fence sync driver interface
-Add fence sync objects

-Add fence sync devPrivates

-Add a X sync module screen private

-Add wrappable functions to create and destroy
 fence sync objects

-Give fence sync objects wrappable functions to
 trigger, test, and reset their 'triggered' value.

-Give fence sync objects wrappable functions to
 notify driver when adding/removing triggers to/
 from the sync object.

Signed-off-by: James Jones <jajones@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-12-06 19:15:26 -08:00
Peter Hutterer
5d31c3e705 dix: don't stop processing valuators when the mode changes.
XI 1.x events still contain absolute coordinates anyway. By the time we get
to the InternalEvent to XI event conversion, the valuators are already
absolute.

Stopping because of a different mode on a valuator is not necessary.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-12-07 08:07:53 +10:00
Ferry Huberts
b16964910d dix: do not use bit-wise operators on the boolean result of BitIsOn
Performing bit-wise operations on a boolean amounts to mixing types,
is confusing and basically incorrect; one should only perform
logical operations on booleans.

Performing such operations relies on the implementation detail
that a boolean is in fact an integer and that its value FALSE
is implemented as zero.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-11-30 13:25:47 -08:00
Peter Hutterer
23e3d1f233 dix: remove now unnecessary !! before BitIsOn()
The macro has been changed to do this already, no need for double
not-not-ing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-11-26 11:05:50 +10:00
Peter Hutterer
639600fa7e dix: add a fixme about a corner-case that should probably be fixed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Peter Hutterer
0aca9e8424 dix: fix typo, set the second valuator with the y-axis data.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Peter Hutterer
45131bb67f dix: GetProximityEvents needs to check up to the last valuator
valuator_mask_size() returns the highest valuator set as opposed to the
number of set bits (which obviously changes as we unset valuators).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Peter Hutterer
048e93593e dix: when converting to XI 1.x events, use the first_valuator's device mode
Don't stop processing events when a valuator's mode doesn't match the 0th
valuator's mode. Instead, start with the first_valuator in the event and
keep stacking them on until the first valuator with a different mode is hit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Peter Hutterer
4f3e670fd2 dix: when comparing axis modes, compare the bits, not the bytes.
The DeviceEvent's mode field is a set of bits for each valuator, not bytes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Peter Hutterer
6f12934d4e dix: replace a manual valuator check with valuator_get_mode().
This check was missing the OutOfProximity mask and resulted in the wrong
bits being set in InternalEvents.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-11-24 08:47:00 +10:00
Simon Thum
ebe3ddaf28 dix: fix up valuators passed to acceleration code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-11-24 08:47:00 +10:00
Chase Douglas
31737fff08 Fix transformAbsolute
transformAbsolute must use old values if valuator mask doesn't have new
ones, and it must only set new values if there was a change.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-19 11:11:04 +10:00
Chase Douglas
463841f45a Fix GPE Y axis scaling
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-19 11:11:04 +10:00
Jeremy Huddleston
7b33ef7473 dix: Fix make distcheck
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-11-14 10:25:54 -08:00
Peter Hutterer
b8114f25b2 dix: fix typo in setting valuator modes (#21548)
X.Org Bug 31548 <http://bugs.freedesktop.org/show_bug.cgi?id=31548>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Cyril Brulebois <kibi@debian.org>
2010-11-12 11:49:10 +10:00
Tiago Vignatti
da66119593 dix: fix root window background behaviour for protocol calls
Instead always paint root tiled (-retro like), protocol calls
(XSetWindowBackgroundPixmap and related) should behave accordingly when None
and ParentRelative is set as background pixmap.

It follow what the protocol states: "changing the background of a root window
to None or ParentRelative restores the default background pixmap".

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
2010-11-11 23:25:06 +02:00
Tiago Vignatti
8976e9766e dix: adds support for none root window background
It lets the driver notify the server whether it can draw a background when
'-background none' option is used by the system platform. Use cases for that
could be video drivers performing mode-setting in kernel time, before X is up,
so a seamless transition would happen until X clients start to show up.

If the driver can copy the framebuffer cleanly then it can set the flag
(canDoBGNoneRoot), otherwise the server will fallback to the normal behaviour.
The system must explicit indicates willingness of doing so through
'-background none'. We could do this option as default; in such case,
malicious users would be able to steal the framebuffer with a bit of tricks.

For instance, I can see the content of my nVidia Quadro FX 580 framebuffer
old X session modifying a bit nv driver:

     xf86DPMSInit(pScreen, xf86DPMSSet, 0);

-    /* Clear the screen */
-    if(pNv->xaa) {
-        /* Use the acceleration engine */
-        pNv->xaa->SetupForSolidFill(pScrn, 0, GXcopy, ~0);
-        pNv->xaa->SubsequentSolidFillRect(pScrn,
-            0, 0, pScrn->displayWidth, pNv->offscreenHeight);
-        G80DmaKickoff(pNv);
-    } else {
-        /* Use a slow software clear path */
-        memset(pNv->mem, 0, pitch * pNv->offscreenHeight);
-    }
+    pScreen->canDoBGNoneRoot = TRUE;

The commit is originally based on discussions happened on xorg-devel:
http://lists.freedesktop.org/archives/xorg-devel/2010-June/009755.html

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Acked-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-11-11 23:24:43 +02:00
Tiago Vignatti
bfe9cdd11b dix: delete logo hack screen saver
Protocol doesn't mention about screen saver with logo being required and
people are already using more intelligent ways to draw screen saver themes. So
consider -logo as deprecated option, deleting its code.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-11-11 23:20:35 +02:00
Peter Hutterer
88cb61e1e5 Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-api
Conflicts:
	dix/getevents.c
	hw/xfree86/common/xf86Xinput.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 12:54:46 +10:00
Cyril Brulebois
b142b0d274 Remove more superfluous if(p!=NULL) checks around free(p).
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@
- if (E != NULL)
-   free(E);
+ free(E);

Signed-off-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 08:29:54 +10: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
Tiago Vignatti
a210068c52 dix: advance parent window pointer when no node is found
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-27 08:08:24 +10:00
Peter Hutterer
58554f1c64 Convert some leftover axes->mode access to valuator_get_mode()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-25 10:37:46 +10:00
Peter Hutterer
5cf3b654fc input: move proximity state into ProximityClassRec.
Previously the OutOfProximity bit in the valuator mode.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 16:18:59 +10:00
Peter Hutterer
b5ef88c911 dix: clip absolute axes depending on their mode.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 16:18:59 +10:00
Peter Hutterer
ea567b675f dix: populate motion history only if the mode matches the first axis.
XI1 doesn't cater for mixed mode devices, so bail out on the first valuator
that has a different mode.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 16:18:59 +10:00
Peter Hutterer
4381b70f5a input: add valuator_get_mode() helper.
Returns the mode of the specified valuator.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 16:18:56 +10:00
Peter Hutterer
6f6f460c24 dix: send proximity events if one or more axes are Absolute.
We only skip relative events for proximity, not absolute ones. Now with
mixed mode, just unset those axes that are relative.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 15:18:33 +10:00
Chase Douglas
65c0fc81eb Add support for per-axis valuator modes (Relative/Absolute)
The XI2 protocol supports per-axis modes, but the server so far does
not. This change adds support in the server.

A complication is the fact that XI1 does not support per-axis modes.
The solution provided here is to set a per-device mode that defines the
mode of at least the first two valuators (X and Y). Note that initializing
the first two axes to a different mode than the device mode will fail.

For XI1 events, any axes following the first two that have the same mode
will be sent to clients, up to the first axis that has a different mode.
Thus, if a device has relative, then absolute, then relative mode axes,
only the first block of relative axes will be sent over XI1.

Since the XI2 protocol supports per-axis modes, all axes are sent to the
client.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 13:37:57 +10:00
Peter Hutterer
2362adc2da dix: remove valuator_mask_copy_valuators, not needed anymore.
With the switch to masks internally, this isn't needed anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 11:02:53 +10:00
Peter Hutterer
0418a39e71 dix: get rid of the now-superfluous valuator arrays in GPE and friends.
The valuators are stored inside the mask, use it from there. are stored
inside the mask, use it from there. are stored inside the mask, use it from
there. are stored inside the mask, use it from there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 11:02:53 +10:00
Peter Hutterer
675f4a8525 Abstract valuator masks through a set of APIs.
This commit introduces an abstraction API for handling masked valuators. The
intent is that drivers just allocate a mask, set the data and pass the mask
to the server. The actual storage type of the mask is hidden from the
drivers.

The new calls for drivers are:
    valuator_mask_new()     /* to allocate a valuator mask */
    valuator_mask_zero()    /* to reset a mask to zero */
    valuator_mask_set()     /* to set a valuator value */

The new interface to the server is
    xf86PostMotionEventM()
    xf86PostButtonEventM()
    xf86PostKeyboardEventM()
    xf86PostProximityEventM()

all taking a mask instead of the valuator array.

The ValuatorMask is currently defined for MAX_VALUATORS fixed size due to
memory allocation restrictions in SIGIO handlers.

For easier review, a lot of the code still uses separate valuator arrays.
This will be fixed in a later patch.

This patch was initially written by Chase Douglas.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-22 11:02:48 +10:00
Chase Douglas
fc48a8f9f5 Add CountBits() to the server.
Function to count the number of bits set in the given array.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-20 09:38:27 +10:00
Joe Shaw
e354ccac36 fix a sign problem with valuator data.
Without this patch, any negative valuator value is wrong when returned
from XQueryDeviceState().  This is a regression from at least xserver
1.4.

Valuator data is set in dix/getevents.c:set_valuators() by copying
signed int values into an unsigned int field
DeviceEvent.valuators.data.

That data is converted into a double with an implicit cast by
assignment to axisVal[i] in Xi/exevents.c:UpdateDeviceState().

That double is converted back to a signed int in
queryst.c:ProcXQueryDeviceState().  If the original value in
set_valuators() is negative, the double value will be > 2^31 and the
conversion back to a signed int is undefined.  (Although I
consistently see the value -2^31.)

Fix this by changing the definition of DeviceEvent.valuators.data from
uint32_t to int32_t.

Signed-off-by: Joe Shaw <joeshaw@litl.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-18 10:16:23 +10:00