Xephyr improvements
This commit is contained in:
parent
81a3b6fe27
commit
50cdff7ee2
|
@ -83,7 +83,6 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
|
||||||
screen->height = height;
|
screen->height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth())
|
if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth())
|
||||||
{
|
{
|
||||||
if (screen->fb[0].depth < hostx_get_depth()
|
if (screen->fb[0].depth < hostx_get_depth()
|
||||||
|
|
|
@ -87,6 +87,10 @@ ddxProcessArgument (int argc, char **argv, int i)
|
||||||
hostx_use_host_cursor();
|
hostx_use_host_cursor();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else if (argv[i][0] == ':')
|
||||||
|
{
|
||||||
|
hostx_set_display_name(argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return KdProcessArgument (argc, argv, i);
|
return KdProcessArgument (argc, argv, i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/keysym.h>
|
||||||
#include <X11/extensions/XShm.h>
|
#include <X11/extensions/XShm.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -48,6 +49,7 @@
|
||||||
|
|
||||||
struct EphyrHostXVars
|
struct EphyrHostXVars
|
||||||
{
|
{
|
||||||
|
char *server_dpy_name;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
int screen;
|
int screen;
|
||||||
Visual *visual;
|
Visual *visual;
|
||||||
|
@ -68,7 +70,8 @@ struct EphyrHostXVars
|
||||||
XShmSegmentInfo shminfo;
|
XShmSegmentInfo shminfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
static EphyrHostXVars HostX = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* memset? */
|
/* memset ( missing> ) instead of below */
|
||||||
|
static EphyrHostXVars HostX = { "?", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
static int HostXWantDamageDebug = 0;
|
static int HostXWantDamageDebug = 0;
|
||||||
|
|
||||||
|
@ -125,6 +128,24 @@ hostx_want_screen_size(int *width, int *height)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hostx_set_display_name(char *name)
|
||||||
|
{
|
||||||
|
HostX.server_dpy_name = strdup(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hostx_set_win_title(char *extra_text)
|
||||||
|
{
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
|
snprintf(buf, 256, "Xephyr on %s %s",
|
||||||
|
HostX.server_dpy_name,
|
||||||
|
(extra_text != NULL) ? extra_text : "");
|
||||||
|
|
||||||
|
XStoreName(HostX.dpy, HostX.win, buf);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
hostx_want_host_cursor(void)
|
hostx_want_host_cursor(void)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +254,7 @@ hostx_init(void)
|
||||||
CWEventMask,
|
CWEventMask,
|
||||||
&attr);
|
&attr);
|
||||||
|
|
||||||
XStoreName(HostX.dpy, HostX.win, "Xephyr");
|
hostx_set_win_title("( ctrl+shift grabs mouse and keyboard )");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -508,8 +529,8 @@ hostx_paint_rect(int sx, int sy,
|
||||||
unsigned char r,g,b;
|
unsigned char r,g,b;
|
||||||
unsigned long host_pixel;
|
unsigned long host_pixel;
|
||||||
|
|
||||||
for (x=sx; x<sx+width; x++)
|
|
||||||
for (y=sy; y<sy+height; y++)
|
for (y=sy; y<sy+height; y++)
|
||||||
|
for (x=sx; x<sx+width; x++)
|
||||||
{
|
{
|
||||||
idx = (HostX.win_width*y*bytes_per_pixel)+(x*bytes_per_pixel);
|
idx = (HostX.win_width*y*bytes_per_pixel)+(x*bytes_per_pixel);
|
||||||
|
|
||||||
|
@ -608,6 +629,7 @@ int
|
||||||
hostx_get_event(EphyrHostXEvent *ev)
|
hostx_get_event(EphyrHostXEvent *ev)
|
||||||
{
|
{
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
|
static Bool grabbed;
|
||||||
|
|
||||||
if (XPending(HostX.dpy))
|
if (XPending(HostX.dpy))
|
||||||
{
|
{
|
||||||
|
@ -649,9 +671,45 @@ hostx_get_event(EphyrHostXEvent *ev)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
|
|
||||||
|
if ((XKeycodeToKeysym(HostX.dpy,xev.xkey.keycode,0) == XK_Shift_L
|
||||||
|
|| XKeycodeToKeysym(HostX.dpy,xev.xkey.keycode,0) == XK_Shift_R)
|
||||||
|
&& (xev.xkey.state & ControlMask))
|
||||||
|
{
|
||||||
|
if (grabbed)
|
||||||
|
{
|
||||||
|
XUngrabKeyboard (HostX.dpy, CurrentTime);
|
||||||
|
XUngrabPointer (HostX.dpy, CurrentTime);
|
||||||
|
grabbed = False;
|
||||||
|
hostx_set_win_title("( ctrl+shift grabs mouse and keyboard )");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (XGrabKeyboard (HostX.dpy, HostX.win, True,
|
||||||
|
GrabModeAsync,
|
||||||
|
GrabModeAsync,
|
||||||
|
CurrentTime))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (XGrabPointer (HostX.dpy, HostX.win, True,
|
||||||
|
NoEventMask,
|
||||||
|
GrabModeAsync,
|
||||||
|
GrabModeAsync,
|
||||||
|
HostX.win, None, CurrentTime))
|
||||||
|
break;
|
||||||
|
|
||||||
|
grabbed = True;
|
||||||
|
hostx_set_win_title("( ctrl+shift releases mouse and keyboard )");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ev->type = EPHYR_EV_KEY_RELEASE;
|
ev->type = EPHYR_EV_KEY_RELEASE;
|
||||||
ev->data.key_up.scancode = xev.xkey.keycode;
|
ev->data.key_up.scancode = xev.xkey.keycode;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -100,6 +100,12 @@ hostx_handle_signal(int signum);
|
||||||
int
|
int
|
||||||
hostx_init(void);
|
hostx_init(void);
|
||||||
|
|
||||||
|
void
|
||||||
|
hostx_set_display_name(char *name);
|
||||||
|
|
||||||
|
void
|
||||||
|
hostx_set_win_title(char *extra_text);
|
||||||
|
|
||||||
int
|
int
|
||||||
hostx_get_depth (void);
|
hostx_get_depth (void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue