Remove most of HexTray and one instance

You can still build HexTray manually if you want to try fixing it
This commit is contained in:
Berke Viktor 2013-04-02 11:55:54 -07:00
parent 7317535c28
commit 5e59578e28
9 changed files with 7 additions and 181 deletions

View File

@ -1008,46 +1008,6 @@ hexchat_execv (char * const argv[])
#endif
}
#if 0 /* def WIN32 */
static void
xchat_restore_window (HWND hexchat_window)
{
/* ShowWindow (hexchat_window, SW_RESTORE); another way, but works worse */
SendMessage (hexchat_window, WM_SYSCOMMAND, SC_RESTORE, 0);
SetForegroundWindow (hexchat_window);
}
BOOL CALLBACK
enum_windows_impl (HWND current_window, LPARAM lParam)
{
TCHAR window_name[8];
TCHAR module_path[1024];
ZeroMemory (&window_name, sizeof (window_name));
if (!current_window)
{
return TRUE;
}
GetWindowText (current_window, window_name, 8); /* name length + 1 */
if (strcmp (window_name, "HexChat") == 0)
{
/* use a separate if block, this way we don't have to call GetWindowModuleFileName() for each hit */
ZeroMemory (&module_path, sizeof (module_path));
GetWindowModuleFileName (current_window, module_path, sizeof (module_path));
if (strstr (module_path, "hexchat.exe")) /* We've found it, stop */
{
xchat_restore_window (current_window);
return FALSE;
}
}
return TRUE; /* Keep searching */
}
#endif
int
main (int argc, char *argv[])
{
@ -1056,7 +1016,6 @@ main (int argc, char *argv[])
#ifdef WIN32
char hexchat_lang[13]; /* LC_ALL= plus 5 chars of hex_gui_lang and trailing \0 */
/* HANDLE mutex; */
#endif
srand (time (0)); /* CL: do this only once! */
@ -1257,33 +1216,6 @@ main (int argc, char *argv[])
}
putenv (hexchat_lang);
#if 0
if (prefs.hex_gui_single && !portable_mode ())
{
DWORD error;
mutex = CreateMutex (NULL, TRUE, "Local\\hexchat");
error = GetLastError ();
if (error == ERROR_ALREADY_EXISTS || mutex == NULL)
{
/* Restoring the HexChat window from the tray via the taskbar icon.
* Only works correctly when HexTray is used.
*/
if (hextray_mode ())
{
/* FindWindow() doesn't support wildcards so we check all the open windows */
EnumWindows (enum_windows_impl, (LPARAM) NULL);
return 0;
}
else
{
return 1;
}
}
}
#endif
#endif
#ifdef SOCKS
@ -1323,14 +1255,6 @@ main (int argc, char *argv[])
#ifdef WIN32
WSACleanup ();
#if 0
if (prefs.hex_gui_single && !portable_mode ())
{
ReleaseMutex (mutex);
CloseHandle (mutex);
}
#endif
#endif
return 0;

View File

@ -471,7 +471,6 @@ plugin_auto_load (session *sess)
for_files (".\\plugins", "hcdoat.dll", plugin_auto_load_cb);
for_files (".\\plugins", "hcexec.dll", plugin_auto_load_cb);
for_files (".\\plugins", "hcfishlim.dll", plugin_auto_load_cb);
/* for_files (".\\plugins", "hchextray.dll", plugin_auto_load_cb); don't load HexTray until it's fixed */
for_files (".\\plugins", "hcmpcinfo.dll", plugin_auto_load_cb);
for_files (".\\plugins", "hcperl.dll", plugin_auto_load_cb);
for_files (".\\plugins", "hcpython.dll", plugin_auto_load_cb);

View File

