aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/ephyr
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/kdrive/ephyr')
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.c80
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.c36
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.h10
3 files changed, 101 insertions, 25 deletions
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c
index 772d9b75a..978fd93ef 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.c
@@ -418,23 +418,22 @@ ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
struct {
int width, height;
} sizes[] = {
- {
- 1600, 1200}, {
- 1400, 1050}, {
- 1280, 960}, {
- 1280, 1024}, {
- 1152, 864}, {
- 1024, 768}, {
- 832, 624}, {
- 800, 600}, {
- 720, 400}, {
- 480, 640}, {
- 640, 480}, {
- 640, 400}, {
- 320, 240}, {
- 240, 320}, {
- 160, 160}, {
- 0, 0}
+ {1600, 1200},
+ {1400, 1050},
+ {1280, 960},
+ {1280, 1024},
+ {1152, 864},
+ {1024, 768},
+ {832, 624},
+ {800, 600},
+ {720, 400},
+ {480, 640},
+ {640, 480},
+ {640, 400},
+ {320, 240},
+ {240, 320},
+ {160, 160},
+ {0, 0}
};
EPHYR_LOG("mark");
@@ -561,6 +560,8 @@ ephyrRandRSetConfig(ScreenPtr pScreen,
if (wasEnabled)
KdEnableScreen(pScreen);
+ RRScreenSizeNotify(pScreen);
+
return TRUE;
bail4:
@@ -593,6 +594,43 @@ ephyrRandRInit(ScreenPtr pScreen)
pScrPriv->rrSetConfig = ephyrRandRSetConfig;
return TRUE;
}
+
+static Bool
+ephyrResizeScreen (ScreenPtr pScreen,
+ int newwidth,
+ int newheight)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ RRScreenSize size = {0};
+ Bool ret;
+ int t;
+
+ if (screen->randr & (RR_Rotate_90|RR_Rotate_270)) {
+ t = newwidth;
+ newwidth = newheight;
+ newheight = t;
+ }
+
+ if (newwidth == screen->width && newheight == screen->height) {
+ return FALSE;
+ }
+
+ size.width = newwidth;
+ size.height = newheight;
+
+ ret = ephyrRandRSetConfig (pScreen, screen->randr, 0, &size);
+ if (ret) {
+ RROutputPtr output;
+
+ output = RRFirstOutput(pScreen);
+ if (!output)
+ return FALSE;
+ RROutputSetModes(output, NULL, 0, 0);
+ }
+
+ return ret;
+}
#endif
Bool
@@ -941,6 +979,14 @@ ephyrPoll(void)
break;
#endif /* XF86DRI */
+#ifdef RANDR
+ case EPHYR_EV_CONFIGURE:
+ ephyrResizeScreen(screenInfo.screens[ev.data.configure.screen],
+ ev.data.configure.width,
+ ev.data.configure.height);
+ break;
+#endif /* RANDR */
+
default:
break;
}
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
index f313afa5a..b13e8c796 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -351,7 +351,11 @@ hostx_init(void)
attr.event_mask =
ButtonPressMask
| ButtonReleaseMask
- | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask;
+ | PointerMotionMask
+ | KeyPressMask
+ | KeyReleaseMask
+ | ExposureMask
+ | StructureNotifyMask;
EPHYR_DBG("mark");
@@ -712,12 +716,14 @@ __asm int 3;
XResizeWindow(HostX.dpy, host_screen->win, width, height);
/* Ask the WM to keep our size static */
- size_hints = XAllocSizeHints();
- size_hints->max_width = size_hints->min_width = width;
- size_hints->max_height = size_hints->min_height = height;
- size_hints->flags = PMinSize | PMaxSize;
- XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints);
- XFree(size_hints);
+ if (host_screen->win_pre_existing == None) {
+ size_hints = XAllocSizeHints();
+ size_hints->max_width = size_hints->min_width = width;
+ size_hints->max_height = size_hints->min_height = height;
+ size_hints->flags = PMinSize | PMaxSize;
+ XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints);
+ XFree(size_hints);
+ }
XMapWindow(HostX.dpy, host_screen->win);
@@ -1028,6 +1034,22 @@ hostx_get_event(EphyrHostXEvent * ev)
ev->data.key_up.scancode = xev.xkey.keycode;
return 1;
+ case ConfigureNotify:
+ {
+ struct EphyrHostScreen *host_screen =
+ host_screen_from_window(xev.xconfigure.window);
+
+ if (host_screen && host_screen->win_pre_existing != None) {
+ ev->type = EPHYR_EV_CONFIGURE;
+ ev->data.configure.width = xev.xconfigure.width;
+ ev->data.configure.height = xev.xconfigure.height;
+ ev->data.configure.window = xev.xconfigure.window;
+ ev->data.configure.screen = host_screen->mynum;
+ return 1;
+ }
+
+ return 0;
+ }
default:
break;
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.h b/xorg-server/hw/kdrive/ephyr/hostx.h
index c1e1133c0..1b91e5162 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.h
+++ b/xorg-server/hw/kdrive/ephyr/hostx.h
@@ -51,7 +51,8 @@ typedef enum EphyrHostXEventType {
EPHYR_EV_MOUSE_RELEASE,
EPHYR_EV_KEY_PRESS,
EPHYR_EV_KEY_RELEASE,
- EPHYR_EV_EXPOSE
+ EPHYR_EV_EXPOSE,
+ EPHYR_EV_CONFIGURE,
} EphyrHostXEventType;
/* I can't believe it's not a KeySymsRec. */
@@ -93,6 +94,13 @@ struct EphyrHostXEvent {
int window;
} expose;
+ struct configure {
+ int width;
+ int height;
+ int screen;
+ int window;
+ } configure;
+
} data;
int key_state;