aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/QuickMedia.hpp5
-rw-r--r--launcher/QuickMedia_tabbed.desktop2
-rw-r--r--src/QuickMedia.cpp31
-rw-r--r--src/plugins/Matrix.cpp4
4 files changed, 7 insertions, 35 deletions
diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp
index c792d2d..2877e0c 100644
--- a/include/QuickMedia.hpp
+++ b/include/QuickMedia.hpp
@@ -94,12 +94,11 @@ namespace QuickMedia {
const char* get_plugin_name() const;
void manga_get_watch_history(const char *plugin_name, BodyItems &history_items);
void youtube_get_watch_history(BodyItems &history_items);
-
- void window_set_urgent();
private:
void init(Window parent_window);
void load_plugin_by_name(std::vector<Tab> &tabs, const char *start_dir);
- void handle_window_close();
+ // Returns true if the window was closed
+ bool handle_window_close();
void base_event_handler(sf::Event &event, PageType previous_page, Body *body, SearchBar *search_bar, bool handle_key_press = true, bool handle_searchbar = true);
void event_idle_handler(const sf::Event &event);
void idle_active_handler();
diff --git a/launcher/QuickMedia_tabbed.desktop b/launcher/QuickMedia_tabbed.desktop
index 1e4ea81..d8332e9 100644
--- a/launcher/QuickMedia_tabbed.desktop
+++ b/launcher/QuickMedia_tabbed.desktop
@@ -3,6 +3,6 @@ Type=Application
Name=QuickMedia tabbed
GenericName=QuickMedia tabbed
Comment=Launch QuickMedia with tabs
-Exec=tabbed quickmedia launcher -e
+Exec=tabbed -k quickmedia launcher -e
Terminal=false
Keywords=4chan;manga;matrix;nyaa;torrent;soundcloud;spotify;podcast;youtube;music;quickmedia;
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index ebbbba8..e092584 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -445,21 +445,6 @@ namespace QuickMedia {
return body_item;
}
- void Program::window_set_urgent() {
- XWMHints *hints = XGetWMHints(disp, x11_window);
- if(!hints) {
- fprintf(stderr, "seturgent: unable to get window manager hints\n");
- return;
- }
-
- hints->flags |= XUrgencyHint;
-
- if(!XSetWMHints(disp, x11_window, hints))
- fprintf(stderr, "seturgent: unable to set urgency hint\n");
-
- XFree(hints);
- }
-
int Program::run(int argc, char **argv) {
if(argc < 2) {
usage();
@@ -631,14 +616,6 @@ namespace QuickMedia {
XMapWindow(disp, x11_window);
XFlush(disp);
- XWMHints* hints = XAllocWMHints();
- if(hints) {
- hints->flags = AllHints;
- hints->initial_state = NormalState;
- XSetWMHints(disp, x11_window, hints);
- XFree(hints);
- }
-
window.create(x11_window);
resources_root = "/usr/share/quickmedia/";
@@ -810,11 +787,13 @@ namespace QuickMedia {
}
}
- void Program::handle_window_close() {
+ bool Program::handle_window_close() {
if(wm_delete_window_atom && XCheckTypedWindowEvent(disp, x11_window, ClientMessage, &xev) && (Atom)xev.xclient.data.l[0] == wm_delete_window_atom) {
current_page = PageType::EXIT;
window.close();
+ return true;
}
+ return false;
}
void Program::base_event_handler(sf::Event &event, PageType previous_page, Body *body, SearchBar *search_bar, bool handle_keypress, bool handle_searchbar) {
@@ -1790,10 +1769,8 @@ namespace QuickMedia {
}
}
- if(wm_delete_window_atom && XCheckTypedWindowEvent(disp, x11_window, ClientMessage, &xev) && (Atom)xev.xclient.data.l[0] == wm_delete_window_atom) {
+ if(handle_window_close()) {
task.cancel();
- current_page = PageType::EXIT;
- window.close();
return TaskResult::CANCEL;
}
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 9db9872..9568244 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -389,7 +389,6 @@ namespace QuickMedia {
invites_page->add_body_item(std::move(body_item));
if(invite.new_invite) {
show_notification("QuickMedia matrix - " + invite.room_name, "You were invited to " + invite.room_name + " by " + invited_by_display_name + " (" + invite.invited_by->user_id + ")");
- program->window_set_urgent();
}
}
@@ -452,8 +451,6 @@ namespace QuickMedia {
show_notification("QuickMedia matrix - " + unread_notification.sender + " (" + it.first->get_name() + ")", unread_notification.body);
}
}
- if(!unread_notifications.empty())
- program->window_set_urgent();
//if(!unread_notifications.empty()) {
// rooms_page->sort_rooms();
// room_tags_page->sort_rooms();
@@ -585,7 +582,6 @@ namespace QuickMedia {
// TODO: What if the message or username begins with "-"? also make the notification image be the avatar of the user
if((!is_window_focused || room != current_room || page_type == MatrixPageType::ROOM_LIST) && message->related_event_type != RelatedEventType::EDIT && message->related_event_type != RelatedEventType::REDACTION) {
show_notification("QuickMedia matrix - " + matrix->message_get_author_displayname(message.get()) + " (" + room->get_name() + ")", message->body);
- program->window_set_urgent();
}
}
}