diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-11-07 06:49:40 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-11-07 06:49:40 +0100 |
| commit | 37bf3835b0b3ce7f4c80924f40735698f057ef6f (patch) | |
| tree | 5862a10eef97cf3575bfe55b2f29fc5a79ae3270 /src/drivers/Cocoa | |
| parent | b663e272e7f39063a5c1bf744038ded0a7566990 (diff) | |
Create class Fl_Unix_Screen_Driver used by X11 and Wayland platforms
Diffstat (limited to 'src/drivers/Cocoa')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 4 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 44 |
2 files changed, 48 insertions, 0 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index 83cf5feb0..fbd76b68e 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -102,6 +102,10 @@ public: virtual int clipboard_contains(const char *type); virtual void set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win); virtual void reset_spot(); + virtual int need_menu_handle_part2() {return 1;} + // these 2 are in Fl_get_key_mac.cxx + virtual int event_key(int); + virtual int get_key(int); private: float scale_; }; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 33b0392c4..b955c0a97 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -35,6 +35,47 @@ extern void (*fl_unlock_function)(); int Fl_Cocoa_Screen_Driver::next_marked_length = 0; +// This key table is used for the Darwin system driver. It is defined here +// "static" and assigned in the constructor to avoid static initialization +// race conditions. It is used in fl_shortcut.cxx. +// +// This table must be in numeric order by fltk (X) keysym number: + +Fl_Screen_Driver::Keyname darwin_key_table[] = { + // v - this column may contain UTF-8 characters + {' ', "Space"}, + {FL_BackSpace, "⌫"/*"\xe2\x8c\xab"*/}, // U+232B : erase to the left + {FL_Tab, "⇥"/*"\xe2\x87\xa5"*/}, // U+21E5 rightwards arrow to bar + {FL_Enter, "↩"/*"\xe2\x86\xa9"*/}, // U+21A9 leftwards arrow with hook + {FL_Pause, "Pause"}, + {FL_Scroll_Lock, "Scroll_Lock"}, + {FL_Escape, "⎋"/*"\xe2\x8e\x8b"*/}, // U+238B : broken circle with northwest arrow + {FL_Home, "↖"/*"\xe2\x86\x96"*/}, // U+2196 north west arrow + {FL_Left, "←"/*"\xe2\x86\x90"*/}, // U+2190 leftwards arrow + {FL_Up, "↑"/*"\xe2\x86\x91"*/}, // U+2191 upwards arrow + {FL_Right, "→"/*"\xe2\x86\x92"*/}, // U+2192 rightwards arrow + {FL_Down, "↓"/*"\xe2\x86\x93"*/}, // U+2193 downwards arrow + {FL_Page_Up, "⇞"/*"\xe2\x87\x9e"*/}, // U+21DE upwards arrow with double stroke + {FL_Page_Down, "⇟"/*"\xe2\x87\x9f"*/}, // U+21DF downwards arrow with double stroke + {FL_End, "↘"/*"\xe2\x86\x98"*/}, // U+2198 south east arrow + {FL_Print, "Print"}, + {FL_Insert, "Insert"}, + {FL_Menu, "Menu"}, + {FL_Num_Lock, "Num_Lock"}, + {FL_KP_Enter, "⌤"/*"\xe2\x8c\xa4"*/}, // U+2324 up arrow head between two horizontal bars + {FL_Shift_L, "Shift_L"}, + {FL_Shift_R, "Shift_R"}, + {FL_Control_L, "Control_L"}, + {FL_Control_R, "Control_R"}, + {FL_Caps_Lock, "⇪"/*"\xe2\x87\xaa"*/}, // U+21EA upwards white arrow from bar + {FL_Meta_L, "Meta_L"}, + {FL_Meta_R, "Meta_R"}, + {FL_Alt_L, "Alt_L"}, + {FL_Alt_R, "Alt_R"}, + {FL_Delete, "⌦"/*"\xe2\x8c\xa6"*/} // U+2326 : erase to the right +}; + + static Fl_Text_Editor::Key_Binding extra_bindings[] = { // Define CMD+key accelerators... { 'z', FL_COMMAND, Fl_Text_Editor::kf_undo ,0}, @@ -58,6 +99,9 @@ Fl_Cocoa_Screen_Driver::Fl_Cocoa_Screen_Driver() { text_editor_extra_key_bindings = extra_bindings; scale_ = 1.; default_icon = nil; + // initialize key table + key_table = darwin_key_table; + key_table_size = sizeof(darwin_key_table)/sizeof(*darwin_key_table); } |
