patch for some rxvt stuff
Jordan DeLong
fracture@allusion.net
Fri Jul 8 23:49:00 GMT 2005
Sorry if this is the wrong place to send this. I tried sending to the
rxvt guys at sf, and got no response.
Anyway; in case whoever maintains the cygwin port is listening, here's
some diffs...
--
Jordan DeLong
fracture@allusion.net
-------------- next part --------------
changes:
- libW11 support to change the cursor to a xterm cursor
- don't go into the menu-state when someone presses and then releases Alt
- don't close terminals when people hit the x button or alt+f4
- fix NT_get_state:
- allow using the VK_LWIN key as a meta key (people who use litestep
may want this, because they can turn off the windows menu popup crap).
- fix logic about control
- small tweak that makes inherit pixmap a *lot* faster (i.e. actually
usuable)
-------------- next part --------------
diff -ruN rxvt-dist/W11/w32/event.c rxvt/W11/w32/event.c
--- rxvt-dist/W11/w32/event.c 2005-04-04 20:24:49.000000000 -0500
+++ rxvt/W11/w32/event.c 2005-06-27 17:35:52.920411200 -0500
@@ -196,6 +196,18 @@
mask = window->mask;
switch (message) {
+ case WM_SYSKEYDOWN:
+ // Don't go into the menu mode for alt keys.
+ return 0L;
+ case WM_CLOSE:
+ // Never close when people hit the x button.
+ return 0L;
+ case WM_SETCURSOR:
+ if (window->cursor != INVALID_HANDLE) {
+ SetCursor(window->cursor);
+ return TRUE;
+ }
+ return NT_default(hWnd, message, wParam, lParam);
/* we'll handle these, later */
case WM_KILLFOCUS:
QEvent(wineventq,window,message,wParam,lParam);
@@ -203,7 +215,6 @@
break;
case WM_SETFOCUS:
case WM_QUIT:
- case WM_CLOSE:
case WM_DESTROY:
case WM_SYSCHAR: /* alt-keys go here */
case WM_CHAR:
@@ -352,13 +363,9 @@
{
unsigned int state = 0;
if (GetKeyState(VK_SHIFT) & 0x8000) state |= ShiftMask;
- if (GetKeyState(VK_CONTROL) & 0x8000)
- {
- if (!(GetKeyState(VK_MENU) & 0x8000))
- state |= ControlMask;
- }
- else if (GetKeyState(VK_MENU) & 0x8000)
- state |= Mod1Mask;
+ if (GetKeyState(VK_CONTROL) & 0x8000) state |= ControlMask;
+ if (GetKeyState(VK_MENU) & 0x8000) state |= Mod1Mask;
+ if (GetKeyState(VK_LWIN) & 0x8000) state |= Mod1Mask;
if (GetKeyState(VK_CAPITAL) & 0x0001) state |= LockMask;
if (GetKeyState(VK_NUMLOCK) & 0x0001) state |= Mod5Mask;
if (GetKeyState(VK_SCROLL) & 0x0001) state |= Mod3Mask;
diff -ruN rxvt-dist/W11/w32/ntdef.h rxvt/W11/w32/ntdef.h
--- rxvt-dist/W11/w32/ntdef.h 2002-12-03 23:21:30.000000000 -0600
+++ rxvt/W11/w32/ntdef.h 2005-06-27 17:15:22.154786200 -0500
@@ -35,6 +35,7 @@
HWND w;
HBRUSH bg;
int parentRelative;
+ HCURSOR cursor; /* cursor for this window */
struct NT_window *parent; /* parent of this window */
struct NT_window *next; /* next window in list */
struct NT_child *child; /* points to list of children */
diff -ruN rxvt-dist/W11/w32/ntutil.c rxvt/W11/w32/ntutil.c
--- rxvt-dist/W11/w32/ntutil.c 2002-12-03 23:21:30.000000000 -0600
+++ rxvt/W11/w32/ntutil.c 2005-06-27 17:17:07.826661200 -0500
@@ -38,6 +38,7 @@
new->parent= NULL;
new->hBitmap = INVALID_HANDLE;
new->hDC = INVALID_HANDLE;
+ new->cursor = INVALID_HANDLE;
window_list = new;
cjh_printf("NEW window %x\n",window_list);
return(window_list);
diff -ruN rxvt-dist/W11/w32/xlib.c rxvt/W11/w32/xlib.c
--- rxvt-dist/W11/w32/xlib.c 2004-01-05 23:51:12.000000000 -0600
+++ rxvt/W11/w32/xlib.c 2005-06-27 17:32:46.217286200 -0500
@@ -2914,7 +2914,11 @@
unsigned int shape;
{
xtrace("XCreateFontCursor\n");
- return 0;
+ if (shape == XC_xterm ||
+ shape == XC_left_ptr ||
+ shape == 0)
+ return shape;
+ return -1;
}
@@ -4239,9 +4243,23 @@
xtrace("XSetWMProperties\n");
XSetNormalHints(display,w,normal_hints);
}
+
+int
XDefineCursor(Display* display,Window w,Cursor cursor)
{
+ NT_window *ntw=(NT_window *)w;
+ LPCTSTR csr;
+
xtrace("XDefineCursor\n");
+
+ switch (cursor) {
+ case XC_xterm: csr = IDC_IBEAM; break;
+ case XC_left_ptr: csr = IDC_ARROW; break;
+ default:
+ return 0;
+ }
+
+ ntw->cursor = LoadCursor(NULL, csr);
return 0;
}
diff -ruN rxvt-dist/src/command.c rxvt/src/command.c
--- rxvt-dist/src/command.c 2005-06-29 15:49:56.066384100 -0500
+++ rxvt/src/command.c 2005-06-29 16:51:00.003884100 -0500
@@ -1921,6 +1921,14 @@
} else {
/* wait (an arbitrary period) for the WM to do its thing
* needed for fvwm2.2.2 (and before?) */
+#ifndef __CYGWIN__
+ /*
+ * JRD: this waits a whole second any time you move a
+ * window on cygwin (because it sends *lots* of a
+ * configure notifies, unlike a reparenting x11 window
+ * manager). Needless to say, this *sucks*, so turn it
+ * off.
+ */
# ifdef HAVE_NANOSLEEP
struct timespec rqt;
@@ -1930,6 +1938,7 @@
# else
sleep(1);
# endif
+#endif
D_X((stderr, "InheritPixmap Turning on (%d parents)", i - 1));
for (n = 0; n < (unsigned int)i; n++)
XSetWindowBackgroundPixmap(r->Xdisplay, r->TermWin.parent[n],
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050708/b5f4881b/attachment.sig>
More information about the Cygwin
mailing list