Add fullscreen to to view menu

This commit is contained in:
TingPing 2013-09-19 17:52:17 -04:00
parent cd825ac735
commit f6ba274134
5 changed files with 35 additions and 7 deletions

View File

@ -477,6 +477,7 @@ const struct prefs vars[] =
{"gui_url_mod", P_OFFINT (hex_gui_url_mod), TYPE_INT}, {"gui_url_mod", P_OFFINT (hex_gui_url_mod), TYPE_INT},
{"gui_usermenu", P_OFFINT (hex_gui_usermenu), TYPE_BOOL}, {"gui_usermenu", P_OFFINT (hex_gui_usermenu), TYPE_BOOL},
{"gui_win_height", P_OFFINT (hex_gui_win_height), TYPE_INT}, {"gui_win_height", P_OFFINT (hex_gui_win_height), TYPE_INT},
{"gui_win_fullscreen", P_OFFINT (hex_gui_win_fullscreen), TYPE_INT},
{"gui_win_left", P_OFFINT (hex_gui_win_left), TYPE_INT}, {"gui_win_left", P_OFFINT (hex_gui_win_left), TYPE_INT},
{"gui_win_modes", P_OFFINT (hex_gui_win_modes), TYPE_BOOL}, {"gui_win_modes", P_OFFINT (hex_gui_win_modes), TYPE_BOOL},
{"gui_win_save", P_OFFINT (hex_gui_win_save), TYPE_BOOL}, {"gui_win_save", P_OFFINT (hex_gui_win_save), TYPE_BOOL},

View File

@ -289,6 +289,7 @@ struct hexchatprefs
int hex_gui_ulist_sort; int hex_gui_ulist_sort;
int hex_gui_url_mod; int hex_gui_url_mod;
int hex_gui_win_height; int hex_gui_win_height;
int hex_gui_win_fullscreen;
int hex_gui_win_left; int hex_gui_win_left;
int hex_gui_win_state; int hex_gui_win_state;
int hex_gui_win_top; int hex_gui_win_top;

View File