@ -1860,23 +1860,6 @@ portable_mode ()
#endif
}
int
hextray_mode ()
{
#ifdef WIN32
if ((_access( "plugins/hchextray.dll", 0 )) != -1)
{
return 1;
}
else
{
return 0;
}
#else
return 0;
#endif
}
int
unity_mode ()
{

View File

@ -78,7 +78,6 @@ guint32 str_ihash (const unsigned char *key);
void safe_strcpy (char *dest, const char *src, int bytes_left);
void canonalize_key (char *key);
int portable_mode ();
int hextray_mode ();
int unity_mode ();
GSList *get_subdirs (const char *path);
char *encode_sasl_pass (char *user, char *pass);

View File

@ -501,7 +501,7 @@ 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 && !hextray_mode () && !unity_mode ())
prefs.hex_gui_tray_minimize && !unity_mode ())
{
tray_toggle_visibility (TRUE);
gtk_window_deiconify (wid);
@ -1295,7 +1295,7 @@ mg_open_quit_dialog (gboolean minimize_button)
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1),
GTK_BUTTONBOX_END);
if (minimize_button && !hextray_mode () && !unity_mode ())
if (minimize_button && !unity_mode ())
{
button = gtk_button_new_with_mnemonic (_("_Minimize to Tray"));
gtk_widget_show (button);
@ -1594,10 +1594,7 @@ mg_create_alertmenu (session *sess, GtkWidget *menu)
mg_perchan_menu_item (_("Beep on _Message"), submenu, &sess->alert_beep, prefs.hex_input_beep_chans);
if (!hextray_mode ()) /*disable this context menu item when HexTray is loaded */
{
mg_perchan_menu_item (_("Blink Tray _Icon"), submenu, &sess->alert_tray, prefs.hex_input_tray_chans);
}
mg_perchan_menu_item (_("Blink Task _Bar"), submenu, &sess->alert_taskbar, prefs.hex_input_flash_chans);
}
@ -3087,7 +3084,7 @@ mg_tabwindow_de_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
GSList *list;
session *sess;
if (prefs.hex_gui_tray_close && !hextray_mode () && !unity_mode () && tray_toggle_visibility (FALSE))
if (prefs.hex_gui_tray_close && !unity_mode () && tray_toggle_visibility (FALSE))
return TRUE;
/* check for remaining toplevel windows */

View File

@ -853,7 +853,7 @@ tray_apply_setup (void)
}
else
{
if (prefs.hex_gui_tray && !hextray_mode () && !unity_mode ())
if (prefs.hex_gui_tray && !unity_mode ())
tray_init ();
}
}
@ -885,7 +885,7 @@ tray_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name,
hexchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
if (prefs.hex_gui_tray && !hextray_mode () && !unity_mode ())
if (prefs.hex_gui_tray && !unity_mode ())
tray_init ();
return 1; /* return 1 for success */

View File

