Use an I-beam cursor for text. - sam - An updated version of the sam text edito… | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 5b680483799488bdcf83883a5caebe30cba28810 | |
parent fa53aa4932f59b993ea618d5f39c33ff4165d85a | |
Author: Rob King <[email protected]> | |
Date: Fri, 23 Jun 2017 09:54:28 -0500 | |
Use an I-beam cursor for text. | |
Diffstat: | |
include/libg.h | 1 + | |
libXg/cursorswitch.c | 5 ++++- | |
libXg/menuhit.c | 6 +++++- | |
3 files changed, 10 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/include/libg.h b/include/libg.h | |
@@ -16,6 +16,7 @@ enum{ EMAXMSG = 128+8192 }; /* max event size */ | |
enum{ | |
DefaultCursor, | |
+ ArrowCursor, | |
BullseyeCursor, | |
SweepCursor, | |
DeadCursor, | |
diff --git a/libXg/cursorswitch.c b/libXg/cursorswitch.c | |
@@ -7,6 +7,7 @@ | |
extern Window _topwindow; | |
+static Cursor arrow; | |
static Cursor sweep; | |
static Cursor crosshair; | |
static Cursor pirate; | |
@@ -19,6 +20,7 @@ cursorswitch(unsigned int c) | |
Cursor i = defcursor; | |
switch (c){ | |
+ case ArrowCursor: i = arrow; break; | |
case SweepCursor: i = sweep; break; | |
case BullseyeCursor: i = crosshair; break; | |
case DeadCursor: i = pirate; break; | |
@@ -36,6 +38,7 @@ initcursors(void) | |
crosshair = XCreateFontCursor(_dpy, XC_crosshair); | |
pirate = XCreateFontCursor(_dpy, XC_pirate); | |
watch = XCreateFontCursor(_dpy, XC_watch); | |
- defcursor = XCreateFontCursor(_dpy, XC_left_ptr); | |
+ arrow = XCreateFontCursor(_dpy, XC_left_ptr); | |
+ defcursor = XCreateFontCursor(_dpy, XC_xterm); | |
} | |
diff --git a/libXg/menuhit.c b/libXg/menuhit.c | |
@@ -123,7 +123,10 @@ menuhit(int but, Mouse *m, Menu *menu) | |
Bitmap *b; | |
Point pt; | |
char *item; | |
+ extern unsigned int cursor; | |
+ unsigned int oldcursor = cursor; | |
+ cursorswitch(ArrowCursor); | |
sc = screen.clipr; | |
clipr(&screen, screen.r); | |
maxwid = 0; | |
@@ -222,7 +225,8 @@ menuhit(int but, Mouse *m, Menu *menu) | |
clipr(&screen, sc); | |
if(lasti >= 0){ | |
menu->lasthit = lasti+off; | |
- return menu->lasthit; | |
+ return cursorswitch(oldcursor), menu->lasthit; | |
} | |
+ cursorswitch(oldcursor); | |
return -1; | |
} |