parent
281038e725
commit
d99cd18fb9
|
@ -1363,18 +1363,6 @@ portable_mode (void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
unity_mode (void)
|
|
||||||
{
|
|
||||||
#ifdef G_OS_UNIX
|
|
||||||
const char *env = g_getenv("XDG_CURRENT_DESKTOP");
|
|
||||||
if (env && (strcmp (env, "Unity") == 0
|
|
||||||
|| strcmp (env, "Pantheon") == 0))
|
|
||||||
return 1;
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
encode_sasl_pass_plain (char *user, char *pass)
|
encode_sasl_pass_plain (char *user, char *pass)
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,7 +76,6 @@ guint32 str_ihash (const unsigned char *key);
|
||||||
void safe_strcpy (char *dest, const char *src, int bytes_left);
|
void safe_strcpy (char *dest, const char *src, int bytes_left);
|
||||||
void canonalize_key (char *key);
|
void canonalize_key (char *key);
|
||||||
int portable_mode (void);
|
int portable_mode (void);
|
||||||
int unity_mode (void);
|
|
||||||
char *encode_sasl_pass_plain (char *user, char *pass);
|
char *encode_sasl_pass_plain (char *user, char *pass);
|
||||||
char *challengeauth_response (const char *username, const char *password, const char *challenge);
|
char *challengeauth_response (const char *username, const char *password, const char *challenge);
|
||||||
size_t strftime_validated (char *dest, size_t destsize, const char *format, const struct tm *time);
|
size_t strftime_validated (char *dest, size_t destsize, const char *format, const struct tm *time);
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GDK_WINDOWING_X11
|
||||||
|
#include <gdk/gdkx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../common/hexchat.h"
|
#include "../common/hexchat.h"
|
||||||
#include "../common/fe.h"
|
#include "../common/fe.h"
|
||||||
#include "../common/util.h"
|
#include "../common/util.h"
|
||||||
|
@ -735,6 +739,32 @@ gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...)
|
||||||
return has_selected;
|
return has_selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gtkutil_tray_icon_supported (GtkWindow *window)
|
||||||
|
{
|
||||||
|
#ifndef GDK_WINDOWING_X11
|
||||||
|
return TRUE;
|
||||||
|
#else
|
||||||
|
GdkScreen *screen = gtk_window_get_screen (window);
|
||||||
|
GdkDisplay *display = gdk_screen_get_display (screen);
|
||||||
|
int screen_number = gdk_screen_get_number (screen);
|
||||||
|
Display *xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||||
|
char *selection_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d", screen_number);
|
||||||
|
Atom selection_atom = XInternAtom (xdisplay, selection_name, False);
|
||||||
|
Window tray_window = None;
|
||||||
|
|
||||||
|
XGrabServer (xdisplay);
|
||||||
|
|
||||||
|
tray_window = XGetSelectionOwner (xdisplay, selection_atom);
|
||||||
|
|
||||||
|
XUngrabServer (xdisplay);
|
||||||
|
XFlush (xdisplay);
|
||||||
|
g_free (selection_name);
|
||||||
|
|
||||||
|
return (tray_window != None);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if defined (WIN32) || defined (__APPLE__)
|
#if defined (WIN32) || defined (__APPLE__)
|
||||||
gboolean
|
gboolean
|
||||||
gtkutil_find_font (const char *fontname)
|
gtkutil_find_font (const char *fontname)
|
||||||
|
|
|
@ -43,6 +43,7 @@ GtkWidget *gtkutil_treeview_new (GtkWidget *box, GtkTreeModel *model,
|
||||||
gboolean gtkutil_treemodel_string_to_iter (GtkTreeModel *model, gchar *pathstr, GtkTreeIter *iter_ret);
|
gboolean gtkutil_treemodel_string_to_iter (GtkTreeModel *model, gchar *pathstr, GtkTreeIter *iter_ret);
|
||||||
gboolean gtkutil_treeview_get_selected_iter (GtkTreeView *view, GtkTreeIter *iter_ret);
|
gboolean gtkutil_treeview_get_selected_iter (GtkTreeView *view, GtkTreeIter *iter_ret);
|
||||||
gboolean gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...);
|
gboolean gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...);
|
||||||
|
gboolean gtkutil_tray_icon_supported (GtkWindow *window);
|
||||||
|
|
||||||
#if defined (WIN32) || defined (__APPLE__)
|
#if defined (WIN32) || defined (__APPLE__)
|
||||||
gboolean gtkutil_find_font (const char *fontname);
|
gboolean gtkutil_find_font (const char *fontname);
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include "plugin-tray.h"
|
#include "plugin-tray.h"
|
||||||
#include "xtext.h"
|
#include "xtext.h"
|
||||||
#include "sexy-spell-entry.h"
|
#include "sexy-spell-entry.h"
|
||||||
|
#include "gtkutil.h"
|
||||||
|
|
||||||
#define GUI_SPACING (3)
|
#define GUI_SPACING (3)
|
||||||
#define GUI_BORDER (0)
|
#define GUI_BORDER (0)
|
||||||
|
@ -430,7 +431,7 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
|
||||||
if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&
|
if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&
|
||||||
(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) &&
|
(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) &&
|
||||||
prefs.hex_gui_tray_minimize && prefs.hex_gui_tray &&
|
prefs.hex_gui_tray_minimize && prefs.hex_gui_tray &&
|
||||||
!unity_mode ())
|
gtkutil_tray_icon_supported (wid))
|
||||||
{
|
{
|
||||||
tray_toggle_visibility (TRUE);
|
tray_toggle_visibility (TRUE);
|
||||||
gtk_window_deiconify (wid);
|
gtk_window_deiconify (wid);
|
||||||
|
@ -1215,7 +1216,7 @@ mg_open_quit_dialog (gboolean minimize_button)
|
||||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1),
|
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1),
|
||||||
GTK_BUTTONBOX_END);
|
GTK_BUTTONBOX_END);
|
||||||
|
|
||||||
if (minimize_button && !unity_mode ())
|
if (minimize_button && gtkutil_tray_icon_supported (GTK_WINDOW(dialog)))
|
||||||
{
|
{
|
||||||
button = gtk_button_new_with_mnemonic (_("_Minimize to Tray"));
|
button = gtk_button_new_with_mnemonic (_("_Minimize to Tray"));
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
@ -3176,8 +3177,9 @@ mg_tabwindow_de_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||||
{
|
{
|
||||||
GSList *list;
|
GSList *list;
|
||||||
session *sess;
|
session *sess;
|
||||||
|
GtkWindow *win = GTK_WINDOW(gtk_widget_get_toplevel (widget));
|
||||||
|
|
||||||
if (prefs.hex_gui_tray_close && !unity_mode () && tray_toggle_visibility (FALSE))
|
if (prefs.hex_gui_tray_close && gtkutil_tray_icon_supported (win) && tray_toggle_visibility (FALSE))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* check for remaining toplevel windows */
|
/* check for remaining toplevel windows */
|
||||||
|
|
|
@ -28,12 +28,17 @@ hexchat_gtk_sources = [
|
||||||
'xtext.c'
|
'xtext.c'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
gtk_dep = dependency('gtk+-2.0', version: '>= 2.24.0')
|
||||||
hexchat_gtk_deps = [
|
hexchat_gtk_deps = [
|
||||||
hexchat_common_dep,
|
hexchat_common_dep,
|
||||||
libgmodule_dep, # used by libsexy
|
libgmodule_dep, # used by libsexy
|
||||||
dependency('gtk+-2.0', version: '>= 2.24.0')
|
gtk_dep
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if gtk_dep.get_pkgconfig_variable('target') == 'x11'
|
||||||
|
hexchat_gtk_deps += dependency('x11')
|
||||||
|
endif
|
||||||
|
|
||||||
hexchat_gtk_cflags = [
|
hexchat_gtk_cflags = [
|
||||||
'-fPIE'
|
'-fPIE'
|
||||||
]
|
]
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "pixmaps.h"
|
#include "pixmaps.h"
|
||||||
#include "maingui.h"
|
#include "maingui.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
#include "gtkutil.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -759,7 +760,8 @@ tray_apply_setup (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (prefs.hex_gui_tray && !unity_mode ())
|
GtkWindow *window = GTK_WINDOW(hexchat_get_info (ph, "gtkwin_ptr"));
|
||||||
|
if (prefs.hex_gui_tray && gtkutil_tray_icon_supported (window))
|
||||||
tray_init ();
|
tray_init ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -793,7 +795,8 @@ tray_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name,
|
||||||
|
|
||||||
hexchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
|
hexchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
|
||||||
|
|
||||||
if (prefs.hex_gui_tray && !unity_mode ())
|
GtkWindow *window = GTK_WINDOW(hexchat_get_info (ph, "gtkwin_ptr"));
|
||||||
|
if (prefs.hex_gui_tray && gtkutil_tray_icon_supported (window))
|
||||||
tray_init ();
|
tray_init ();
|
||||||
|
|
||||||
return 1; /* return 1 for success */
|
return 1; /* return 1 for success */
|
||||||
|
|
|
@ -1895,6 +1895,7 @@ static GtkWidget *
|
||||||
setup_create_pages (GtkWidget *box)
|
setup_create_pages (GtkWidget *box)
|
||||||
{
|
{
|
||||||
GtkWidget *book;
|
GtkWidget *book;
|
||||||
|
GtkWindow *win = GTK_WINDOW(gtk_widget_get_toplevel (box));
|
||||||
|
|
||||||
book = gtk_notebook_new ();
|
book = gtk_notebook_new ();
|
||||||
|
|
||||||
|
@ -1906,11 +1907,11 @@ setup_create_pages (GtkWidget *box)
|
||||||
|
|
||||||
setup_add_page (cata[8], book, setup_create_page (general_settings));
|
setup_add_page (cata[8], book, setup_create_page (general_settings));
|
||||||
|
|
||||||
if (unity_mode () && !notification_backend_supported ())
|
if (!gtkutil_tray_icon_supported (win) && !notification_backend_supported ())
|
||||||
{
|
{
|
||||||
setup_add_page (cata[9], book, setup_create_page (alert_settings_unityandnonotifications));
|
setup_add_page (cata[9], book, setup_create_page (alert_settings_unityandnonotifications));
|
||||||
}
|
}
|
||||||
else if (unity_mode ())
|
else if (!gtkutil_tray_icon_supported (win))
|
||||||
{
|
{
|
||||||
setup_add_page (cata[9], book, setup_create_page (alert_settings_unity));
|
setup_add_page (cata[9], book, setup_create_page (alert_settings_unity));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue