summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/x11/os_x11.cpp20
-rw-r--r--platform/x11/os_x11.h1
-rw-r--r--scene/gui/item_list.cpp31
-rw-r--r--tools/editor/editor_profiler.cpp2
4 files changed, 44 insertions, 10 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 45a52b8244..490030398e 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -946,6 +946,26 @@ bool OS_X11::is_window_maximized() const {
return false;
}
+void OS_X11::request_attention() {
+ // Using EWMH -- Extended Window Manager Hints
+ //
+ // Sets the _NET_WM_STATE_DEMANDS_ATTENTION atom for WM_STATE
+ // Will be unset by the window manager after user react on the request for attention
+ //
+ XEvent xev;
+ Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False);
+ Atom wm_attention = XInternAtom(x11_display, "_NET_WM_STATE_DEMANDS_ATTENTION", False);
+
+ memset(&xev, 0, sizeof(xev));
+ xev.type = ClientMessage;
+ xev.xclient.window = x11_window;
+ xev.xclient.message_type = wm_state;
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = _NET_WM_STATE_ADD;
+ xev.xclient.data.l[1] = wm_attention;
+
+ XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+}
InputModifierState OS_X11::get_key_modifier_state(unsigned int p_x11_state) {
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 71bbe726dd..b27f71406a 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -253,6 +253,7 @@ public:
virtual bool is_window_minimized() const;
virtual void set_window_maximized(bool p_enabled);
virtual bool is_window_maximized() const;
+ virtual void request_attention();
virtual void move_window_to_foreground();
virtual void alert(const String& p_alert,const String& p_title="ALERT!");
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index d63c483ef9..2f4f79904d 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -191,7 +191,7 @@ void ItemList::set_item_disabled(int p_idx,bool p_disabled){
ERR_FAIL_INDEX(p_idx,items.size());
items[p_idx].disabled=p_disabled;
-
+ update();
}
@@ -225,7 +225,7 @@ void ItemList::select(int p_idx,bool p_single){
if (p_single || select_mode==SELECT_SINGLE) {
- if (!items[p_idx].selectable) {
+ if (!items[p_idx].selectable || items[p_idx].disabled) {
return;
}
@@ -237,7 +237,7 @@ void ItemList::select(int p_idx,bool p_single){
ensure_selected_visible=false;
} else {
- if (items[p_idx].selectable) {
+ if (items[p_idx].selectable && !items[p_idx].disabled) {
items[p_idx].selected=true;
}
}
@@ -510,7 +510,7 @@ void ItemList::_input_event(const InputEvent& p_event) {
}
} else {
- if (!mb.doubleclick && !mb.mod.command && select_mode==SELECT_MULTI && items[i].selectable && items[i].selected && p_event.mouse_button.button_index==BUTTON_LEFT) {
+ if (!mb.doubleclick && !mb.mod.command && select_mode==SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && p_event.mouse_button.button_index==BUTTON_LEFT) {
defer_select_single=i;
return;
}
@@ -694,7 +694,7 @@ void ItemList::_input_event(const InputEvent& p_event) {
if (select_mode==SELECT_MULTI && current>=0 && current<items.size()) {
- if (items[current].selectable && !items[current].selected) {
+ if (items[current].selectable && !items[current].disabled && !items[current].selected) {
select(current,false);
emit_signal("multi_selected",current,true);
} else if (items[current].selected) {
@@ -1029,10 +1029,14 @@ void ItemList::_notification(int p_what) {
draw_rect.size=adj.size;
}
+ Color modulate=Color(1,1,1,1);
+ if (items[i].disabled)
+ modulate.a*=0.5;
+
if (items[i].icon_region.has_no_area())
- draw_texture_rect(items[i].icon, draw_rect );
+ draw_texture_rect(items[i].icon, draw_rect,false,modulate );
else
- draw_texture_rect_region(items[i].icon, draw_rect, items[i].icon_region);
+ draw_texture_rect_region(items[i].icon, draw_rect, items[i].icon_region,modulate);
}
@@ -1053,6 +1057,10 @@ void ItemList::_notification(int p_what) {
else
max_len=size.x;
+ Color modulate=items[i].selected?font_color_selected:font_color;
+ if (items[i].disabled)
+ modulate.a*=0.5;
+
if (icon_mode==ICON_MODE_TOP && max_text_lines>0) {
int ss = items[i].text.length();
@@ -1090,7 +1098,7 @@ void ItemList::_notification(int p_what) {
if (line>=max_text_lines)
break;
}
- ofs+=font->draw_char(get_canvas_item(),text_ofs+Vector2(ofs+(max_len-line_size_cache[line])/2,line*(font_height+line_separation)).floor(),items[i].text[j],items[i].text[j+1],items[i].selected?font_color_selected:font_color);
+ ofs+=font->draw_char(get_canvas_item(),text_ofs+Vector2(ofs+(max_len-line_size_cache[line])/2,line*(font_height+line_separation)).floor(),items[i].text[j],items[i].text[j+1],modulate);
}
//special multiline mode
@@ -1110,7 +1118,7 @@ void ItemList::_notification(int p_what) {
text_ofs+=base_ofs;
text_ofs+=items[i].rect_cache.pos;
- draw_string(font,text_ofs,items[i].text,items[i].selected?font_color_selected:font_color,max_len+1);
+ draw_string(font,text_ofs,items[i].text,modulate,max_len+1);
}
@@ -1203,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) {
@@ -1296,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);
diff --git a/tools/editor/editor_profiler.cpp b/tools/editor/editor_profiler.cpp
index c9ee60cd54..13327f0be9 100644
--- a/tools/editor/editor_profiler.cpp
+++ b/tools/editor/editor_profiler.cpp
@@ -135,6 +135,8 @@ void EditorProfiler::_item_edited() {
frame_delay->set_wait_time(0.1);
frame_delay->start();
}
+
+ _update_plot();
}
void EditorProfiler::_update_plot() {