summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2011-02-28 22:28:07 +0100
committerMatthieu Herrb <matthieu.herrb@laas.fr>2011-04-24 17:48:14 +0200
commit758a969e42667a3fb1dfde9a5a977d61c4552962 (patch)
tree3519c30cdf1cca3ce8a946bb3a57c72da5104548
parent672c80f92fac51f1477d84662373fdd480826603 (diff)
Preliminary attempt at addint randr support.
-rw-r--r--src/Makefile.am3
-rw-r--r--src/randr.c50
-rw-r--r--src/ws.c38
3 files changed, 77 insertions, 14 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 989f245..3178f4b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,4 +24,5 @@ INCLUDES=-I$(top_srcdir)/include/
@DRIVER_NAME@_drv_la_SOURCES = \
@DRIVER_NAME@.c \
@DRIVER_NAME@.h \
- emumb.c
+ emumb.c \
+ randr.c
diff --git a/src/randr.c b/src/randr.c
new file mode 100644
index 0000000..0ab1547
--- /dev/null
+++ b/src/randr.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010 Matthieu Herrb <matthieu@herrb.eu>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#include <xf86.h>
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <xf86Xinput.h>
+#include <scrnintstr.h>
+#include <randrstr.h>
+
+#include "ws.h"
+
+void
+wsRandRGetInfo(InputInfoPtr pInfo, char *name)
+{
+ WSDevicePtr priv = pInfo->private;
+ ScreenPtr pScreen = screenInfo.screens[priv->screen_no];
+ RRCrtcPtr crtc;
+ RROutputPtr output;
+ int i, x0, y0, width, height;
+
+ if (pScreen) {
+ rrScrPriv(pScreen);
+ for (i = 0; i < pScrPriv->numOutputs; i++) {
+ output = pScrPriv->outputs[i];
+ crtc = output->crtc;
+ ErrorF("--> Output %d: %s\n", i, output->name);
+ if (!strcmp(output->name, name)) {
+ x0 = crtc->x;
+ y0 = crtc->y;
+ width = crtc->mode->mode.width;
+ height = crtc->mode->mode.height;
+ }
+ }
+ }
+}
diff --git a/src/ws.c b/src/ws.c
index e5c16a6..8c11bfb 100644
--- a/src/ws.c
+++ b/src/ws.c
@@ -237,15 +237,20 @@ wsPreInit12(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
buttons_from = X_CONFIG;
}
- priv->screen_no = xf86SetIntOption(pInfo->options, "ScreenNo", 0);
- xf86Msg(X_CONFIG, "%s associated screen: %d\n",
- pInfo->name, priv->screen_no);
- if (priv->screen_no >= screenInfo.numScreens ||
- priv->screen_no < 0) {
- priv->screen_no = 0;
+ priv->screen_no = xf86SetIntOption(pInfo->options, "ScreenNo", -1);
+ if (priv->screen_no != -1) {
+ if (priv->screen_no >= screenInfo.numScreens ||
+ priv->screen_no < 0) {
+ priv->screen_no = 0;
+ }
+ xf86Msg(X_CONFIG, "%s associated screen: %d\n",
+ pInfo->name, priv->screen_no);
+ }
+
+ priv->rroutput = xf86SetStrOption(pInfo->options, "Output", NULL);
+ if (priv->rroutput) {
+ wsRandRGetInfo(pInfo, priv->rroutput);
}
-
-
priv->swap_axes = xf86SetBoolOption(pInfo->options, "SwapXY", 0);
if (priv->swap_axes) {
xf86Msg(X_CONFIG,
@@ -317,11 +322,18 @@ wsPreInit12(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
priv->min_y = priv->coords.miny;
priv->max_y = priv->coords.maxy;
} else {
- /* in calibrated mode, coordinate space, is screen coords */
- priv->min_x = 0;
- priv->max_x = screenInfo.screens[priv->screen_no]->width - 1;
- priv->min_y = 0;
- priv->max_y = screenInfo.screens[priv->screen_no]->height - 1;
+ if (priv->screen_no != -1) {
+ /* in calibrated mode, coordinate space, is screen coords */
+ priv->min_x = 0;
+ priv->max_x = screenInfo.screens[priv->screen_no]->width - 1;
+ priv->min_y = 0;
+ priv->max_y = screenInfo.screens[priv->screen_no]->height - 1;
+ } else {
+ priv->min_x = -1;
+ priv->max_x = -1;
+ priv->min_y = -1;
+ priv->max_y = -1;
+ }
}
/* Allow options to override this */
priv->min_x = xf86SetIntOption(pInfo->options, "MinX", priv->min_x);