mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 23:42:15 +08:00
- Fixed keyboard shortcut handling in FLUID and shortcut
labeling in FLTK (STR #1129) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4727 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -3,6 +3,8 @@ CHANGES IN FLTK 1.1.7
|
|||||||
- Documentation fixes (STR #571, STR #648, STR #692, STR
|
- Documentation fixes (STR #571, STR #648, STR #692, STR
|
||||||
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
|
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
|
||||||
STR #969)
|
STR #969)
|
||||||
|
- Fixed keyboard shortcut handling in FLUID and shortcut
|
||||||
|
labeling in FLTK (STR #1129)
|
||||||
- Fixed include path for CMake build (STR #1123)
|
- Fixed include path for CMake build (STR #1123)
|
||||||
- Fixed unnecessary delay in WIN32 event handling
|
- Fixed unnecessary delay in WIN32 event handling
|
||||||
(STR #1104)
|
(STR #1104)
|
||||||
|
|||||||
@@ -534,6 +534,10 @@ int Shortcut_Button::handle(int e) {
|
|||||||
if (!value()) return 0;
|
if (!value()) return 0;
|
||||||
int v = Fl::event_text()[0];
|
int v = Fl::event_text()[0];
|
||||||
if (v > 32 && v < 0x7f || v > 0xa0 && v <= 0xff) {
|
if (v > 32 && v < 0x7f || v > 0xa0 && v <= 0xff) {
|
||||||
|
if (isupper(v)) {
|
||||||
|
v = tolower(v);
|
||||||
|
v |= FL_SHIFT;
|
||||||
|
}
|
||||||
v = v | Fl::event_state()&(FL_META|FL_ALT|FL_CTRL);
|
v = v | Fl::event_state()&(FL_META|FL_ALT|FL_CTRL);
|
||||||
} else {
|
} else {
|
||||||
v = Fl::event_state()&(FL_META|FL_ALT|FL_CTRL|FL_SHIFT) | Fl::event_key();
|
v = Fl::event_state()&(FL_META|FL_ALT|FL_CTRL|FL_SHIFT) | Fl::event_key();
|
||||||
|
|||||||
@@ -54,6 +54,13 @@
|
|||||||
int Fl::test_shortcut(int shortcut) {
|
int Fl::test_shortcut(int shortcut) {
|
||||||
if (!shortcut) return 0;
|
if (!shortcut) return 0;
|
||||||
|
|
||||||
|
int v = shortcut & 0xffff;
|
||||||
|
if (v > 32 && v < 0x7f || v > 0xa0 && v <= 0xff) {
|
||||||
|
if (isupper(v)) {
|
||||||
|
shortcut |= FL_SHIFT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int shift = Fl::event_state();
|
int shift = Fl::event_state();
|
||||||
// see if any required shift flags are off:
|
// see if any required shift flags are off:
|
||||||
if ((shortcut&shift) != (shortcut&0x7fff0000)) return 0;
|
if ((shortcut&shift) != (shortcut&0x7fff0000)) return 0;
|
||||||
@@ -118,6 +125,13 @@ const char * fl_shortcut_label(int shortcut) {
|
|||||||
static char buf[20];
|
static char buf[20];
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
if (!shortcut) {*p = 0; return buf;}
|
if (!shortcut) {*p = 0; return buf;}
|
||||||
|
// fix upper case shortcuts
|
||||||
|
int v = shortcut & 0xffff;
|
||||||
|
if (v > 32 && v < 0x7f || v > 0xa0 && v <= 0xff) {
|
||||||
|
if (isupper(v)) {
|
||||||
|
shortcut |= FL_SHIFT;
|
||||||
|
}
|
||||||
|
}
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// \todo Mac : we might want to change the symbols for Mac users - consider drawing Apple Symbols... .
|
// \todo Mac : we might want to change the symbols for Mac users - consider drawing Apple Symbols... .
|
||||||
if (shortcut & FL_SHIFT) {strcpy(p,"Shift+"); p += 6;} //: Mac hollow up arrow
|
if (shortcut & FL_SHIFT) {strcpy(p,"Shift+"); p += 6;} //: Mac hollow up arrow
|
||||||
|
|||||||
Reference in New Issue
Block a user