mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-06-08 16:00:18 +00:00
Merge pull request #238 from ZoiteChat/win32-taskbar-icon-identity
Set Windows AppUserModelID before GTK startup
This commit is contained in:
@@ -124,6 +124,25 @@ create_msg_dialog (gchar *title, gchar *message)
|
||||
|
||||
static char *win32_argv0_dir;
|
||||
|
||||
static void
|
||||
win32_set_appusermodelid (void)
|
||||
{
|
||||
HMODULE shell32;
|
||||
HRESULT (WINAPI *set_appid) (PCWSTR);
|
||||
|
||||
shell32 = GetModuleHandleW (L"shell32.dll");
|
||||
if (!shell32)
|
||||
shell32 = LoadLibraryW (L"shell32.dll");
|
||||
if (!shell32)
|
||||
return;
|
||||
|
||||
set_appid = (HRESULT (WINAPI *) (PCWSTR)) GetProcAddress (shell32, "SetCurrentProcessExplicitAppUserModelID");
|
||||
if (!set_appid)
|
||||
return;
|
||||
|
||||
set_appid (L"ZoiteChat.Desktop.Notify");
|
||||
}
|
||||
|
||||
static void
|
||||
win32_set_gsettings_schema_dir (void)
|
||||
{
|
||||
@@ -422,6 +441,7 @@ fe_args (int argc, char *argv[])
|
||||
|
||||
#ifdef WIN32
|
||||
win32_set_gsettings_schema_dir ();
|
||||
win32_set_appusermodelid ();
|
||||
win32_configure_pixbuf_loaders ();
|
||||
|
||||
/* this is mainly for irc:// URL handling. When windows calls us from */
|
||||
|
||||
@@ -902,7 +902,12 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
|
||||
if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&
|
||||
(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) &&
|
||||
prefs.hex_gui_tray_minimize && prefs.hex_gui_tray &&
|
||||
gtkutil_tray_icon_supported (wid))
|
||||
gtkutil_tray_icon_supported (wid)
|
||||
#ifndef WIN32
|
||||
)
|
||||
#else
|
||||
&& !gtk_window_is_active (wid))
|
||||
#endif
|
||||
{
|
||||
tray_toggle_visibility (TRUE);
|
||||
}
|
||||
@@ -947,7 +952,8 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
|
||||
if (sess && sess->gui && GTK_IS_WIDGET (sess->gui->window))
|
||||
gtk_widget_queue_draw (sess->gui->window);
|
||||
|
||||
menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen);
|
||||
if (current_sess && current_sess->gui)
|
||||
menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
mg_win32_allow_autohide_taskbar (wid, event);
|
||||
@@ -4727,7 +4733,14 @@ 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))
|
||||
GdkWindowState state = 0;
|
||||
GdkWindow *gdk_window = gtk_widget_get_window (current_sess->gui->window);
|
||||
|
||||
if (gdk_window)
|
||||
state = gdk_window_get_state (gdk_window);
|
||||
|
||||
if (gtk_widget_get_visible (current_sess->gui->window)
|
||||
&& (state & GDK_WINDOW_STATE_ICONIFIED) == 0)
|
||||
fe_ctrl_gui (current_sess, FE_GUI_ICONIFY, 0);
|
||||
else
|
||||
fe_ctrl_gui (current_sess, FE_GUI_SHOW, 0);
|
||||
|
||||
@@ -920,7 +920,10 @@ tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data)
|
||||
{
|
||||
if (!tray_backend_is_embedded ())
|
||||
{
|
||||
tray_restore_timer = g_timeout_add(500, (GSourceFunc)tray_menu_try_restore, NULL);
|
||||
if (!tray_restore_timer)
|
||||
{
|
||||
tray_restore_timer = g_timeout_add (500, (GSourceFunc) tray_menu_try_restore, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -936,9 +939,10 @@ tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data)
|
||||
static gboolean
|
||||
tray_menu_try_restore (void)
|
||||
{
|
||||
tray_cleanup();
|
||||
tray_init();
|
||||
return TRUE;
|
||||
tray_restore_timer = 0;
|
||||
tray_cleanup ();
|
||||
tray_init ();
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user