Use bytes_per_line and bits_per_pixel from the created XImage to fix
https://bugzilla.redhat.com/show_bug.cgi?id=518960
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
With this option passed, ephyr windows can be resized like normal
windows on the fly, without the need of an explicit parent window.
Signed-off-by: Daniel Martin <daniel.martin@secunet.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Found by parfait 1.1 code analyser:
Memory leak of pointer 'keymap' allocated with XGetKeyboardMapping(HostX.dpy, min_keycode, ((max_keycode - min_keycode) + 1), &host_width)
at line 861 of hw/kdrive/ephyr/hostx.c in function 'hostx_load_keymap'.
'keymap' allocated at line 845 with XGetKeyboardMapping(HostX.dpy, min_keycode, ((max_keycode - min_keycode) + 1), &host_width).
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
When Xephyr is embedded into another application (e.g. in xoo), the
input events may come from the parent Window instead of our own. So make
sure we find the host screen in that case as well instead of crashing.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Bugzilla: https://bugs.freedesktop.org/25804
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Vic Lee <llyzs@163.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
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>
Required in order to build with Studio cc now that xorg-macros is
setting -errwarn=E_FUNC_HAS_NO_RETURN_STMT since a bug in the Solaris
system headers causes the noreturn attribute to not be correctly
applied to the exit() prototype in <stdlib.h> when building with
Studio instead of gcc.
Otherwise compiler exits with errors:
"Display.c", line 65: Function has no return statement : x_io_error_handler
"hostx.c", line 341: Function has no return statement : x_io_error_handler
Uses Studio-specific pragma instead of adding another exit() prototype
with a noreturn attribute to avoid causing gcc to warn about having
a redundant prototype for the exit() function.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Report to find out all non-UTF-8 files created by
cat extensions |xargs -I XXXX find . -name \*.XXXX |while read FILE ; do
if ( iconv -f utf8 -t ucs2 $FILE >/dev/null 2>/dev/null ) ; then
/bin/true
else
echo $FILE
fi
done >>report
Signed-off-by: Matěj Cepl <mcepl@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
[Daniel: git am failed for me, so I redid it. The method listed in the
commit message also failed, so I just used file/grep/iconv. The
results are the same though.]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This patch was generated by the following Perl code:
perl -i -pe 's/([^_])return\s*\(\s*([^(]+?)\s*\)s*;(\s+(\n))?/$1return $2;$4/g;'
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
When we are looking up the screen for an event, we need to take
into account the fact that the event may have been delivered to the
"peer window" that we create when implementing GLX. Since we only
ever create one such window per screen, just add a single peer_win
field to EphyrHostScreen.
<http://bugs.opensolaris.org/view_bug.do?bug_id=6685465>
This is a refix of the previous fix for CR 6685465. In the first fix
I was shifting the colors to match the mask by the bits_per_rgb amount
in the visual structure. That field has nothing to do with the # of
bits to shift by. I should just instead shift the bits to match the mask.
<http://bugs.opensolaris.org/view_bug.do?bug_id=6685465>
This bug is caused by Xephyr not handling the RGB byte order correctly
of the server where Xephyr is displaying on. The previous code just
assumed that the order was RGB and did not take into account that
Xservers may use different order (such as BGR).
The fix is to add a function to calculate the byte order and bits
to shift based on the visual mask and the visual bits_per_rgb (which
is usually 8, but could be server dependent). Since the shifts won't
change once the display connection has been made, I can cache these
values so that Xephyr doesn't have to keep recalculating them everytime
it tries to translate the Xephyr colormap entries for Xephyr clients to
the actual server colormap entries (i.e. calling the function
hostx_set_cmap_entry() repeatedly for every colormap entry).
When an expose event happens on an host GL window paired with an
internal drawable, route that expose event to the clients listening
to the expose event on the internal drawable.
We can now launch GL or XV apps in any of the
Xephyr screens we want.
* hw/kdrive/ephyr/hostx.c,h:
(hostx_get_window):
(hostx_create_window): make these functions be screen
number aware.
* hw/kdrive/ephyr/XF86dri.c : fix some compiler warnings.
* hw/kdrive/ephyr/ephyrdri.c:
(ephyrDRIQueryDirectRenderingCapable),
(ephyrDRIOpenConnection),
(ephyrDRIAuthConnection),
(ephyrDRICloseConnection),
(ephyrDRIGetClientDriverName),
(ephyrDRICreateContext),
(ephyrDRIDestroyContext),
(ephyrDRICreateDrawable),
(ephyrDRIGetDrawableInfo),
(ephyrDRIGetDeviceInfo): in all those functions, don't forward
the screen number we receive - from the client - to the host X.
We (Xephyr) are always targetting the same X display screen, which is
the one Xephyr got launched against. So we enforce that in the code.
* hw/kdrive/ephyr/ephyrdriext.c:
(EphyrMirrorHostVisuals): make this duplicate the visuals of the host X
default screen into a given Xephyr screen. This way we have a chance
to update the visuals of all Xephyr screen to make them mirror those
of the host X.
(many other places): specify screen number where required by the api
change in hostx.h.
* hw/kdrive/ephyr/ephyrglxext.c: specify screen number where required
by the api change in hostx.h
* hw/kdrive/ephyr/ephyrhostglx.c: don't forward the screen number we
receive - from the client - to the host X.
We (Xephyr) are always targetting the same
X display screen, which is
the one Xephyr got launched against. So we enforce that in the code.
* hw/kdrive/ephyr/ephyrhostvideo.c,h: take in account the screen number received
from the client app. This is useful to know on which Xephyr screen we
need to display video stuff.
* hw/kdrive/ephyr/ephyrvideo.c: update this to reflect the API change
in hw/kdrive/ephyr/ephyrhostvideo.h.
(ephyrSetPortAttribute): when parameters are not valid
- they exceed their validity range - send them to the host anyway
and do not return an error to clients.
Some host expose buggy validity range, so rejecting client for that
is too harsh.
* hw/kdrive/ephyr/hostx.c,h:
(hostx_has_xshape),
(hostx_has_glx),
(hostx_has_dri): added these new entry points
* hw/kdrive/ephyr/ephyrdriext.c:
(ephyrDRIExtensionInit):
check presence of DRI and XShape extensions before
trying to use them.
* hw/kdrive/ephyr/ephyrglxext.c:
(ephyrHijackGLXExtension):
check presence of glx extension before we use it.
* hw/kdrive/ephyr/ephyrdri.c:
(ephyrDRIGetDrawableInfo): force the back clipping rects
to equal the front clipping rects.
* hw/kdrive/ephyr/ephyrdriext.c:
(ProcXF86DRIGetDrawableInfo): properly overclip the clipping rects we
got from the client. This bug fixes a clipping rect that was too
small in height, basically. Also fix a possible mem corruption.
* hw/kdrive/ephyr/hostx.c:
(hostx_set_window_geometry): remove a useless XSync
* hw/kdrive/ephyr/ephyr.c:
(ephyrInitialize): cleanup ephyrDRI extension init.
remove functions that belongs in ephyrdriext.c .
* hw/kdrive/ephyr/ephyrdri.c:
(ephyrDRICreateDrawable): create the drawable on the host X peer
window, not on the host xephyr main window.
(ephyrDRIGetDrawableInfo): get drawable info of the host X peer
window.
* hw/kdrive/ephyr/ephyrdriext.c: make ephyr DRI extention wrap
a bunch of screen ops so that it can update the host X peer
window whenever DRI bound drawable are moved in Xephyr.
Also code the building blocks of the management of the
host X window peer.
* hw/kdrive/ephyr/hostx.c,h:
(hostx_create_window): added this new entry point
(hostx_destroy_window): ditto
()hostx_set_window_geometry): ditto
* hw/kdrive/ephyr/ephyr.c:
(EphyrDuplicateVisual): when duplicating the
visual, copy the color component masks and the class
from the hostX
(EphyrMirrorHostVisuals): don't mix blue and green mask.
* hw/kdrive/ephyr/ephyrdri.c: add more logs.
(ephyrDRICreateDrawable): actually implement this.
for the moment it creates a DRI drawable for the hostX window,
no matter what drawable this call was issued for.
(ephyrDRIGetDrawableInfo): actually implemented this.
for the moment the drawable info queried for its attrs is the
Xephyr main main window.
* hw/kdrive/ephyr/ephyrdriext.c:
(ProcXF86DRIGetDrawableInfo): properly hook this dispatch
function to the ephyrDRIGetDrawableInfo() function.
* hw/kdrive/ephyr/ephyrglxext.c: add a bunch of GLX implementation hooks
here. Hijack some of the xserver GLX hooks with them. Still need to
properly support byteswapped clients though.
* hw/kdrive/ephyr/ephyrhostglx.c,h: actually implemented the protocol
level forwarding functions used by the GLX entr points in
ephyrglxext.c. Here as well, there are a bunch of them, but we are
far from having implemented all the GLX calls.
* hw/kdrive/ephyr/hostx.c,h:
(hostx_get_window_attributes): added this new entry point
(hostx_allocate_resource_id_peer): added this to keep track of
resource IDs peers: one member of the peer is in Xephyr, the other
is in host X.
(hostx_get_resource_id_peer): ditto.
* hw/kdrive/ephyr/ephyr.c: make Xephyr mirror
the visuals of the host X upon startup. This
is important for GLX client apps.
* hw/kdrive/ephyr/hostx.c,h: add a hostx_get_visuals_info()
to get the visuals of the host X.
* hw/kdrive/ephyr/Makefile.am: add the proxy extension to
ephyr. The proxy extension is an experimental extension that
forwards protocol packets targeted at a given extension to the
host X.
* hw/kdrive/ephyr/ephyr.c: init proxy ext.
* hw/kdrive/ephyr/ephyrhostproxy.c,h: added this new file as part of the
proxy extension.
* hw/kdrive/ephyr/ephyrproxyext.c,h: ditto
* hw/kdrive/ephyr/hostx.c: add the hostx_get_get_extension_info() entry
point.
* hw/kdrive/ephyr/ephyrhostvideo.c,h:
(EphyrHostXVPutImage): first implementation. does not
support clipping regions yet.
* hw/kdrive/ephyr/ephyrvideo.c:
(DoSimpleClip): clip using a clipping box. Does not
support regions yet.
(EphyrPutImage): first implementation.
Uses a simple clipping rectangle, no region yet.
* hw/kdrive/ephyr/hostx.c:
(hostx_get_window): added this to get the main
window of the host x.
* This patch adds multiscreen support to Xephyr. For instance,
the command line : "Xephyr :4 -ac -screen 320x240 -screen 640x480"
will launch with two "screens" - namely two main windows.
The first main window represents a screen that has the number :4.0, with
a geometry of 320x240 pixels, and the second one represents a screen
that has the number :4.1 with a geometry of 640x480.
The command line: "DISPLAY=:4.1 xclock" will launch the xclock program
on the second screen, for intance.
* this patch was edited by Dodji Seketeli <dodji@openedhand.com> for:
- better style compliance with the rest of the Xephyr code
- make sure Xephyr could be launched with no -screen option. By
default that creates a default screen of 640x480 pixel like before
- display full titles on the windows - with insctructions to grab
keyboard and mouse - like before.
Initialise our axes properly in the DIX, and make sure we don't
unnecessarily clip maxval when it's not set.
Fix keymap copying in Xephyr (to some degree: it's still broken),
and set nAxes and nButtons properly.
Convert KDrive to GPE/GKE interface.
Add first-class drivers and enumerate every device separately through
Xi, instead of lamely attempting to aggregate them.
Add XKB support to the Linux keyboard driver.
Add 'thumb button' support to the tslib driver.
Rejig InitInput, so each DDX has to add a list of drivers it supports.
Support NewInputDeviceRequest, et al.
same width/height for front-buffer drawing. The fakexa code then uses
this extra space for offscreen pixmaps. Note that this tones down the
absurdity of fakexa's offscreen pixmap alignment requirements (odd
alignment is too weird, so stick with "24", which is still strange but
exists out there). It also fixes a couple of bugs in the fakexa
implementation revealed by using offscreen pixmaps.