@ -495,6 +495,10 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
prefs.hex_gui_win_state = 1; prefs.hex_gui_win_state = 1;
prefs.hex_gui_win_fullscreen = 0;
if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
prefs.hex_gui_win_fullscreen = 1;
return FALSE; return FALSE;
} }
@ -505,7 +509,7 @@ mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
{ {
if (mg_gui) if (mg_gui)
{ {
if (prefs.hex_gui_win_save) if (prefs.hex_gui_win_save && !prefs.hex_gui_win_state && !prefs.hex_gui_win_fullscreen)
{ {
sess = current_sess; sess = current_sess;
gtk_window_get_position (GTK_WINDOW (wid), &prefs.hex_gui_win_left, gtk_window_get_position (GTK_WINDOW (wid), &prefs.hex_gui_win_left,
@ -3313,6 +3317,8 @@ mg_create_tabwindow (session *sess)
prefs.hex_gui_win_top); prefs.hex_gui_win_top);
if (prefs.hex_gui_win_state) if (prefs.hex_gui_win_state)
gtk_window_maximize (GTK_WINDOW (win)); gtk_window_maximize (GTK_WINDOW (win));
if (prefs.hex_gui_win_fullscreen)
gtk_window_fullscreen (GTK_WINDOW (win));
gtk_container_set_border_width (GTK_CONTAINER (win), GUI_BORDER); gtk_container_set_border_width (GTK_CONTAINER (win), GUI_BORDER);
g_signal_connect (G_OBJECT (win), "delete_event", g_signal_connect (G_OBJECT (win), "delete_event",

View File

@ -890,6 +890,23 @@ menu_cmbuttons_toggle (GtkWidget *wid, gpointer ud)
prefs.hex_gui_mode_buttons); prefs.hex_gui_mode_buttons);
} }
static void
menu_fullscreen_toggle (GtkWidget *wid, gpointer ud)
{
if (!prefs.hex_gui_win_fullscreen)
gtk_window_fullscreen (GTK_WINDOW(parent_window));
else
{
gtk_window_unfullscreen (GTK_WINDOW(parent_window));
/* At least on Windows we need to manually reposition the window */
gtk_window_resize (GTK_WINDOW(parent_window),
prefs.hex_gui_win_width, prefs.hex_gui_win_height);
gtk_window_move (GTK_WINDOW(parent_window),
prefs.hex_gui_win_left, prefs.hex_gui_win_top);
}
}
void void
menu_middlemenu (session *sess, GdkEventButton *event) menu_middlemenu (session *sess, GdkEventButton *event)
{ {
@ -1722,6 +1739,8 @@ static struct mymenu mymenu[] = {
{N_("Text"), menu_metres_text, 0, M_MENURADIO, 0, 0, 1}, {N_("Text"), menu_metres_text, 0, M_MENURADIO, 0, 0, 1},
{N_("Both"), menu_metres_both, 0, M_MENURADIO, 0, 0, 1}, {N_("Both"), menu_metres_both, 0, M_MENURADIO, 0, 0, 1},
{0, 0, 0, M_END, 0, 0, 0}, /* 32 */ {0, 0, 0, M_END, 0, 0, 0}, /* 32 */
{ 0, 0, 0, M_SEP, 0, 0, 0 },
{N_ ("Toggle _Fullscreen"), menu_fullscreen_toggle, 0, M_MENUITEM, 0, 0, 1, GDK_KEY_F11},
{N_("_Server"), 0, 0, M_NEWMENU, 0, 0, 1}, {N_("_Server"), 0, 0, M_NEWMENU, 0, 0, 1},
{N_("_Disconnect"), menu_disconnect, GTK_STOCK_DISCONNECT, M_MENUSTOCK, MENU_ID_DISCONNECT, 0, 1}, {N_("_Disconnect"), menu_disconnect, GTK_STOCK_DISCONNECT, M_MENUSTOCK, MENU_ID_DISCONNECT, 0, 1},
@ -1729,7 +1748,7 @@ static struct mymenu mymenu[] = {
{N_("_Join a Channel..."), menu_join, GTK_STOCK_JUMP_TO, M_MENUSTOCK, MENU_ID_JOIN, 0, 1}, {N_("_Join a Channel..."), menu_join, GTK_STOCK_JUMP_TO, M_MENUSTOCK, MENU_ID_JOIN, 0, 1},
{N_("_List of Channels..."), menu_chanlist, GTK_STOCK_INDEX, M_MENUITEM, 0, 0, 1}, {N_("_List of Channels..."), menu_chanlist, GTK_STOCK_INDEX, M_MENUITEM, 0, 0, 1},
{0, 0, 0, M_SEP, 0, 0, 0}, {0, 0, 0, M_SEP, 0, 0, 0},
#define AWAY_OFFSET (39) #define AWAY_OFFSET (41)
{N_("Marked _Away"), menu_away, 0, M_MENUTOG, MENU_ID_AWAY, 0, 1, GDK_a}, {N_("Marked _Away"), menu_away, 0, M_MENUTOG, MENU_ID_AWAY, 0, 1, GDK_a},
{N_("_Usermenu"), 0, 0, M_NEWMENU, MENU_ID_USERMENU, 0, 1}, /* 40 */ {N_("_Usermenu"), 0, 0, M_NEWMENU, MENU_ID_USERMENU, 0, 1}, /* 40 */
@ -1762,7 +1781,7 @@ static struct mymenu mymenu[] = {
{N_("_Copy Selection"), menu_copy_selection, 0, M_MENUITEM, 0, 0, 1, GDK_C}, {N_("_Copy Selection"), menu_copy_selection, 0, M_MENUITEM, 0, 0, 1, GDK_C},
{N_("C_lear Text"), menu_flushbuffer, GTK_STOCK_CLEAR, M_MENUSTOCK, 0, 0, 1}, {N_("C_lear Text"), menu_flushbuffer, GTK_STOCK_CLEAR, M_MENUSTOCK, 0, 0, 1},
{N_("Save Text..."), menu_savebuffer, GTK_STOCK_SAVE, M_MENUSTOCK, 0, 0, 1}, {N_("Save Text..."), menu_savebuffer, GTK_STOCK_SAVE, M_MENUSTOCK, 0, 0, 1},
#define SEARCH_OFFSET 68 #define SEARCH_OFFSET (70)
{N_("Search"), 0, GTK_STOCK_JUSTIFY_LEFT, M_MENUSUB, 0, 0, 1}, {N_("Search"), 0, GTK_STOCK_JUSTIFY_LEFT, M_MENUSUB, 0, 0, 1},
{N_("Search Text..."), menu_search, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_f}, {N_("Search Text..."), menu_search, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_f},
{N_("Search Next" ), menu_search_next, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_g}, {N_("Search Next" ), menu_search_next, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_g},
@ -1770,11 +1789,7 @@ static struct mymenu mymenu[] = {
{0, 0, 0, M_END, 0, 0, 0}, {0, 0, 0, M_END, 0, 0, 0},
{N_("_Help"), 0, 0, M_NEWMENU, 0, 0, 1}, /* 74 */ {N_("_Help"), 0, 0, M_NEWMENU, 0, 0, 1}, /* 74 */
{N_("_Contents"), menu_docs, GTK_STOCK_HELP, M_MENUSTOCK, 0, 0, 1, GDK_F1}, {N_("_Contents"), menu_docs, GTK_STOCK_HELP, M_MENUSTOCK, 0, 0, 1, GDK_F1},
#if 0
{N_("Check for updates"), menu_update, 0, M_MENUITEM, 0, 1},
#endif
{N_("_About"), menu_about, GTK_STOCK_ABOUT, M_MENUSTOCK, 0, 0, 1}, {N_("_About"), menu_about, GTK_STOCK_ABOUT, M_MENUSTOCK, 0, 0, 1},
{0, 0, 0, M_END, 0, 0, 0}, {0, 0, 0, M_END, 0, 0, 0},
@ -2296,6 +2311,7 @@ normalitem:
gtk_widget_add_accelerator (item, "activate", accel_group, gtk_widget_add_accelerator (item, "activate", accel_group,
mymenu[i].key, mymenu[i].key,
mymenu[i].key == GDK_F1 ? 0 : mymenu[i].key == GDK_F1 ? 0 :
mymenu[i].key == GDK_F11 ? 0 :
mymenu[i].key == GDK_w ? close_mask : mymenu[i].key == GDK_w ? close_mask :
(g_ascii_isupper (mymenu[i].key)) ? (g_ascii_isupper (mymenu[i].key)) ?
STATE_SHIFT | STATE_CTRL : STATE_SHIFT | STATE_CTRL :

View File

@ -408,6 +408,7 @@ tray_toggle_visibility (gboolean force_hide)
static int x, y; static int x, y;
static GdkScreen *screen; static GdkScreen *screen;
static int maximized; static int maximized;
static int fullscreen;
GtkWindow *win; GtkWindow *win;
if (!sticon) if (!sticon)
@ -431,6 +432,7 @@ tray_toggle_visibility (gboolean force_hide)
gtk_window_get_position (win, &x, &y); gtk_window_get_position (win, &x, &y);
screen = gtk_window_get_screen (win); screen = gtk_window_get_screen (win);
maximized = prefs.hex_gui_win_state; maximized = prefs.hex_gui_win_state;
fullscreen = prefs.hex_gui_win_fullscreen;
gtk_widget_hide (GTK_WIDGET (win)); gtk_widget_hide (GTK_WIDGET (win));
} }
else else
@ -441,6 +443,8 @@ tray_toggle_visibility (gboolean force_hide)
gtk_window_move (win, x, y); gtk_window_move (win, x, y);
if (maximized) if (maximized)
gtk_window_maximize (win); gtk_window_maximize (win);
if (fullscreen)
gtk_window_fullscreen (win);
gtk_widget_show (GTK_WIDGET (win)); gtk_widget_show (GTK_WIDGET (win));
gtk_window_present (win); gtk_window_present (win);
} }