qemacs: Update patch

* remove commented out win32 code
* override default res path to allow finding config file
in ~/config/settings/qemacs
This commit is contained in:
François Revol
2013-03-13 14:31:47 +00:00
parent dcbff32a75
commit 43eb4cf39b

View File

@@ -4,7 +4,7 @@ RCS file: /sources/qemacs/qemacs/Makefile,v
retrieving revision 1.50
diff -u -r1.50 Makefile
--- Makefile 5 Jun 2008 07:14:12 -0000 1.50
+++ Makefile 12 Mar 2013 14:45:26 -0000
+++ Makefile 13 Mar 2013 14:27:53 -0000
@@ -63,7 +63,7 @@
endif
@@ -61,7 +61,7 @@ RCS file: /sources/qemacs/qemacs/cfb.c,v
retrieving revision 1.8
diff -u -r1.8 cfb.c
--- cfb.c 8 Apr 2008 06:55:44 -0000 1.8
+++ cfb.c 12 Mar 2013 14:45:26 -0000
+++ cfb.c 13 Mar 2013 14:27:53 -0000
@@ -50,7 +50,7 @@
static void cfb16_fill_rectangle(QEditScreen *s,
int x1, int y1, int w, int h, QEColor color)
@@ -122,7 +122,7 @@ RCS file: /sources/qemacs/qemacs/configure,v
retrieving revision 1.15
diff -u -r1.15 configure
--- configure 17 Apr 2008 15:06:44 -0000 1.15
+++ configure 12 Mar 2013 14:45:26 -0000
+++ configure 13 Mar 2013 14:27:53 -0000
@@ -45,9 +45,11 @@
ptsname="yes"
gprof="no"
@@ -207,7 +207,7 @@ RCS file: /sources/qemacs/qemacs/display.h,v
retrieving revision 1.11
diff -u -r1.11 display.h
--- display.h 11 Jan 2008 11:29:28 -0000 1.11
+++ display.h 12 Mar 2013 14:45:26 -0000
+++ display.h 13 Mar 2013 14:27:53 -0000
@@ -53,7 +53,7 @@
int refcount;
int ascent;
@@ -232,7 +232,7 @@ RCS file: /sources/qemacs/qemacs/fbfrender.c,v
retrieving revision 1.10
diff -u -r1.10 fbfrender.c
--- fbfrender.c 8 Jan 2008 16:37:54 -0000 1.10
+++ fbfrender.c 12 Mar 2013 14:45:26 -0000
+++ fbfrender.c 13 Mar 2013 14:27:54 -0000
@@ -124,7 +124,7 @@
static GlyphCache *fbf_decode_glyph1(QEFont *font, int code)
@@ -257,7 +257,7 @@ RCS file: /sources/qemacs/qemacs/html2png.c,v
retrieving revision 1.12
diff -u -r1.12 html2png.c
--- html2png.c 11 Jan 2008 11:29:28 -0000 1.12
+++ html2png.c 12 Mar 2013 14:45:26 -0000
+++ html2png.c 13 Mar 2013 14:27:54 -0000
@@ -135,7 +135,7 @@
/* realloc ppm bitmap */
static int ppm_resize(QEditScreen *s, int w, int h)
@@ -319,7 +319,7 @@ RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.96
diff -u -r1.96 qe.h
--- qe.h 4 May 2008 15:54:39 -0000 1.96
+++ qe.h 12 Mar 2013 14:45:28 -0000
+++ qe.h 13 Mar 2013 14:27:55 -0000
@@ -267,11 +267,11 @@
int ustristart(const unsigned int *str, const char *val, const unsigned int **ptr);
static inline unsigned int *umemmove(unsigned int *dest,
@@ -340,7 +340,7 @@ RCS file: /sources/qemacs/qemacs/tty.c,v
retrieving revision 1.50
diff -u -r1.50 tty.c
--- tty.c 23 Apr 2008 15:30:33 -0000 1.50
+++ tty.c 12 Mar 2013 14:45:28 -0000
+++ tty.c 13 Mar 2013 14:27:56 -0000
@@ -118,7 +118,7 @@
tty_screen = s;
@@ -436,7 +436,7 @@ RCS file: /sources/qemacs/qemacs/win32.c,v
retrieving revision 1.15
diff -u -r1.15 win32.c
--- win32.c 23 Apr 2008 15:29:35 -0000 1.15
+++ win32.c 12 Mar 2013 14:45:29 -0000
+++ win32.c 13 Mar 2013 14:27:56 -0000
@@ -139,7 +139,7 @@
if (!_hPrev)
init_application();
@@ -461,7 +461,7 @@ RCS file: /sources/qemacs/qemacs/x11.c,v
retrieving revision 1.28
diff -u -r1.28 x11.c
--- x11.c 15 Apr 2008 23:24:04 -0000 1.28
+++ x11.c 12 Mar 2013 14:45:29 -0000
+++ x11.c 13 Mar 2013 14:27:56 -0000
@@ -194,7 +194,7 @@
QEStyleDef default_style;
XGCValues gc_val;
@@ -566,9 +566,9 @@ diff -u -r1.28 x11.c
l = q - x11_str;
XSetFont(display, gc, xfont->fid);
XDrawString16(display, dbuffer, gc, x_start, y, x11_str, l);
--- /dev/null 2013-03-12 16:43:58.197398000 +0100
+++ haiku.cpp 2013-03-12 06:53:41.158859264 +0100
@@ -0,0 +1,874 @@
--- /dev/null 2013-03-13 15:41:16.406936000 +0100
+++ haiku.cpp 2013-03-13 15:14:35.549191680 +0100
@@ -0,0 +1,680 @@
+/*
+ * Haiku driver for QEmacs
+ * Copyright (c) 2013 François Revol.
@@ -596,8 +596,10 @@ diff -u -r1.28 x11.c
+}
+
+#include <Application.h>
+#include <FindDirectory.h>
+#include <Font.h>
+#include <InterfaceDefs.h>
+#include <Path.h>
+#include <Region.h>
+#include <String.h>
+#include <View.h>
@@ -890,215 +892,6 @@ diff -u -r1.28 x11.c
+ return 0;
+}
+
+#if 0
+static void push_event(QEEvent *ev)
+{
+ QEEventQ *e;
+
+ e = malloc(sizeof(QEEventQ));
+ if (!e)
+ return;
+ e->ev = *ev;
+ e->next = NULL;
+ if (!last_event)
+ first_event = e;
+ else
+ last_event->next = e;
+ last_event = e;
+}
+
+static void push_key(int key)
+{
+ QEEvent ev;
+ ev.type = QE_KEY_EVENT;
+ ev.key_event.key = key;
+ push_event(&ev);
+}
+
+static int ignore_wchar_msg = 0;
+
+LRESULT CALLBACK qe_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ // printf("msg=%d\n", msg);
+ switch (msg) {
+ case WM_CREATE:
+ /* NOTE: must store them here to avoid problems in main */
+ haiku_ctx.w = hWnd;
+ return 0;
+
+ /* key handling */
+ case WM_CHAR:
+ if (!ignore_wchar_msg) {
+ push_key(wParam);
+ } else {
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+ }
+ break;
+ case WM_SYSCHAR:
+ if (!ignore_wchar_msg) {
+ int key;
+ key = wParam;
+ if (key >= ' ' && key <= '~') {
+ key = KEY_META(' ') + key - ' ';
+ push_key(key);
+ break;
+ }
+ }
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+ case WM_SYSKEYDOWN:
+ case WM_KEYDOWN:
+ {
+ unsigned int scan;
+ int ctrl, shift, alt, key;
+
+ ctrl = (GetKeyState(VK_CONTROL) & 0x8000);
+ shift = (GetKeyState(VK_SHIFT) & 0x8000);
+ alt = (GetKeyState(VK_MENU) & 0x8000);
+
+ ignore_wchar_msg = 0;
+
+ scan = (unsigned int) ((lParam >> 16) & 0x1FF);
+ switch(scan) {
+ case 0x00E:
+ ignore_wchar_msg = 1;
+ push_key(KEY_BACKSPACE);
+ break;
+ case 0x039: /* space */
+ ignore_wchar_msg = 1;
+ if (!ctrl)
+ push_key(KEY_SPC);
+ else
+ push_key(KEY_CTRL('@'));
+ break;
+ case 0x147: /* home */
+ push_key(KEY_HOME);
+ break;
+ case 0x148: /* UP */
+ push_key(KEY_UP);
+ break;
+ case 0x149: /* PGUP */
+ push_key(KEY_PAGEUP);
+ break;
+ case 0x14B: /* LEFT */
+ push_key(KEY_LEFT);
+ break;
+ case 0x14D: /* RIGHT */
+ push_key(KEY_RIGHT);
+ break;
+ case 0x14F: /* END */
+ push_key(KEY_END);
+ break;
+ case 0x150: /* DOWN */
+ push_key(KEY_DOWN);
+ break;
+ case 0x151: /* PGDN */
+ push_key(KEY_PAGEDOWN);
+ break;
+ case 0x153: /* DEL */
+ push_key(KEY_DELETE);
+ break;
+ case 0x152: /* INSERT */
+ push_key(KEY_INSERT);
+ break;
+ case 0x3b: /* F1 */
+ case 0x3c:
+ case 0x3d:
+ case 0x3e:
+ case 0x3f:
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x57:
+ case 0x58: /* F12 */
+ key = scan - 0x3b;
+ if (key > 9)
+ key -= 0x12;
+ key += KEY_F1;
+ /* we leave Alt-F4 to close the window */
+ if (alt && key == KEY_F4)
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+ push_key(key);
+ break;
+
+ default:
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+ }
+ }
+ break;
+
+ case WM_KEYUP:
+ ignore_wchar_msg = 0;
+ break;
+
+ case WM_SYSKEYUP:
+ ignore_wchar_msg = 0;
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+
+ case WM_SIZE:
+ if (wParam != SIZE_MINIMIZED) {
+ QEmacsState *qs = &qe_state;
+ QEEvent ev;
+
+ qs->screen->width = LOWORD(lParam);
+ qs->screen->height = HIWORD(lParam);
+ ev.expose_event.type = QE_EXPOSE_EVENT;
+ push_event(&ev);
+ }
+ break;
+ case WM_PAINT:
+ {
+ PAINTSTRUCT ps;
+ HDC saved_hdc;
+ BeginPaint(haiku_ctx.w, &ps);
+ saved_hdc = haiku_ctx.hdc;
+ haiku_ctx.hdc = ps.hdc;
+ SelectObject(haiku_ctx.hdc, haiku_ctx.font);
+ do_refresh(NULL);
+
+ EndPaint(haiku_ctx.w, &ps);
+ haiku_ctx.hdc = saved_hdc;
+ }
+ break;
+
+ case WM_SETFOCUS:
+ case WM_KILLFOCUS:
+ break;
+
+ default:
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+ }
+ return 0;
+}
+
+static int get_unicode_key(QEditScreen *s, QEPollData *pd, QEEvent *ev)
+{
+ MSG msg;
+ QEEventQ *e;
+
+ for(;;) {
+ /* check if events queued */
+ if (first_event != NULL) {
+ e = first_event;
+ *ev = e->ev;
+ first_event = e->next;
+ if (!first_event)
+ last_event = NULL;
+ free(e);
+ break;
+ }
+
+ /* check if message queued */
+ if (GetMessage(&msg, NULL, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ return 1;
+}
+#endif
+
+/* called when an BMessage is forwarded. dispatch events to qe_handle_event() */
+static void haiku_handle_event(void *opaque)
+{
@@ -1438,6 +1231,19 @@ diff -u -r1.28 x11.c
+
+static int haiku_init(void)
+{
+ QEmacsState *qs = &qe_state;
+
+ /* override default res path, to find config file at native location */
+ BPath path;
+ BString old(":");
+ old << qs->res_path;
+ qs->res_path[0] = '\0';
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
+ path.Append("qemacs");
+ pstrcat(qs->res_path, sizeof(qs->res_path), path.Path());
+ }
+ pstrcat(qs->res_path, sizeof(qs->res_path), old.String());
+
+ qe_register_cmd_line_options(cmd_options);
+ return qe_register_display(&haiku_dpy);
+}