summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp14
-rw-r--r--core/bind/core_bind.h4
-rw-r--r--core/os/os.cpp5
-rw-r--r--doc/base/classes.xml58
-rw-r--r--platform/x11/detect.py5
-rw-r--r--platform/x11/joystick_linux.cpp4
-rw-r--r--platform/x11/key_mapping_x11.cpp1
-rw-r--r--platform/x11/os_x11.cpp183
-rw-r--r--scene/gui/item_list.cpp5
9 files changed, 101 insertions, 178 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index e56684dc5e..3e2f8ff263 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -894,6 +894,17 @@ void _OS::print_resources_by_type(const Vector<String>& p_types) {
};
+bool _OS::has_virtual_keyboard() const {
+ return OS::get_singleton()->has_virtual_keyboard();
+}
+
+void _OS::show_virtual_keyboard(const String& p_existing_text) {
+ OS::get_singleton()->show_virtual_keyboard(p_existing_text, Rect2());
+}
+
+void _OS::hide_virtual_keyboard() {
+ OS::get_singleton()->hide_virtual_keyboard();
+}
void _OS::print_all_resources(const String& p_to_file ) {
@@ -1123,6 +1134,9 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("dump_memory_to_file","file"),&_OS::dump_memory_to_file);
ObjectTypeDB::bind_method(_MD("dump_resources_to_file","file"),&_OS::dump_resources_to_file);
+ ObjectTypeDB::bind_method(_MD("has_virtual_keyboard"),&_OS::has_virtual_keyboard);
+ ObjectTypeDB::bind_method(_MD("show_virtual_keyboard", "existing_text"),&_OS::show_virtual_keyboard,DEFVAL(""));
+ ObjectTypeDB::bind_method(_MD("hide_virtual_keyboard"),&_OS::hide_virtual_keyboard);
ObjectTypeDB::bind_method(_MD("print_resources_in_use","short"),&_OS::print_resources_in_use,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("print_all_resources","tofile"),&_OS::print_all_resources,DEFVAL(""));
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 9ca439a454..14203ae863 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -205,6 +205,10 @@ public:
void dump_memory_to_file(const String& p_file);
void dump_resources_to_file(const String& p_file);
+ bool has_virtual_keyboard() const;
+ void show_virtual_keyboard(const String& p_existing_text="");
+ void hide_virtual_keyboard();
+
void print_resources_in_use(bool p_short=false);
void print_all_resources(const String& p_to_file);
void print_all_textures_by_size();
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 284bcb30cb..5f86962048 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -209,18 +209,15 @@ bool OS::has_virtual_keyboard() const {
return false;
}
-void OS::show_virtual_keyboard(const String& p_existing_text,const Rect2& p_screen_rect) {
-
+void OS::show_virtual_keyboard(const String& p_existing_text,const Rect2& p_screen_rect) {
}
void OS::hide_virtual_keyboard(){
-
}
-
void OS::print_all_resources(String p_to_file) {
ERR_FAIL_COND(p_to_file!="" && _OSPRF);
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 3f203170b3..4f45ba9ee9 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -22721,6 +22721,18 @@
<description>
</description>
</method>
+ <method name="has_virtual_keyboard" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns true if the platform has a virtual keyboard, false otherwise.
+ </description>
+ </method>
+ <method name="hide_virtual_keyboard">
+ <description>
+ Hides the virtual keyboard if it is shown, does nothing otherwise.
+ </description>
+ </method>
<method name="is_debug_build" qualifiers="const">
<return type="bool">
</return>
@@ -23038,6 +23050,13 @@
<description>
</description>
</method>
+ <method name="show_virtual_keyboard">
+ <argument index="0" name="existing_text" type="String">
+ </argument>
+ <description>
+ Shows the virtual keyboard if the platform has one. The [i]existing_text[/i] parameter is useful for implementing your own LineEdit, as it tells the virtual keyboard what text has already been typed (the virtual keyboard uses it for auto-correct and predictions).
+ </description>
+ </method>
</methods>
<constants>
<constant name="DAY_SUNDAY" value="0">
@@ -31099,24 +31118,29 @@
Simple regular expression matcher.
</brief_description>
<description>
- Class for finding text patterns in a string using regular expressions. Regular expressions are a way to define patterns of text to be searched.
- This class only finds patterns in a string. It can not perform replacements.
- Usage of regular expressions is too long to be explained here, but Internet is full of tutorials and detailed explanations.
+ Class for finding text patterns in a string using regular expressions. It can not perform replacements. Regular expressions are a way to define patterns of text to be searched. Details on writing patterns are too long to explain here but the Internet is full of tutorials and detailed explanations.
+ Once created, the RegEx object needs to be compiled with the pattern before it can be used. The pattern must be escaped first for gdscript before it is escaped for the expression. For example:
+ [code]var exp = RegEx.new()[/code]
+ [code]exp.compile("\\d+")[/code]
+ would be read by RegEx as [code]\d+[/code]
+ Similarly:
+ [code]exp.compile("\"(?:\\\\.|[^\"])*\"")[/code]
+ would be read as [code]"(?:\\.|[^"])*"[/code]
Currently supported features:
- Capturing [code]()[/code] and non-capturing [code](?:)[/code] groups
- Any character [code].[/code]
- Shorthand character classes [code]\w \W \s \S \d \D[/code]
- User-defined character classes such as [code][A-Za-z][/code]
- Simple quantifiers [code]?[/code], [code]*[/code] and [code]+[/code]
- Range quantifiers [code]{x,y}[/code]
- Lazy (non-greedy) quantifiers [code]*?[/code]
- Beginning [code]^[/code] and end [code]$[/code] anchors
- Alternation [code]|[/code]
- Backreferences [code]\1[/code] and [code]\g{1}[/code]
- POSIX character classes [code][[:alnum:]][/code]
- Lookahead [code](?=)[/code], [code](?!)[/code] and lookbehind [code](?&lt;=)[/code], [code](?&lt;!)[/code]
- ASCII [code]\xFF[/code] and Unicode [code]\uFFFF[/code] code points (in a style similar to Python)
- Word boundaries [code]\b[/code], [code]\B[/code]
+ * Capturing [code]()[/code] and non-capturing [code](?:)[/code] groups
+ * Any character [code].[/code]
+ * Shorthand character classes [code]\w \W \s \S \d \D[/code]
+ * User-defined character classes such as [code][A-Za-z][/code]
+ * Simple quantifiers [code]?[/code], [code]*[/code] and [code]+[/code]
+ * Range quantifiers [code]{x,y}[/code]
+ * Lazy (non-greedy) quantifiers [code]*?[/code]
+ * Beginning [code]^[/code] and end [code]$[/code] anchors
+ * Alternation [code]|[/code]
+ * Backreferences [code]\1[/code] and [code]\g{1}[/code]
+ * POSIX character classes [code][[:alnum:]][/code]
+ * Lookahead [code](?=)[/code], [code](?!)[/code] and lookbehind [code](?&lt;=)[/code], [code](?&lt;!)[/code]
+ * ASCII [code]\xFF[/code] and Unicode [code]\uFFFF[/code] code points (in a style similar to Python)
+ * Word boundaries [code]\b[/code], [code]\B[/code]
</description>
<methods>
<method name="clear">
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 2be8b01dc3..356de7b2bc 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -62,7 +62,6 @@ def get_opts():
('use_leak_sanitizer','Use llvm compiler sanitize memory leaks','no'),
('pulseaudio','Detect & Use pulseaudio','yes'),
('udev','Use udev for gamepad connection callbacks','no'),
- ('new_wm_api', 'Use experimental window management API','no'),
('debug_release', 'Add debug symbols to release version','no'),
]
@@ -204,10 +203,6 @@ def configure(env):
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
- if(env["new_wm_api"]=="yes"):
- env.Append(CPPFLAGS=['-DNEW_WM_API'])
- env.ParseConfig('pkg-config xinerama --cflags --libs')
-
if (env["use_static_cpp"]=="yes"):
env.Append(LINKFLAGS=['-static-libstdc++'])
diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp
index 4a6a4f3a52..3b854a8d46 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joystick_linux.cpp
@@ -259,7 +259,7 @@ void joystick_linux::close_joystick(int p_id) {
attached_devices.remove(attached_devices.find(joy.devpath));
input->joy_connection_changed(p_id, false, "");
};
-};
+}
static String _hex_str(uint8_t p_byte) {
@@ -271,7 +271,7 @@ static String _hex_str(uint8_t p_byte) {
ret[1] = dict[p_byte & 0xF];
return ret;
-};
+}
void joystick_linux::setup_joystick_properties(int p_id) {
diff --git a/platform/x11/key_mapping_x11.cpp b/platform/x11/key_mapping_x11.cpp
index 190d6925dd..6443d14897 100644
--- a/platform/x11/key_mapping_x11.cpp
+++ b/platform/x11/key_mapping_x11.cpp
@@ -197,6 +197,7 @@ unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) {
return 0;
}
+
KeySym KeyMappingX11::get_keysym(unsigned int p_code) {
// kinda bruteforce.. could optimize.
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index a9a8c73a74..490030398e 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -216,8 +216,6 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD));
}
-#if 1
- // NEW_WM_API
// borderless fullscreen window mode
if (current_videomode.fullscreen) {
// needed for lxde/openbox, possibly others
@@ -267,22 +265,6 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
XSetWMNormalHints(x11_display, x11_window, xsh);
XFree(xsh);
}
-#else
- capture_idle = 0;
- minimized = false;
- maximized = false;
-
- if (current_videomode.fullscreen) {
- //set_wm_border(false);
- set_wm_fullscreen(true);
- }
- if (!current_videomode.resizable) {
- int screen = get_current_screen();
- Size2i screen_size = get_screen_size(screen);
- set_window_size(screen_size);
- set_window_resizable(false);
- }
-#endif
AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
@@ -440,7 +422,6 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
XFreeGC(x11_display, gc);
-
if (cursor == None)
{
ERR_PRINT("FAILED CREATING CURSOR");
@@ -579,7 +560,7 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask, GrabModeAsync, GrabModeAsync,
x11_window, None, CurrentTime) !=
- GrabSuccess) {
+ GrabSuccess) {
ERR_PRINT("NO GRAB");
}
@@ -643,22 +624,6 @@ OS::VideoMode OS_X11::get_video_mode(int p_screen) const {
void OS_X11::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const {
}
-//#ifdef NEW_WM_API
-#if 0
-// Just now not needed. Can be used for a possible OS.set_border(bool) method
-void OS_X11::set_wm_border(bool p_enabled) {
- // needed for lxde/openbox, possibly others
- Hints hints;
- Atom property;
- hints.flags = 2;
- hints.decorations = p_enabled ? 1L : 0L;
- property = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True);
- XChangeProperty(x11_display, x11_window, property, property, 32, PropModeReplace, (unsigned char *)&hints, 5);
- XMapRaised(x11_display, x11_window);
- //XMoveResizeWindow(x11_display, x11_window, 0, 0, 800, 800);
-}
-#endif
-
void OS_X11::set_wm_fullscreen(bool p_enabled) {
// Using EWMH -- Extened Window Manager Hints
XEvent xev;
@@ -811,54 +776,7 @@ Point2 OS_X11::get_window_position() const {
}
void OS_X11::set_window_position(const Point2& p_position) {
- // Using EWMH -- Extended Window Manager Hints
- // to get the size of the decoration
-#if 0
- Atom property = XInternAtom(x11_display,"_NET_FRAME_EXTENTS", True);
- Atom type;
- int format;
- unsigned long len;
- unsigned long remaining;
- unsigned char *data = NULL;
- int result;
-
- result = XGetWindowProperty(
- x11_display,
- x11_window,
- property,
- 0,
- 32,
- False,
- AnyPropertyType,
- &type,
- &format,
- &len,
- &remaining,
- &data
- );
-
- long left = 0L;
- long top = 0L;
-
- if( result == Success ) {
- long *extends = (long *) data;
-
- left = extends[0];
- top = extends[2];
-
- XFree(data);
- }
-
- int screen = get_current_screen();
- Point2i screen_position = get_screen_position(screen);
-
- left -= screen_position.x;
- top -= screen_position.y;
-
- XMoveWindow(x11_display,x11_window,p_position.x - left,p_position.y - top);
-#else
XMoveWindow(x11_display,x11_window,p_position.x,p_position.y);
-#endif
}
Size2 OS_X11::get_window_size() const {
@@ -902,20 +820,19 @@ bool OS_X11::is_window_resizable() const {
}
void OS_X11::set_window_minimized(bool p_enabled) {
- // Using ICCCM -- Inter-Client Communication Conventions Manual
- XEvent xev;
- Atom wm_change = XInternAtom(x11_display, "WM_CHANGE_STATE", False);
+ // Using ICCCM -- Inter-Client Communication Conventions Manual
+ XEvent xev;
+ Atom wm_change = XInternAtom(x11_display, "WM_CHANGE_STATE", False);
- memset(&xev, 0, sizeof(xev));
- xev.type = ClientMessage;
- xev.xclient.window = x11_window;
- xev.xclient.message_type = wm_change;
- xev.xclient.format = 32;
- xev.xclient.data.l[0] = p_enabled ? WM_IconicState : WM_NormalState;
+ memset(&xev, 0, sizeof(xev));
+ xev.type = ClientMessage;
+ xev.xclient.window = x11_window;
+ xev.xclient.message_type = wm_change;
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = p_enabled ? WM_IconicState : WM_NormalState;
- XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+ XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
- //XEvent xev;
Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False);
Atom wm_hidden = XInternAtom(x11_display, "_NET_WM_STATE_HIDDEN", False);
@@ -979,47 +896,33 @@ void OS_X11::set_window_maximized(bool p_enabled) {
xev.xclient.data.l[2] = wm_max_vert;
XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
-/* sorry this does not fix it, fails on multi monitor
- XWindowAttributes xwa;
- XGetWindowAttributes(x11_display,DefaultRootWindow(x11_display),&xwa);
- current_videomode.width = xwa.width;
- current_videomode.height = xwa.height;
-//*/
-
-// current_videomode.width = wm_max_horz;
-// current_videomode.height = wm_max_vert;
-
- //Size2 ss = get_screen_size(get_current_screen());
- //current_videomode.width=ss.width;
- //current_videomode.height=ss.height;
-
maximized = p_enabled;
}
bool OS_X11::is_window_maximized() const {
// Using EWMH -- Extended Window Manager Hints
- Atom property = XInternAtom(x11_display,"_NET_WM_STATE",False );
- Atom type;
- int format;
- unsigned long len;
- unsigned long remaining;
- unsigned char *data = NULL;
+ Atom property = XInternAtom(x11_display,"_NET_WM_STATE",False );
+ Atom type;
+ int format;
+ unsigned long len;
+ unsigned long remaining;
+ unsigned char *data = NULL;
- int result = XGetWindowProperty(
- x11_display,
- x11_window,
- property,
- 0,
- 1024,
- False,
- XA_ATOM,
- &type,
- &format,
- &len,
- &remaining,
- &data
- );
+ int result = XGetWindowProperty(
+ x11_display,
+ x11_window,
+ property,
+ 0,
+ 1024,
+ False,
+ XA_ATOM,
+ &type,
+ &format,
+ &len,
+ &remaining,
+ &data
+ );
if(result == Success) {
Atom *atoms = (Atom*) data;
@@ -1383,11 +1286,6 @@ void OS_X11::process_xevents() {
} break;
case FocusIn:
minimized = false;
-#ifdef NEW_WM_API
- if(current_videomode.fullscreen) {
- set_wm_fullscreen(true);
- }
-#endif
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
if (mouse_mode==MOUSE_MODE_CAPTURED) {
XGrabPointer(x11_display, x11_window, True,
@@ -1398,12 +1296,6 @@ void OS_X11::process_xevents() {
break;
case FocusOut:
-#ifdef NEW_WM_API
- if(current_videomode.fullscreen) {
- set_wm_fullscreen(false);
- set_window_minimized(true);
- }
-#endif
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
if (mouse_mode==MOUSE_MODE_CAPTURED) {
//dear X11, I try, I really try, but you never work, you do whathever you want.
@@ -1547,13 +1439,6 @@ void OS_X11::process_xevents() {
Point2i rel = pos - last_mouse_pos;
-#ifdef NEW_WM_API
- if (mouse_mode==MOUSE_MODE_CAPTURED) {
- pos.x = current_videomode.width / 2;
- pos.y = current_videomode.height / 2;
- }
-#endif
-
InputEvent motion_event;
motion_event.ID=++event_id;
motion_event.type=InputEvent::MOUSE_MOTION;
@@ -1836,7 +1721,7 @@ static String _get_clipboard(Atom p_source, Window x11_window, ::Display* x11_di
return ret;
-};
+}
String OS_X11::get_clipboard() const {
@@ -1848,7 +1733,7 @@ String OS_X11::get_clipboard() const {
};
return ret;
-};
+}
String OS_X11::get_name() {
@@ -2095,4 +1980,4 @@ OS_X11::OS_X11() {
minimized = false;
xim_style=0L;
mouse_mode=MOUSE_MODE_VISIBLE;
-};
+}
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 7d112d1492..2f4f79904d 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1211,8 +1211,11 @@ String ItemList::get_tooltip(const Point2& p_pos) const {
}
void ItemList::sort_items_by_text() {
+
items.sort();
update();
+ shape_changed=true;
+
if (select_mode==SELECT_SINGLE) {
for(int i=0;i<items.size();i++) {
if (items[i].selected) {
@@ -1304,7 +1307,7 @@ void ItemList::_bind_methods(){
ObjectTypeDB::bind_method(_MD("remove_item","idx"),&ItemList::remove_item);
ObjectTypeDB::bind_method(_MD("clear"),&ItemList::clear);
- ObjectTypeDB::bind_method(_MD("sort_items_by_text"),&ItemList::clear);
+ ObjectTypeDB::bind_method(_MD("sort_items_by_text"),&ItemList::sort_items_by_text);
ObjectTypeDB::bind_method(_MD("set_fixed_column_width","width"),&ItemList::set_fixed_column_width);
ObjectTypeDB::bind_method(_MD("get_fixed_column_width"),&ItemList::get_fixed_column_width);