summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-04-02 09:34:17 +0000
committerManolo Gouy <Manolo>2016-04-02 09:34:17 +0000
commitab5252071c37b32397565a5d846de17984b75c3a (patch)
tree8ecf39a75d0152f5f0712e84061cf68a2318511f /src
parent4d4b43a6bcbcd3926b3dc1fc220c3e4b5b7a8c94 (diff)
Move Fl_X::next_marked_length to the Fl_Cocoa_Screen_Driver class.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11503 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm12
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H1
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx6
3 files changed, 10 insertions, 9 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index d857e9d6b..a8a5e073e 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -2106,7 +2106,7 @@ static void q_set_window_title(NSWindow *nsw, const char * name, const char *mi
The doCommandBySelector: message allows to process events such as new-line, forward and backward delete, arrows,
escape, tab, F1. The message setMarkedText: is sent when marked text, that is, temporary text that gets replaced later
by some other text, is inserted. This happens when a dead key is pressed, and also
- when entering complex scripts (e.g., Chinese). Fl_X::next_marked_length gives the byte
+ when entering complex scripts (e.g., Chinese). Fl_Cocoa_Screen_Driver::next_marked_length gives the byte
length of marked text before the FL_KEYBOARD event is processed. Fl::compose_state gives this length after this processing.
Message insertText: is sent to enter text in the focused widget. If there's marked text, Fl::compose_state is > 0, and this
marked text gets replaced by the inserted text. If there's no marked text, the new text is inserted at the insertion point.
@@ -2570,14 +2570,14 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
Fl::handle(FL_KEYBOARD, target);
Fl::e_keysym = saved_keysym;
}
- if (in_key_event && Fl_X::next_marked_length && Fl::e_length) {
+ if (in_key_event && Fl_Cocoa_Screen_Driver::next_marked_length && Fl::e_length) {
// if setMarkedText + insertText is sent during handleEvent, text cannot be concatenated in single FL_KEYBOARD event
Fl::handle(FL_KEYBOARD, target);
Fl::e_length = 0;
}
if (in_key_event && Fl::e_length) [FLView concatEtext:received];
else [FLView prepareEtext:received];
- Fl_X::next_marked_length = 0;
+ Fl_Cocoa_Screen_Driver::next_marked_length = 0;
// We can get called outside of key events (e.g., from the character palette, from CJK text input).
BOOL palette = !(in_key_event || Fl::compose_state);
if (palette) Fl::e_keysym = 0;
@@ -2618,18 +2618,18 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
while (replacementRange.length--) { // delete replacementRange.length characters before insertion point
Fl::e_keysym = FL_BackSpace;
Fl::compose_state = 0;
- Fl_X::next_marked_length = 0;
+ Fl_Cocoa_Screen_Driver::next_marked_length = 0;
Fl::handle(FL_KEYBOARD, target);
Fl::e_keysym = 'a'; // pretend a letter key was hit
}
- if (in_key_event && Fl_X::next_marked_length && Fl::e_length) {
+ if (in_key_event && Fl_Cocoa_Screen_Driver::next_marked_length && Fl::e_length) {
// if setMarkedText + setMarkedText is sent during handleEvent, text cannot be concatenated in single FL_KEYBOARD event
Fl::handle(FL_KEYBOARD, target);
Fl::e_length = 0;
}
if (in_key_event && Fl::e_length) [FLView concatEtext:received];
else [FLView prepareEtext:received];
- Fl_X::next_marked_length = strlen([received UTF8String]);
+ Fl_Cocoa_Screen_Driver::next_marked_length = strlen([received UTF8String]);
if (!in_key_event) Fl::handle( FL_KEYBOARD, target);
else need_handle = YES;
selectedRange = NSMakeRange(100, newSelection.length);
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
index 34bf6b6ce..a1f278a63 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
+++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
@@ -54,6 +54,7 @@ protected:
static bool insertion_point_location_is_valid;
public:
Fl_Cocoa_Screen_Driver();
+ static int next_marked_length; // next length of marked text after current marked text will have been replaced
// --- display management
// --- screen configuration
virtual void init();
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
index a048bb4b2..1f68fd8d8 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
+++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
@@ -31,7 +31,7 @@ extern "C" void NSBeep(void);
extern double fl_mac_flush_and_wait(double time_to_wait);
extern int fl_ready();
-int Fl_X::next_marked_length = 0;
+int Fl_Cocoa_Screen_Driver::next_marked_length = 0;
/**
Creates a driver that manages all screen and display related calls.
@@ -266,7 +266,7 @@ bool Fl_Cocoa_Screen_Driver::insertion_point_location_is_valid = false;
void Fl_Cocoa_Screen_Driver::reset_marked_text() {
Fl::compose_state = 0;
- Fl_X::next_marked_length = 0;
+ next_marked_length = 0;
insertion_point_location_is_valid = false;
}
@@ -297,7 +297,7 @@ int Fl_Cocoa_Screen_Driver::compose(int &del) {
!has_text_key ;
if (condition) { del = 0; return 0;} // this stuff is to be treated as a function key
del = Fl::compose_state;
- Fl::compose_state = Fl_X::next_marked_length;
+ Fl::compose_state = next_marked_length;
return 1;
}