bool Ctrl::SetWndFocus() { GuiLock __; LLOG("SetWndFocus0 " << Upp::Name(this) << ", top: " << top); if(top) { LLOG("SetWndFocus0 DO gdk: " << gdk()); SetWndForeground(); int t0 = msecs(); while(!gtk_window_is_active(gtk()) && msecs() - t0 < 500) // Wait up to 500ms for window to become active - not ideal, but only possibility FetchEvents(true); FocusSync(); } return true; }
int main(int argc, char *argv[]) { Gtk::Main gtk(argc, argv); sag::GUI gui; gtk.run(gui); return 0; }
bool gtk_core_init (Ekiga::ServiceCore &core, int *argc, char **argv[]) { if (gtk_init_check (argc, argv)) { boost::shared_ptr<Gtk::Core> gtk (new Gtk::Core); core.add (gtk); return true; } else return false; }
static bool tryUnity() { static bool init = false; static bool good = false; if (!init) { init = true; _Debug("DE is Unity. Fallback to AppIndicator instead of QSytemTrayIcon."); QLibrary gtk(u"gtk-x11-2.0"_q, 0), ai(u"libappindicator"_q, 1); if (!gtk.load() || !ai.load()) return false; auto lib = >k; #define DEC_FUNC(name) if (!(name = (f_##name)lib->resolve(#name))) return false; DEC_FUNC(gtk_menu_new) DEC_FUNC(gtk_menu_item_new_with_label) DEC_FUNC(gtk_menu_shell_append) DEC_FUNC(gtk_widget_show) lib = &ai; DEC_FUNC(app_indicator_new) DEC_FUNC(app_indicator_set_menu) DEC_FUNC(app_indicator_set_status) #undef DEC_FUNC good = true; } return good; }
bool Ctrl::HasWndFocus() const { GuiLock __; return IsOpen() && gtk_window_is_active(gtk()); }
bool Ctrl::IsWndForeground() const { GuiLock __; LLOG("IsWndForeground"); return IsOpen() && gtk_window_is_active(gtk()); }
void Ctrl::SetWndForeground() { GuiLock __; if(IsOpen()) gtk_window_present(gtk()); }