@ -498,27 +498,6 @@ static const setting alert_settings_unity[] =
{ST_END, 0, 0, 0, 0, 0}
};
static const setting alert_settings_hextray[] =
{
{ST_HEADER, N_("Alerts"),0,0,0},
{ST_ALERTHEAD},
{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 0, 0, 0},
{ST_HEADER, N_("Highlighted Messages"),0,0,0},
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
{ST_ENTRY, N_("Extra words to highlight:"), P_OFFSETNL(hex_irc_extra_hilight), 0, 0, sizeof prefs.hex_irc_extra_hilight},
{ST_ENTRY, N_("Nick names not to highlight:"), P_OFFSETNL(hex_irc_no_hilight), 0, 0, sizeof prefs.hex_irc_no_hilight},
{ST_ENTRY, N_("Nick names to always highlight:"), P_OFFSETNL(hex_irc_nick_hilight), 0, 0, sizeof prefs.hex_irc_nick_hilight},
{ST_LABEL, N_("Separate multiple words with commas.\nWildcards are accepted.")},
{ST_END, 0, 0, 0, 0, 0}
};
static const setting general_settings[] =
{
{ST_HEADER, N_("Default Messages"),0,0,0},
@ -568,39 +547,6 @@ static const setting advanced_settings[] =
{ST_END, 0, 0, 0, 0, 0}
};
#ifdef WIN32
static const setting advanced_settings_oneinstance[] =
{
{ST_HEADER, N_("Advanced Settings"),0,0,0},
{ST_ENTRY, N_("Alternative fonts:"), P_OFFSETNL(hex_text_font_alternative), "Separate multiple entries with commas without spaces before or after.", 0, sizeof prefs.hex_text_font_alternative},
{ST_NUMBER, N_("Auto reconnect delay:"), P_OFFINTNL(hex_net_reconnect_delay), 0, 0, 9999},
{ST_NUMBER, N_("Auto join delay:"), P_OFFINTNL(hex_irc_join_delay), 0, 0, 9999},
{ST_TOGGLE, N_("Display MODEs in raw form"), P_OFFINTNL(hex_irc_raw_modes), 0, 0, 0},
{ST_TOGGLE, N_("Whois on notify"), P_OFFINTNL(hex_notify_whois_online), N_("Sends a /WHOIS when a user comes online in your notify list."), 0, 0},
{ST_TOGGLE, N_("Hide join and part messages"), P_OFFINTNL(hex_irc_conf_mode), N_("Hide channel join/part messages by default."), 0, 0},
/* {ST_TOGGLE, N_("Allow only one instance of HexChat to run"), P_OFFINTNL(hex_gui_single), 0, 0, 0}, */
{ST_TOGGLE, N_("Display lists in compact mode"), P_OFFINTNL(hex_gui_compact), N_("Use less spacing between user list/channel tree rows."), 0, 0},
{ST_HEADER, N_("Auto Open DCC Windows"),0,0,0},
{ST_TOGGLE, N_("Send window"), P_OFFINTNL(hex_gui_autoopen_send), 0, 0, 0},
{ST_TOGGLE, N_("Receive window"), P_OFFINTNL(hex_gui_autoopen_recv), 0, 0, 0},
{ST_TOGGLE, N_("Chat window"), P_OFFINTNL(hex_gui_autoopen_chat), 0, 0, 0},
{ST_HEADER, N_("Auto Copy Behavior"),0,0,0},
{ST_TOGGLE, N_("Automatically copy selected text"), P_OFFINTNL(hex_text_autocopy_text),
N_("Copy selected text to clipboard when left mouse button is released. "
"Otherwise, CONTROL-SHIFT-C will copy the "
"selected text to the clipboard."), 0, 0},
{ST_TOGGLE, N_("Automatically include time stamps"), P_OFFINTNL(hex_text_autocopy_stamp),
N_("Automatically include time stamps in copied lines of text. Otherwise, "
"include time stamps if the SHIFT key is held down while selecting."), 0, 0},
{ST_TOGGLE, N_("Automatically include color information"), P_OFFINTNL(hex_text_autocopy_color),
N_("Automatically include color information in copied lines of text. "
"Otherwise, include color information if the CONTROL key is held down "
"while selecting."), 0, 0},
{ST_END, 0, 0, 0, 0, 0}
};
#endif
static const setting logging_settings[] =
{
{ST_HEADER, N_("Logging"),0,0,0},
@ -1982,11 +1928,7 @@ setup_create_pages (GtkWidget *box)
setup_add_page (cata[4], book, setup_create_page (tabs_settings));
setup_add_page (cata[5], book, setup_create_color_page ());
if (hextray_mode ())
{
setup_add_page (cata[8], book, setup_create_page (alert_settings_hextray));
}
else if (unity_mode ())
if (unity_mode ())
{
setup_add_page (cata[8], book, setup_create_page (alert_settings_unity));
}
@ -1998,21 +1940,6 @@ setup_create_pages (GtkWidget *box)
setup_add_page (cata[9], book, setup_create_page (general_settings));
setup_add_page (cata[10], book, setup_create_page (logging_settings));
setup_add_page (cata[11], book, setup_create_sound_page ());
#if 0 /* maybe sometime we'll have a working one-instance implementation, till then this is BS */
#ifdef WIN32
if (portable_mode ())
{
setup_add_page (cata[12], book, setup_create_page (advanced_settings));
}
else
{
setup_add_page (cata[12], book, setup_create_page (advanced_settings_oneinstance));
}
#else
setup_add_page (cata[12], book, setup_create_page (advanced_settings));
#endif
#endif
setup_add_page (cata[12], book, setup_create_page (advanced_settings));
setup_add_page (cata[14], book, setup_create_page (network_settings));

View File

@ -83,7 +83,6 @@ copy "$(HexChatBin)hcdns.dll" "$(HexChatRel)\plugins"
copy "$(HexChatBin)hcdoat.dll" "$(HexChatRel)\plugins"
copy "$(HexChatBin)hcexec.dll" "$(HexChatRel)\plugins"
copy "$(HexChatBin)hcfishlim.dll" "$(HexChatRel)\plugins"
copy "$(HexChatBin)hchextray.dll" "$(HexChatRel)\plugins"
copy "$(HexChatBin)hcmpcinfo.dll" "$(HexChatRel)\plugins"
copy "$(HexChatBin)hcperl-516.dll" "$(HexChatRel)\plugins"
::copy "$(HexChatBin)hcperl-518.dll" "$(HexChatRel)\plugins"

View File

@ -163,9 +163,7 @@ Global
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}.Release|x64.ActiveCfg = Release|x64
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}.Release|x64.Build.0 = Release|x64
{3024CF36-85E5-4E00-9608-7002E2C7EF14}.Release|Win32.ActiveCfg = Release|Win32
{3024CF36-85E5-4E00-9608-7002E2C7EF14}.Release|Win32.Build.0 = Release|Win32
{3024CF36-85E5-4E00-9608-7002E2C7EF14}.Release|x64.ActiveCfg = Release|x64
{3024CF36-85E5-4E00-9608-7002E2C7EF14}.Release|x64.Build.0 = Release|x64
{E7F4DB0A-510D-41EF-B284-6E1DE1CC450D}.Release|Win32.ActiveCfg = Release|Win32
{E7F4DB0A-510D-41EF-B284-6E1DE1CC450D}.Release|Win32.Build.0 = Release|Win32
{E7F4DB0A-510D-41EF-B284-6E1DE1CC450D}.Release|x64.ActiveCfg = Release|x64