-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tinyx: add xeyes, xclock, xedit, twm ports
xedit displays correctly and seems to be functional (reads files, UI is responsive), but there's an issue with input capture, so editing capabilities are currently limited JIRA: RTOS-889
- Loading branch information
1 parent
046fc99
commit 6fff19f
Showing
7 changed files
with
410 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
diff -ruN a/kdrive/fbdev/fbdev.c b/kdrive/fbdev/fbdev.c | ||
--- a/kdrive/fbdev/fbdev.c 2024-08-19 09:44:57.484385862 +0200 | ||
+++ b/kdrive/fbdev/fbdev.c 2024-08-19 09:57:33.218184783 +0200 | ||
@@ -28,6 +28,15 @@ | ||
#include <sys/ioctl.h> | ||
|
||
#include <errno.h> | ||
+#include <pthread.h> | ||
+ | ||
+void refresher(void *arg) { | ||
+ graph_t* g = (graph_t*) arg; | ||
+ while (1) { | ||
+ usleep(33333); // ~30Hz | ||
+ graph_commit(g); | ||
+ } | ||
+} | ||
|
||
extern int KdTsPhyScreen; | ||
|
||
@@ -92,7 +101,7 @@ | ||
FatalError("failed to initialize graphics adapter: %s", strerror(k)); | ||
} | ||
|
||
- if ((k = graph_mode(&priv->g, GRAPH_DEFMODE, GRAPH_DEFFREQ)) < 0) { | ||
+ if ((k = graph_mode(&priv->g, GRAPH_DEFMODE, GRAPH_30Hz)) < 0) { | ||
FatalError("failed to set graphics mode: %d", k); | ||
} | ||
|
||
@@ -100,6 +109,10 @@ | ||
FatalError(stderr, "32-bit video resolution required"); | ||
} | ||
|
||
+ pthread_t thread; | ||
+ | ||
+ pthread_create(&thread, NULL, (void*) refresher, &priv->g); | ||
+ | ||
priv->fb = priv->g.data; | ||
|
||
priv->g.height = priv->g.height; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
diff -ruN a/kdrive/fbdev/fbdev.c b/kdrive/fbdev/fbdev.c | ||
--- a/kdrive/fbdev/fbdev.c 2024-08-21 13:07:32.038968445 +0200 | ||
+++ b/kdrive/fbdev/fbdev.c 2024-08-21 12:26:44.467523732 +0200 | ||
@@ -28,6 +28,15 @@ | ||
#include <sys/ioctl.h> | ||
|
||
#include <errno.h> | ||
+#include <pthread.h> | ||
+ | ||
+void refresher(void *arg) { | ||
+ graph_t* g = (graph_t*) arg; | ||
+ while (1) { | ||
+ usleep(12588); // ~70Hz | ||
+ graph_commit(g); | ||
+ } | ||
+} | ||
|
||
extern int KdTsPhyScreen; | ||
|
||
@@ -80,7 +89,6 @@ | ||
|
||
int k; | ||
|
||
- priv->bits_per_pixel = 32; | ||
priv->smem_len = 0x2000; | ||
|
||
if ((k = graph_init()) < 0) { | ||
@@ -92,15 +100,16 @@ | ||
FatalError("failed to initialize graphics adapter: %s", strerror(k)); | ||
} | ||
|
||
- if ((k = graph_mode(&priv->g, GRAPH_DEFMODE, GRAPH_DEFFREQ)) < 0) { | ||
+ if ((k = graph_mode(&priv->g, GRAPH_DEFMODE, GRAPH_70Hz)) < 0) { | ||
FatalError("failed to set graphics mode: %d", k); | ||
} | ||
|
||
- if (priv->g.depth != 4) { | ||
- FatalError(stderr, "32-bit video resolution required"); | ||
- } | ||
+ pthread_t thread; | ||
+ | ||
+ pthread_create(&thread, NULL, (void*) refresher, &priv->g); | ||
|
||
priv->fb = priv->g.data; | ||
+ priv->bits_per_pixel = priv->g.depth * 8; | ||
|
||
priv->g.height = priv->g.height; | ||
priv->g.width = priv->g.width; | ||
@@ -316,22 +325,22 @@ | ||
FbdevPriv *priv = screen->card->driver; | ||
int depth = priv->bits_per_pixel; | ||
|
||
- screen->width = 640; | ||
- screen->height = 400; | ||
+ screen->width = priv->g.width; | ||
+ screen->height = priv->g.height; | ||
screen->rate = 30; | ||
screen->fb.depth = depth; | ||
|
||
- depth = priv->bits_per_pixel; | ||
- | ||
/* Calculate line_length if it's zero */ | ||
if (!priv->line_length) | ||
priv->line_length = (priv->g.width * depth + 7) / 8; | ||
|
||
screen->fb.visuals = (1 << TrueColor); | ||
+ | ||
#define Mask(o,l) (((1 << l) - 1) << o) | ||
- screen->fb.redMask = Mask(16,8); | ||
- screen->fb.greenMask = Mask(8,8); | ||
- screen->fb.blueMask = Mask(0,8); | ||
+ int offset = depth / 4; | ||
+ screen->fb.redMask = Mask(offset * 2, offset); | ||
+ screen->fb.greenMask = Mask(offset * 1, offset); | ||
+ screen->fb.blueMask = Mask(0,offset); | ||
screen->fb.bitsPerPixel = priv->bits_per_pixel; | ||
|
||
return fbdevMapFramebuffer(screen); |
24 changes: 24 additions & 0 deletions
24
tinyx/patches/tinyxlib/9862f3/18-Xtranssock-dontwait.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff -ruN a/libxtrans/Xtranssock.c b/libxtrans/Xtranssock.c | ||
--- a/libxtrans/Xtranssock.c 2024-08-05 09:04:38.631732705 +0200 | ||
+++ b/libxtrans/Xtranssock.c 2024-08-21 17:11:03.820006544 +0200 | ||
@@ -1547,11 +1547,17 @@ | ||
{ | ||
/* this bufsize doesn't really matter, but using recv() as a replacement | ||
* for ioctl/FIONREAD is quite slow | ||
- * TODO implement ioctl/FIONREAD in phoenix kernel */ | ||
+ * Maybe implement ioctl/FIONREAD in phoenix kernel? */ | ||
#define BUFSIZE 64 | ||
static char buf[BUFSIZE]; | ||
- *pend = recv(ciptr->fd, buf, BUFSIZE, MSG_PEEK); | ||
- if (pend < 0) return -1; | ||
+ int k = recv(ciptr->fd, buf, BUFSIZE, MSG_PEEK | MSG_DONTWAIT); | ||
+ if (k < 0) { | ||
+ if (errno == EWOULDBLOCK || errno == EAGAIN) | ||
+ k = 0; | ||
+ else | ||
+ return -1; | ||
+ } | ||
+ *pend = k; | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
diff -ruN a/configure.ac b/configure.ac | ||
--- a/configure.ac 2022-04-02 20:36:49.000000000 +0200 | ||
+++ b/configure.ac 2024-08-20 10:45:57.220251974 +0200 | ||
@@ -50,10 +50,6 @@ | ||
|
||
# Checks for pkg-config packages | ||
PKG_CHECK_MODULES([TWM], [x11 xext xt xmu ice sm xproto >= 7.0.17]) | ||
-PKG_CHECK_MODULES([XRANDR], [xrandr], [have_xrandr=yes], [have_xrandr=no]) | ||
-if test "$have_xrandr" = yes; then | ||
- AC_DEFINE([HAVE_XRANDR], [1], [Define to 1 if you have the xrandr headers/libraries]) | ||
-fi | ||
|
||
AC_CONFIG_FILES([Makefile | ||
src/Makefile | ||
diff -ruN a/src/menus.c b/src/menus.c | ||
--- a/src/menus.c 2022-04-02 20:36:49.000000000 +0200 | ||
+++ b/src/menus.c 2024-08-20 10:53:18.394309064 +0200 | ||
@@ -79,7 +79,9 @@ | ||
#include "session.h" | ||
#include <X11/Xmu/CharSet.h> | ||
#include "version.h" | ||
-#include <X11/extensions/sync.h> | ||
+#include <X11/Xmd.h> | ||
+#include <X11/extensions/syncconst.h> | ||
+#include <X11/extensions/syncstr.h> | ||
#include <X11/SM/SMlib.h> | ||
|
||
int RootFunction = 0; | ||
@@ -1906,6 +1908,7 @@ | ||
Bell(XkbBI_MinorError, 0, tmp_win->w); | ||
break; | ||
|
||
+#if 0 | ||
case F_CIRCLEUP: | ||
XCirculateSubwindowsUp(dpy, Scr->Root); | ||
break; | ||
@@ -1913,6 +1916,7 @@ | ||
case F_CIRCLEDOWN: | ||
XCirculateSubwindowsDown(dpy, Scr->Root); | ||
break; | ||
+#endif | ||
|
||
case F_EXEC: | ||
PopDownMenu(); | ||
diff -ruN a/src/parse.c b/src/parse.c | ||
--- a/src/parse.c 2022-04-02 20:36:49.000000000 +0200 | ||
+++ b/src/parse.c 2024-08-20 10:48:18.826964856 +0200 | ||
@@ -69,8 +69,10 @@ | ||
#include "gram.h" | ||
#include "parse.h" | ||
|
||
+#include <X11/Xmd.h> | ||
#include <X11/Xatom.h> | ||
-#include <X11/extensions/sync.h> | ||
+#include <X11/extensions/syncconst.h> | ||
+#include <X11/extensions/syncstr.h> | ||
|
||
#ifndef SYSTEM_INIT_FILE | ||
#define SYSTEM_INIT_FILE "/usr/lib/X11/twm/system.twmrc" | ||
diff -ruN a/src/twm.c b/src/twm.c | ||
--- a/src/twm.c 2022-04-02 20:36:49.000000000 +0200 | ||
+++ b/src/twm.c 2024-08-20 10:53:07.850111898 +0200 | ||
@@ -81,7 +81,9 @@ | ||
#include <X11/Xatom.h> | ||
#include <X11/SM/SMlib.h> | ||
#include <X11/Xmu/Error.h> | ||
-#include <X11/extensions/sync.h> | ||
+#include <X11/Xmd.h> | ||
+#include <X11/extensions/syncstr.h> | ||
+#include <X11/extensions/syncconst.h> | ||
#include <X11/Xlocale.h> | ||
|
||
#ifdef XPRINT |
Oops, something went wrong.