mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-21 21:20:20 +00:00
Compare commits
9 Commits
network-tr
...
taskbar-ic
| Author | SHA1 | Date | |
|---|---|---|---|
| 364e52f7d9 | |||
|
|
57d0d92ecb | ||
| cf89d80765 | |||
|
|
758722ddeb | ||
| 182adba83c | |||
|
|
3c880216cf | ||
| e854153b88 | |||
| 416b8449b9 | |||
|
|
394de09cb1 |
@@ -1120,7 +1120,9 @@ gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...)
|
||||
gboolean
|
||||
gtkutil_tray_icon_supported (GtkWindow *window)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#if defined(HAVE_AYATANA_APPINDICATOR) || defined(HAVE_APPINDICATOR)
|
||||
return TRUE;
|
||||
#elif defined(GDK_WINDOWING_X11)
|
||||
GdkScreen *screen = gtk_window_get_screen (window);
|
||||
GdkDisplay *display = gdk_screen_get_display (screen);
|
||||
if (!GDK_IS_X11_DISPLAY (display))
|
||||
|
||||
@@ -2803,6 +2803,43 @@ mg_apply_entry_style (GtkWidget *entry)
|
||||
theme_manager_apply_entry_palette (entry, input_style->font_desc);
|
||||
}
|
||||
|
||||
static void
|
||||
mg_apply_entry_scroll_artifact_fix (GtkWidget *entry)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
if (!entry || !GTK_IS_ENTRY (entry))
|
||||
return;
|
||||
|
||||
context = gtk_widget_get_style_context (entry);
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
provider = g_object_get_data (G_OBJECT (entry), "mg-entry-scroll-artifact-provider");
|
||||
if (!provider)
|
||||
{
|
||||
provider = gtk_css_provider_new ();
|
||||
g_object_set_data_full (G_OBJECT (entry), "mg-entry-scroll-artifact-provider", provider, g_object_unref);
|
||||
gtk_css_provider_load_from_data (provider,
|
||||
"entry.zoitechat-no-undershoot undershoot,\n"
|
||||
"entry.zoitechat-no-undershoot undershoot.left,\n"
|
||||
"entry.zoitechat-no-undershoot undershoot.right,\n"
|
||||
".zoitechat-no-undershoot undershoot,\n"
|
||||
".zoitechat-no-undershoot undershoot.left,\n"
|
||||
".zoitechat-no-undershoot undershoot.right {\n"
|
||||
" background-image: none;\n"
|
||||
" background-color: transparent;\n"
|
||||
" border: none;\n"
|
||||
" box-shadow: none;\n"
|
||||
"}\n",
|
||||
-1, NULL);
|
||||
}
|
||||
|
||||
gtk_style_context_add_class (context, "zoitechat-no-undershoot");
|
||||
theme_css_apply_widget_provider (entry, GTK_STYLE_PROVIDER (provider));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mg_entry_select_all (GtkWidget *entry, GdkEventKey *event, gpointer userdata)
|
||||
{
|
||||
@@ -2842,6 +2879,7 @@ mg_create_chanmodebuttons (session_gui *gui, GtkWidget *box)
|
||||
|
||||
if (prefs.hex_gui_input_style)
|
||||
mg_apply_entry_style (gui->key_entry);
|
||||
mg_apply_entry_scroll_artifact_fix (gui->key_entry);
|
||||
|
||||
gui->flag_l = mg_create_flagbutton (_("User Limit"), box, "l");
|
||||
gui->limit_entry = gtk_entry_new ();
|
||||
@@ -2858,6 +2896,7 @@ mg_create_chanmodebuttons (session_gui *gui, GtkWidget *box)
|
||||
|
||||
if (prefs.hex_gui_input_style)
|
||||
mg_apply_entry_style (gui->limit_entry);
|
||||
mg_apply_entry_scroll_artifact_fix (gui->limit_entry);
|
||||
}
|
||||
|
||||
/*static void
|
||||
@@ -3955,6 +3994,7 @@ mg_create_search(session *sess, GtkWidget *box)
|
||||
gtk_box_pack_start(GTK_BOX(gui->shbox), entry, FALSE, FALSE, 0);
|
||||
gtk_widget_set_size_request (gui->shentry, 180, -1);
|
||||
mg_apply_emoji_fallback_widget (entry);
|
||||
mg_apply_entry_scroll_artifact_fix (entry);
|
||||
gui->search_changed_signal = g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(search_handle_change), sess);
|
||||
g_signal_connect (G_OBJECT (entry), "key-press-event", G_CALLBACK (search_handle_esc), sess);
|
||||
g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(mg_search_handle_next), sess);
|
||||
@@ -4050,6 +4090,7 @@ mg_create_entry (session *sess, GtkWidget *box)
|
||||
|
||||
if (prefs.hex_gui_input_style)
|
||||
mg_apply_entry_style (entry);
|
||||
mg_apply_entry_scroll_artifact_fix (entry);
|
||||
|
||||
g_object_set (G_OBJECT (entry), "show-emoji-icon", TRUE, NULL);
|
||||
|
||||
@@ -4334,12 +4375,39 @@ mg_win32_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
|
||||
{
|
||||
if (strcmp (command, "__WIN32_TASKBAR_TOGGLE__") == 0)
|
||||
{
|
||||
if (gtk_widget_get_visible (current_sess->gui->window))
|
||||
fe_ctrl_gui (current_sess, FE_GUI_ICONIFY, 0);
|
||||
GtkWidget *widget = current_sess->gui->window;
|
||||
GdkWindow *gdk_window = NULL;
|
||||
gboolean hidden = TRUE;
|
||||
|
||||
if (widget)
|
||||
{
|
||||
hidden = !gtk_widget_get_visible (widget);
|
||||
gdk_window = gtk_widget_get_window (widget);
|
||||
if (!hidden && gdk_window &&
|
||||
(gdk_window_get_state (gdk_window) & GDK_WINDOW_STATE_ICONIFIED))
|
||||
hidden = TRUE;
|
||||
}
|
||||
|
||||
if (hidden)
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
gtk_widget_show (widget);
|
||||
gtk_window_deiconify (GTK_WINDOW (widget));
|
||||
gtk_window_present (GTK_WINDOW (widget));
|
||||
}
|
||||
else
|
||||
fe_ctrl_gui (current_sess, FE_GUI_SHOW, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (widget)
|
||||
gtk_window_iconify (GTK_WINDOW (widget));
|
||||
else
|
||||
fe_ctrl_gui (current_sess, FE_GUI_ICONIFY, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
handle_command (current_sess, command, FALSE);
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ if host_machine.system() != 'windows'
|
||||
if appindicator_dep.found()
|
||||
zoitechat_gtk_deps += appindicator_dep
|
||||
zoitechat_gtk_cflags += '-DHAVE_APPINDICATOR'
|
||||
elif appindicator_opt.enabled()
|
||||
error('appindicator=enabled, but neither ayatana-appindicator3-0.1 nor appindicator3-0.1 was found')
|
||||
elif appindicator_opt.enabled() or (appindicator_opt.auto() and host_machine.system() == 'linux')
|
||||
error('tray support requires ayatana-appindicator3-0.1 or appindicator3-0.1 on Linux (use -Dappindicator=disabled to override)')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -364,8 +364,8 @@ tray_app_indicator_set_icon (TrayIcon icon)
|
||||
if (!icon_name)
|
||||
return;
|
||||
|
||||
app_indicator_set_icon_full (tray_indicator, icon_name, _(DISPLAY_NAME));
|
||||
app_indicator_set_status (tray_indicator, APP_INDICATOR_STATUS_ACTIVE);
|
||||
app_indicator_set_icon_full (tray_indicator, icon_name, _(DISPLAY_NAME));
|
||||
|
||||
g_free (icon_name_alloc);
|
||||
}
|
||||
@@ -431,7 +431,6 @@ tray_app_indicator_init (void)
|
||||
g_signal_connect (G_OBJECT (tray_menu), "map",
|
||||
G_CALLBACK (tray_menu_show_cb), NULL);
|
||||
app_indicator_set_menu (tray_indicator, GTK_MENU (tray_menu));
|
||||
app_indicator_set_status (tray_indicator, APP_INDICATOR_STATUS_ACTIVE);
|
||||
|
||||
klass = G_OBJECT_GET_CLASS (tray_indicator);
|
||||
if (klass && g_object_class_find_property (klass, "connected"))
|
||||
@@ -583,23 +582,33 @@ tray_backend_cleanup (void)
|
||||
tray_backend_active = FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
tray_window_is_hidden (GtkWidget *widget)
|
||||
{
|
||||
GdkWindow *gdk_win;
|
||||
|
||||
if (!widget || !gtk_widget_get_visible (widget))
|
||||
return TRUE;
|
||||
|
||||
gdk_win = gtk_widget_get_window (widget);
|
||||
if (gdk_win && (gdk_window_get_state (gdk_win) & GDK_WINDOW_STATE_ICONIFIED))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static WinStatus
|
||||
tray_get_window_status (void)
|
||||
{
|
||||
GtkWindow *win;
|
||||
GtkWidget *widget;
|
||||
GdkWindow *gdk_win;
|
||||
const char *st;
|
||||
|
||||
win = GTK_WINDOW (zoitechat_get_info (ph, "gtkwin_ptr"));
|
||||
if (win)
|
||||
{
|
||||
widget = GTK_WIDGET (win);
|
||||
if (!gtk_widget_get_visible (widget))
|
||||
return WS_HIDDEN;
|
||||
|
||||
gdk_win = gtk_widget_get_window (widget);
|
||||
if (gdk_win && (gdk_window_get_state (gdk_win) & GDK_WINDOW_STATE_ICONIFIED))
|
||||
if (tray_window_is_hidden (widget))
|
||||
return WS_HIDDEN;
|
||||
}
|
||||
|
||||
@@ -854,6 +863,8 @@ tray_toggle_visibility (gboolean force_hide)
|
||||
static int maximized;
|
||||
static int fullscreen;
|
||||
GtkWindow *win;
|
||||
GtkWidget *widget;
|
||||
gboolean hidden;
|
||||
|
||||
if (!tray_backend_active)
|
||||
return FALSE;
|
||||
@@ -869,7 +880,10 @@ tray_toggle_visibility (gboolean force_hide)
|
||||
if (!win)
|
||||
return FALSE;
|
||||
|
||||
if (force_hide || gtk_widget_get_visible (GTK_WIDGET (win)))
|
||||
widget = GTK_WIDGET (win);
|
||||
hidden = tray_window_is_hidden (widget);
|
||||
|
||||
if (force_hide || !hidden)
|
||||
{
|
||||
if (prefs.hex_gui_tray_away)
|
||||
zoitechat_command (ph, "ALLSERV AWAY");
|
||||
@@ -1390,9 +1404,14 @@ tray_apply_setup (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if HAVE_APPINDICATOR_BACKEND
|
||||
if (prefs.hex_gui_tray)
|
||||
tray_init ();
|
||||
#else
|
||||
GtkWindow *window = GTK_WINDOW(zoitechat_get_info (ph, "gtkwin_ptr"));
|
||||
if (prefs.hex_gui_tray && gtkutil_tray_icon_supported (window))
|
||||
tray_init ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1439,7 +1458,11 @@ tray_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name,
|
||||
G_CALLBACK (tray_window_visibility_cb), NULL);
|
||||
}
|
||||
|
||||
#if HAVE_APPINDICATOR_BACKEND
|
||||
if (prefs.hex_gui_tray)
|
||||
#else
|
||||
if (prefs.hex_gui_tray && gtkutil_tray_icon_supported (window))
|
||||
#endif
|
||||
tray_init ();
|
||||
|
||||
return 1; /* return 1 for success */
|
||||
|
||||
@@ -1714,11 +1714,11 @@ setup_create_sound_page (void)
|
||||
|
||||
vbox2 = gtkutil_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||
gtk_widget_show (vbox2);
|
||||
gtk_container_add (GTK_CONTAINER (vbox1), vbox2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), vbox2, TRUE, TRUE, 0);
|
||||
|
||||
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow1);
|
||||
gtk_container_add (GTK_CONTAINER (vbox2), scrolledwindow1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow1, TRUE, TRUE, 0);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1),
|
||||
@@ -1793,7 +1793,7 @@ setup_add_page (const char *title, GtkWidget *book, GtkWidget *tab)
|
||||
gtk_widget_set_margin_bottom (label, 1);
|
||||
gtk_box_pack_start (GTK_BOX (vvbox), label, FALSE, FALSE, 2);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vvbox), tab);
|
||||
gtk_box_pack_start (GTK_BOX (vvbox), tab, TRUE, TRUE, 0);
|
||||
|
||||
sw = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new (NULL, NULL));
|
||||
gtk_scrolled_window_set_shadow_type (sw, GTK_SHADOW_IN);
|
||||
|
||||
Reference in New Issue
Block a user