aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/multiple/X
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2013-11-10 21:07:16 +0100
committerJoel Bodenmann <joel@unormal.org>2013-11-10 21:07:16 +0100
commitda2740b706d720292113445ee1db30f8a9873dc4 (patch)
tree8f8b1902d4af6a23b3daf26990f580b76ea31ea4 /drivers/multiple/X
parent6ca3537a696e7ace8098771a9a7105380604253d (diff)
parenta8ce005e2621b0108863297948cea0fa52c8bf2a (diff)
downloaduGFX-da2740b706d720292113445ee1db30f8a9873dc4.tar.gz
uGFX-da2740b706d720292113445ee1db30f8a9873dc4.tar.bz2
uGFX-da2740b706d720292113445ee1db30f8a9873dc4.zip
merging GDISPStreaming
Diffstat (limited to 'drivers/multiple/X')
-rw-r--r--drivers/multiple/X/gdisp_lld.c294
-rw-r--r--drivers/multiple/X/gdisp_lld.mk5
-rw-r--r--drivers/multiple/X/gdisp_lld_X.c340
-rw-r--r--drivers/multiple/X/gdisp_lld_config.h14
4 files changed, 345 insertions, 308 deletions
diff --git a/drivers/multiple/X/gdisp_lld.c b/drivers/multiple/X/gdisp_lld.c
deleted file mode 100644
index 13368bc1..00000000
--- a/drivers/multiple/X/gdisp_lld.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * This file is subject to the terms of the GFX License. If a copy of
- * the license was not distributed with this file, you can obtain one at:
- *
- * http://ugfx.org/license.html
- */
-
-/**
- * @file drivers/multiple/X/gdisp_lld.c
- * @brief GDISP Graphics Driver subsystem low level driver source for X.
- */
-
-#include "gfx.h"
-
-#if GFX_USE_GDISP
-
-/**
- * Our color model - Default or 24 bit only.
- *
- * At present we don't define this as we don't need to.
- * It may however be useful later if we implement bitblits.
- * As this may be dead code we don't include it in gdisp/options.h
- */
-#ifndef GDISP_FORCE_24BIT
- #define GDISP_FORCE_24BIT FALSE
-#endif
-
-#if GINPUT_NEED_MOUSE
- /* Include mouse support code */
- #include "ginput/lld/mouse.h"
-#endif
-
-/* Include the emulation code for things we don't support */
-#include "gdisp/lld/emulation.c"
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifndef GDISP_SCREEN_HEIGHT
- #define GDISP_SCREEN_HEIGHT 480
-#endif
-#ifndef GDISP_SCREEN_WIDTH
- #define GDISP_SCREEN_WIDTH 640
-#endif
-
-Display *dis;
-int scr;
-Window win;
-Pixmap pix;
-XEvent evt;
-GC gc;
-Colormap cmap;
-XVisualInfo vis;
-int depth;
-#if GINPUT_NEED_MOUSE
- coord_t mousex, mousey;
- uint16_t mousebuttons;
-#endif
-
-static void ProcessEvent(void) {
- XColor col;
-
- switch(evt.type) {
- case Expose:
- XCopyArea(dis, pix, win, gc,
- evt.xexpose.x, evt.xexpose.y,
- evt.xexpose.width, evt.xexpose.height,
- evt.xexpose.x, evt.xexpose.y);
- break;
-#if GINPUT_NEED_MOUSE
- case ButtonPress:
- mousex = evt.xbutton.x;
- mousey = evt.xbutton.y;
- switch(evt.xbutton.button){
- case 1: mousebuttons |= GINPUT_MOUSE_BTN_LEFT; break;
- case 2: mousebuttons |= GINPUT_MOUSE_BTN_MIDDLE; break;
- case 3: mousebuttons |= GINPUT_MOUSE_BTN_RIGHT; break;
- case 4: mousebuttons |= GINPUT_MOUSE_BTN_4; break;
- }
- #if GINPUT_MOUSE_POLL_PERIOD == TIME_INFINITE
- ginputMouseWakeup();
- #endif
- break;
- case ButtonRelease:
- mousex = evt.xbutton.x;
- mousey = evt.xbutton.y;
- switch(evt.xbutton.button){
- case 1: mousebuttons &= ~GINPUT_MOUSE_BTN_LEFT; break;
- case 2: mousebuttons &= ~GINPUT_MOUSE_BTN_MIDDLE; break;
- case 3: mousebuttons &= ~GINPUT_MOUSE_BTN_RIGHT; break;
- case 4: mousebuttons &= ~GINPUT_MOUSE_BTN_4; break;
- }
- #if GINPUT_MOUSE_POLL_PERIOD == TIME_INFINITE
- ginputMouseWakeup();
- #endif
- break;
- case MotionNotify:
- mousex = evt.xmotion.x;
- mousey = evt.xmotion.y;
- #if GINPUT_MOUSE_POLL_PERIOD == TIME_INFINITE
- ginputMouseWakeup();
- #endif
- break;
-#endif
- }
-}
-
-/* this is the X11 thread which keeps track of all events */
-static DECLARE_THREAD_STACK(waXThread, 1024);
-static DECLARE_THREAD_FUNCTION(ThreadX, arg) {
- (void)arg;
-
- while(1) {
- gfxSleepMilliseconds(100);
- while(XPending(dis)) {
- XNextEvent(dis, &evt);
- ProcessEvent();
- }
- }
- return 0;
-}
-
-static int FatalXIOError(Display *d) {
- (void) d;
-
- /* The window has closed */
- fprintf(stderr, "GFX Window closed!\n");
- exit(0);
-}
-
-bool_t gdisp_lld_init(void)
-{
- XSizeHints *pSH;
- XSetWindowAttributes xa;
- XTextProperty WindowTitle;
- char * WindowTitleText;
- gfxThreadHandle hth;
-
- #if GFX_USE_OS_LINUX || GFX_USE_OS_OSX
- XInitThreads();
- #endif
-
- dis = XOpenDisplay(NULL);
- scr = DefaultScreen(dis);
-
- #if GDISP_FORCE_24BIT
- if (!XMatchVisualInfo(dis, scr, 24, TrueColor, &vis)) {
- fprintf(stderr, "Your display has no TrueColor mode\n");
- XCloseDisplay(dis);
- return FALSE;
- }
- cmap = XCreateColormap(dis, RootWindow(dis, scr),
- vis.visual, AllocNone);
- #else
- vis.visual = CopyFromParent;
- vis.depth = DefaultDepth(dis, scr);
- cmap = DefaultColormap(dis, scr);
- #endif
- fprintf(stderr, "Running GFX Window in %d bit color\n", vis.depth);
-
- xa.colormap = cmap;
- xa.border_pixel = 0xFFFFFF;
- xa.background_pixel = 0x000000;
-
- win = XCreateWindow(dis, RootWindow(dis, scr), 16, 16,
- GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT,
- 0, vis.depth, InputOutput, vis.visual,
- CWBackPixel|CWColormap|CWBorderPixel, &xa);
- XSync(dis, TRUE);
-
- WindowTitleText = "GFX";
- XStringListToTextProperty(&WindowTitleText, 1, &WindowTitle);
- XSetWMName(dis, win, &WindowTitle);
- XSetWMIconName(dis, win, &WindowTitle);
- XSync(dis, TRUE);
-
- pSH = XAllocSizeHints();
- pSH->flags = PSize | PMinSize | PMaxSize;
- pSH->min_width = pSH->max_width = pSH->base_width = GDISP_SCREEN_WIDTH;
- pSH->min_height = pSH->max_height = pSH->base_height = GDISP_SCREEN_HEIGHT;
- XSetWMNormalHints(dis, win, pSH);
- XFree(pSH);
- XSync(dis, TRUE);
-
- pix = XCreatePixmap(dis, win,
- GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT, vis.depth);
- XSync(dis, TRUE);
-
- gc = XCreateGC(dis, win, 0, 0);
- XSetBackground(dis, gc, BlackPixel(dis, scr));
- XSync(dis, TRUE);
-
- XSelectInput(dis, win, StructureNotifyMask);
- XMapWindow(dis, win);
- do { XNextEvent(dis, &evt); } while (evt.type != MapNotify);
-
- /* start the X11 thread */
- XSetIOErrorHandler(FatalXIOError);
- XSelectInput(dis, win,
- ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
-
- if (!(hth = gfxThreadCreate(waXThread, sizeof(waXThread), HIGH_PRIORITY, ThreadX, 0))) {
- fprintf(stderr, "Cannot start X Thread\n");
- XCloseDisplay(dis);
- exit(0);
- }
- #if GFX_USE_OS_LINUX || GFX_USE_OS_OSX
- pthread_detach(hth);
- #endif
- gfxThreadClose(hth);
-
- /* Initialise the GDISP structure to match */
- GDISP.Orientation = GDISP_ROTATE_0;
- GDISP.Powermode = powerOn;
- GDISP.Backlight = 100;
- GDISP.Contrast = 50;
- GDISP.Width = GDISP_SCREEN_WIDTH;
- GDISP.Height = GDISP_SCREEN_HEIGHT;
- #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
- GDISP.clipx0 = 0;
- GDISP.clipy0 = 0;
- GDISP.clipx1 = GDISP.Width;
- GDISP.clipy1 = GDISP.Height;
- #endif
- return TRUE;
-}
-
-void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color)
-{
- XColor col;
-
- #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
- // Clip pre orientation change
- if (x < GDISP.clipx0 || y < GDISP.clipy0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
- #endif
-
- col.red = RED_OF(color) << 8;
- col.green = GREEN_OF(color) << 8;
- col.blue = BLUE_OF(color) << 8;
- XAllocColor(dis, cmap, &col);
- XSetForeground(dis, gc, col.pixel);
- XDrawPoint(dis, pix, gc, (int)x, (int)y );
- XDrawPoint(dis, win, gc, (int)x, (int)y );
- XFlush(dis);
-}
-
-void gdisp_lld_fill_area(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color) {
- XColor col;
-
- #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
- // Clip pre orientation change
- if (x < GDISP.clipx0) { cx -= GDISP.clipx0 - x; x = GDISP.clipx0; }
- if (y < GDISP.clipy0) { cy -= GDISP.clipy0 - y; y = GDISP.clipy0; }
- if (cx <= 0 || cy <= 0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
- if (x+cx > GDISP.clipx1) cx = GDISP.clipx1 - x;
- if (y+cy > GDISP.clipy1) cy = GDISP.clipy1 - y;
- #endif
-
- col.red = RED_OF(color) << 8;
- col.green = GREEN_OF(color) << 8;
- col.blue = BLUE_OF(color) << 8;
- XAllocColor(dis, cmap, &col);
- XSetForeground(dis, gc, col.pixel);
- XFillRectangle(dis, pix, gc, x, y, cx, cy);
- XFillRectangle(dis, win, gc, x, y, cx, cy);
- XFlush(dis);
-}
-
-// Start of Bitblit code
-//XImage bitmap;
-//pixel_t *bits;
-// bits = malloc(vis.depth * GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT);
-// bitmap = XCreateImage(dis, vis, vis.depth, ZPixmap,
-// 0, bits, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT,
-// 0, 0);
-
-#if GINPUT_NEED_MOUSE
-
- void ginput_lld_mouse_init(void) {}
-
- void ginput_lld_mouse_get_reading(MouseReading *pt) {
- pt->x = mousex;
- pt->y = mousey;
- pt->z = (mousebuttons & GINPUT_MOUSE_BTN_LEFT) ? 100 : 0;
- pt->buttons = mousebuttons;
- }
-
-#endif /* GINPUT_NEED_MOUSE */
-
-#endif /* GFX_USE_GDISP */
-/** @} */
-
diff --git a/drivers/multiple/X/gdisp_lld.mk b/drivers/multiple/X/gdisp_lld.mk
index 1a4fc4d7..572a5b7d 100644
--- a/drivers/multiple/X/gdisp_lld.mk
+++ b/drivers/multiple/X/gdisp_lld.mk
@@ -1,5 +1,2 @@
-# List the required driver.
-GFXSRC += $(GFXLIB)/drivers/multiple/X/gdisp_lld.c
-
-# Required include directories
GFXINC += $(GFXLIB)/drivers/multiple/X
+GFXSRC += $(GFXLIB)/drivers/multiple/X/gdisp_lld_X.c
diff --git a/drivers/multiple/X/gdisp_lld_X.c b/drivers/multiple/X/gdisp_lld_X.c
new file mode 100644
index 00000000..c9beb821
--- /dev/null
+++ b/drivers/multiple/X/gdisp_lld_X.c
@@ -0,0 +1,340 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/**
+ * @file drivers/multiple/X/gdisp_lld.c
+ * @brief GDISP Graphics Driver subsystem low level driver source for X.
+ */
+
+#include "gfx.h"
+
+#if GFX_USE_GDISP
+
+#define GDISP_DRIVER_VMT GDISPVMT_X11
+#include "../drivers/multiple/X/gdisp_lld_config.h"
+#include "gdisp/lld/gdisp_lld.h"
+
+/**
+ * Our color model - Default or 24 bit only.
+ *
+ * At present we don't define this as we don't need to.
+ * It may however be useful later if we implement bitblits.
+ * As this may be dead code we don't include it in gdisp/options.h
+ */
+#ifndef GDISP_FORCE_24BIT
+ #define GDISP_FORCE_24BIT FALSE
+#endif
+
+#ifndef GDISP_SCREEN_HEIGHT
+ #define GDISP_SCREEN_HEIGHT 480
+#endif
+#ifndef GDISP_SCREEN_WIDTH
+ #define GDISP_SCREEN_WIDTH 640
+#endif
+
+#define GDISP_FLG_READY (GDISP_FLG_DRIVER<<0)
+
+#if GINPUT_NEED_MOUSE
+ /* Include mouse support code */
+ #include "ginput/lld/mouse.h"
+#endif
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static bool_t initdone;
+static Display *dis;
+static int scr;
+static XEvent evt;
+static Colormap cmap;
+static XVisualInfo vis;
+static XContext cxt;
+#if GINPUT_NEED_MOUSE
+ coord_t mousex, mousey;
+ uint16_t mousebuttons;
+#endif
+
+typedef struct xPriv {
+ Pixmap pix;
+ GC gc;
+ Window win;
+} xPriv;
+
+static void ProcessEvent(GDisplay *g, xPriv *priv) {
+ switch(evt.type) {
+ case MapNotify:
+ XSelectInput(dis, evt.xmap.window, StructureNotifyMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
+ g->flags |= GDISP_FLG_READY;
+ break;
+ case UnmapNotify:
+ XCloseDisplay(dis);
+ exit(0);
+ break;
+ case Expose:
+ XCopyArea(dis, priv->pix, evt.xexpose.window, priv->gc,
+ evt.xexpose.x, evt.xexpose.y,
+ evt.xexpose.width, evt.xexpose.height,
+ evt.xexpose.x, evt.xexpose.y);
+ break;
+#if GINPUT_NEED_MOUSE
+ case ButtonPress:
+ mousex = evt.xbutton.x;
+ mousey = evt.xbutton.y;
+ switch(evt.xbutton.button){
+ case 1: mousebuttons |= GINPUT_MOUSE_BTN_LEFT; break;
+ case 2: mousebuttons |= GINPUT_MOUSE_BTN_MIDDLE; break;
+ case 3: mousebuttons |= GINPUT_MOUSE_BTN_RIGHT; break;
+ case 4: mousebuttons |= GINPUT_MOUSE_BTN_4; break;
+ }
+ #if GINPUT_MOUSE_POLL_PERIOD == TIME_INFINITE
+ ginputMouseWakeup();
+ #endif
+ break;
+ case ButtonRelease:
+ mousex = evt.xbutton.x;
+ mousey = evt.xbutton.y;
+ switch(evt.xbutton.button){
+ case 1: mousebuttons &= ~GINPUT_MOUSE_BTN_LEFT; break;
+ case 2: mousebuttons &= ~GINPUT_MOUSE_BTN_MIDDLE; break;
+ case 3: mousebuttons &= ~GINPUT_MOUSE_BTN_RIGHT; break;
+ case 4: mousebuttons &= ~GINPUT_MOUSE_BTN_4; break;
+ }
+ #if GINPUT_MOUSE_POLL_PERIOD == TIME_INFINITE
+ ginputMouseWakeup();
+ #endif
+ break;
+ case MotionNotify:
+ mousex = evt.xmotion.x;
+ mousey = evt.xmotion.y;
+ #if GINPUT_MOUSE_POLL_PERIOD == TIME_INFINITE
+ ginputMouseWakeup();
+ #endif
+ break;
+#endif
+ }
+}
+
+/* this is the X11 thread which keeps track of all events */
+static DECLARE_THREAD_STACK(waXThread, 1024);
+static DECLARE_THREAD_FUNCTION(ThreadX, arg) {
+ GDisplay *g;
+ (void)arg;
+
+ while(1) {
+ gfxSleepMilliseconds(100);
+ while(XPending(dis)) {
+ XNextEvent(dis, &evt);
+ XFindContext(evt.xany.display, evt.xany.window, cxt, (XPointer*)&g);
+ ProcessEvent(g, (xPriv *)g->priv);
+ }
+ }
+ return 0;
+}
+
+static int FatalXIOError(Display *d) {
+ (void) d;
+
+ /* The window has closed */
+ fprintf(stderr, "GFX Window closed!\n");
+ exit(0);
+}
+
+LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
+ XSizeHints *pSH;
+ XSetWindowAttributes xa;
+ XTextProperty WindowTitle;
+ char * WindowTitleText;
+ xPriv *priv;
+
+ if (!initdone) {
+ gfxThreadHandle hth;
+
+ initdone = TRUE;
+ #if GFX_USE_OS_LINUX || GFX_USE_OS_OSX
+ XInitThreads();
+ #endif
+
+ dis = XOpenDisplay(NULL);
+ scr = DefaultScreen(dis);
+ cxt = XUniqueContext();
+ XSetIOErrorHandler(FatalXIOError);
+
+ #if GDISP_FORCE_24BIT
+ if (!XMatchVisualInfo(dis, scr, 24, TrueColor, &vis)) {
+ fprintf(stderr, "Your display has no TrueColor mode\n");
+ XCloseDisplay(dis);
+ return FALSE;
+ }
+ cmap = XCreateColormap(dis, RootWindow(dis, scr),
+ vis.visual, AllocNone);
+ #else
+ vis.visual = CopyFromParent;
+ vis.depth = DefaultDepth(dis, scr);
+ cmap = DefaultColormap(dis, scr);
+ #endif
+ fprintf(stderr, "Running GFX Window in %d bit color\n", vis.depth);
+
+ if (!(hth = gfxThreadCreate(waXThread, sizeof(waXThread), HIGH_PRIORITY, ThreadX, 0))) {
+ fprintf(stderr, "Cannot start X Thread\n");
+ XCloseDisplay(dis);
+ exit(0);
+ }
+ #if GFX_USE_OS_LINUX || GFX_USE_OS_OSX
+ pthread_detach(hth);
+ #endif
+ gfxThreadClose(hth);
+ }
+
+ g->priv = gfxAlloc(sizeof(xPriv));
+ priv = (xPriv *)g->priv;
+ g->board = 0; // No board interface for this driver
+
+ xa.colormap = cmap;
+ xa.border_pixel = 0xFFFFFF;
+ xa.background_pixel = 0x000000;
+
+ priv->win = XCreateWindow(dis, RootWindow(dis, scr), 16, 16,
+ GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT,
+ 0, vis.depth, InputOutput, vis.visual,
+ CWBackPixel|CWColormap|CWBorderPixel, &xa);
+ XSync(dis, TRUE);
+
+ XSaveContext(dis, priv->win, cxt, (XPointer)g);
+
+ {
+ char buf[132];
+ sprintf(buf, "uGFX - %u", g->systemdisplay+1);
+ WindowTitleText = buf;
+ XStringListToTextProperty(&WindowTitleText, 1, &WindowTitle);
+ XSetWMName(dis, priv->win, &WindowTitle);
+ XSetWMIconName(dis, priv->win, &WindowTitle);
+ XSync(dis, TRUE);
+ }
+
+ pSH = XAllocSizeHints();
+ pSH->flags = PSize | PMinSize | PMaxSize;
+ pSH->min_width = pSH->max_width = pSH->base_width = GDISP_SCREEN_WIDTH;
+ pSH->min_height = pSH->max_height = pSH->base_height = GDISP_SCREEN_HEIGHT;
+ XSetWMNormalHints(dis, priv->win, pSH);
+ XFree(pSH);
+ XSync(dis, TRUE);
+
+ priv->pix = XCreatePixmap(dis, priv->win,
+ GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT, vis.depth);
+ XSync(dis, TRUE);
+
+ priv->gc = XCreateGC(dis, priv->win, 0, 0);
+ XSetBackground(dis, priv->gc, BlackPixel(dis, scr));
+ XSync(dis, TRUE);
+
+ XSelectInput(dis, priv->win, StructureNotifyMask);
+ XMapWindow(dis, priv->win);
+
+ // Wait for the window creation to complete (for safety)
+ while(!(((volatile GDisplay *)g)->flags & GDISP_FLG_READY))
+ gfxSleepMilliseconds(100);
+
+ /* Initialise the GDISP structure to match */
+ g->g.Orientation = GDISP_ROTATE_0;
+ g->g.Powermode = powerOn;
+ g->g.Backlight = 100;
+ g->g.Contrast = 50;
+ g->g.Width = GDISP_SCREEN_WIDTH;
+ g->g.Height = GDISP_SCREEN_HEIGHT;
+ return TRUE;
+}
+
+LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g)
+{
+ xPriv * priv = (xPriv *)g->priv;
+ XColor col;
+
+ col.red = RED_OF(g->p.color) << 8;
+ col.green = GREEN_OF(g->p.color) << 8;
+ col.blue = BLUE_OF(g->p.color) << 8;
+ XAllocColor(dis, cmap, &col);
+ XSetForeground(dis, priv->gc, col.pixel);
+ XDrawPoint(dis, priv->pix, priv->gc, (int)g->p.x, (int)g->p.y );
+ XDrawPoint(dis, priv->win, priv->gc, (int)g->p.x, (int)g->p.y );
+ XFlush(dis);
+}
+
+#if GDISP_HARDWARE_FILLS
+ LLDSPEC void gdisp_lld_fill_area(GDisplay *g) {
+ xPriv * priv = (xPriv *)g->priv;
+ XColor col;
+
+ col.red = RED_OF(g->p.color) << 8;
+ col.green = GREEN_OF(g->p.color) << 8;
+ col.blue = BLUE_OF(g->p.color) << 8;
+ XAllocColor(dis, cmap, &col);
+ XSetForeground(dis, priv->gc, col.pixel);
+ XFillRectangle(dis, priv->pix, priv->gc, g->p.x, g->p.y, g->p.cx, g->p.cy);
+ XFillRectangle(dis, priv->win, priv->gc, g->p.x, g->p.y, g->p.cx, g->p.cy);
+ XFlush(dis);
+ }
+#endif
+
+#if 0 && GDISP_HARDWARE_BITFILLS
+ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
+ // Start of Bitblit code
+
+ //XImage bitmap;
+ //pixel_t *bits;
+ // bits = malloc(vis.depth * GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT);
+ // bitmap = XCreateImage(dis, vis, vis.depth, ZPixmap,
+ // 0, bits, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT,
+ // 0, 0);
+ }
+#endif
+
+#if GDISP_HARDWARE_PIXELREAD
+ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
+ xPriv * priv = (xPriv *)g->priv;
+ XColor color;
+ XImage *img;
+
+ img = XGetImage (dis, priv->pix, g->p.x, g->p.y, 1, 1, AllPlanes, XYPixmap);
+ color.pixel = XGetPixel (img, 0, 0);
+ XFree(img);
+ XQueryColor(dis, cmap, &color);
+ return RGB2COLOR(color.red>>8, color.green>>8, color.blue>>8);
+ }
+#endif
+
+#if GDISP_NEED_SCROLL && GDISP_HARDWARE_SCROLL
+ LLDSPEC void gdisp_lld_vertical_scroll(GDisplay *g) {
+ xPriv * priv = (xPriv *)g->priv;
+
+ if (g->p.y1 > 0) {
+ XCopyArea(dis, priv->pix, priv->pix, priv->gc, g->p.x, g->p.y+g->p.y1, g->p.cx, g->p.cy-g->p.y1, g->p.x, g->p.y);
+ XCopyArea(dis, priv->pix, priv->win, priv->gc, g->p.x, g->p.y, g->p.cx, g->p.cy-g->p.y1, g->p.x, g->p.y);
+ } else {
+ XCopyArea(dis, priv->pix, priv->pix, priv->gc, g->p.x, g->p.y, g->p.cx, g->p.cy+g->p.y1, g->p.x, g->p.y-g->p.y1);
+ XCopyArea(dis, priv->pix, priv->win, priv->gc, g->p.x, g->p.y-g->p.y1, g->p.cx, g->p.cy+g->p.y1, g->p.x, g->p.y-g->p.y1);
+ }
+ }
+#endif
+
+#if GINPUT_NEED_MOUSE
+
+ void ginput_lld_mouse_init(void) {}
+
+ void ginput_lld_mouse_get_reading(MouseReading *pt) {
+ pt->x = mousex;
+ pt->y = mousey;
+ pt->z = (mousebuttons & GINPUT_MOUSE_BTN_LEFT) ? 100 : 0;
+ pt->buttons = mousebuttons;
+ }
+
+#endif /* GINPUT_NEED_MOUSE */
+
+#endif /* GFX_USE_GDISP */
+/** @} */
+
diff --git a/drivers/multiple/X/gdisp_lld_config.h b/drivers/multiple/X/gdisp_lld_config.h
index 0cacc4f8..631ecf46 100644
--- a/drivers/multiple/X/gdisp_lld_config.h
+++ b/drivers/multiple/X/gdisp_lld_config.h
@@ -22,20 +22,14 @@
/* Driver hardware support. */
/*===========================================================================*/
-#define GDISP_DRIVER_NAME "Linux emulator - X11"
-
-#define GDISP_HARDWARE_CLEARS FALSE
+#define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_FILLS TRUE
#define GDISP_HARDWARE_BITFILLS FALSE
-#define GDISP_HARDWARE_SCROLL FALSE
-#define GDISP_HARDWARE_PIXELREAD FALSE
+#define GDISP_HARDWARE_SCROLL TRUE
+#define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL FALSE
-#define GDISP_HARDWARE_CIRCLES FALSE
-#define GDISP_HARDWARE_CIRCLEFILLS FALSE
-#define GDISP_HARDWARE_ARCS FALSE
-#define GDISP_HARDWARE_ARCFILLS FALSE
-#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
+#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
#endif /* GFX_USE_GDISP */