aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-12-23 19:27:20 +0100
committerdec05eba <dec05eba@protonmail.com>2023-12-23 19:30:30 +0100
commit7e7a8f314b1cac4cce96e781604a874b5533f690 (patch)
treea780f9f806fad9e6bd948427b87af142b16eefa5 /src
parenta257f50a9f752919729bcf3aa3358491ff5edcad (diff)
Force window focus mpv
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 7cea5e2..a555ab8 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3055,6 +3055,7 @@ namespace QuickMedia {
static Window get_input_focus(Display *display) {
Window focused_window = None;
+ /*
Atom net_active_window_atom = XInternAtom(display, "_NET_ACTIVE_WINDOW", False);
Atom type;
unsigned long len, bytes_left;
@@ -3067,6 +3068,7 @@ namespace QuickMedia {
XFree(properties);
}
}
+ */
if(!focused_window) {
int rev;
@@ -3084,6 +3086,10 @@ namespace QuickMedia {
XRaiseWindow(disp, video_player_window);
XSetInputFocus(disp, video_player_window, RevertToParent, CurrentTime);
+
+ Atom net_active_window_atom = XInternAtom(disp, "_NET_ACTIVE_WINDOW", False);
+ XChangeProperty(disp, DefaultRootWindow(disp), net_active_window_atom, XA_WINDOW, 32, PropModeReplace, (const unsigned char*)&video_player_window, 1);
+
XSync(disp, False);
XFlush(disp);
}
@@ -3227,7 +3233,6 @@ namespace QuickMedia {
bool update_time_pos = false;
bool update_duration = false;
bool update_window_focus = false;
- bool update_window_focus_timer = false;
mgl::Clock video_time_pos_clock;
mgl::Clock update_window_focus_time; // HACK!
@@ -3262,7 +3267,6 @@ namespace QuickMedia {
video_player->add_subtitle(subtitle_data.url, subtitle_data.title, "eng");
update_time_pos = true;
- update_window_focus_timer = true;
update_window_focus_time.restart();
};
@@ -3691,13 +3695,8 @@ namespace QuickMedia {
update_window_focus = true;
}
- if(video_player_window && update_window_focus) {
- update_window_focus = false;
- redirect_focus_to_video_player_window(video_player_window);
- }
-
- if(video_player_window && update_window_focus_timer && update_window_focus_time.get_elapsed_time_seconds() >= 0.5) {
- update_window_focus_timer = false;
+ if(video_player_window && (update_window_focus || update_window_focus_time.get_elapsed_time_seconds() >= 0.5)) {
+ update_window_focus_time.restart();
update_window_focus = false;
redirect_focus_to_video_player_window(video_player_window);
}