changeset 1953:808ca0de6d8f

Made fullscreen work again (Ctrl+Space)
author Jorge Arellano Cid <jcid@dillo.org>
date Wed, 23 Mar 2011 11:42:35 -0300
parents fb462b4abcfa
children b0fd6feb8c51
files src/ui.cc src/ui.hh
diffstat 2 files changed, 36 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui.cc	Fri Mar 18 16:25:58 2011 +0000
+++ b/src/ui.cc	Wed Mar 23 11:42:35 2011 -0300
@@ -356,16 +356,6 @@
 }
 
 /*
- * Callback handler for fullscreen button press
- */
-//static void fullscreen_cb(Fl_Widget *wid, void *data)
-//{
-//   /* TODO: do we want to toggle fullscreen or panelmode?
-//            maybe we need to add another button?*/
-//   ((UI*)data)->panelmode_cb_i();
-//}
-
-/*
  * Callback for the bug meter button.
  */
 static void bugmeter_cb(Fl_Widget *wid, void *data)
@@ -658,6 +648,8 @@
 {
    PointerOnLink = FALSE;
 
+   LocBar = NavBar = StatusBar = NULL;
+
    Tabs = NULL;
    TabTooltip = NULL;
    TopGroup = this;
@@ -797,7 +789,7 @@
          a_UIcmd_save(a_UIcmd_get_bw_by_widget(this));
          ret = 1;
       } else if (cmd == KEYS_FULLSCREEN) {
-         //panelmode_cb_i();
+         fullscreen_toggle();
          ret = 1;
       } else if (cmd == KEYS_FILE_MENU) {
          a_UIcmd_file_popup(a_UIcmd_get_bw_by_widget(this), FileButton);
@@ -1127,5 +1119,37 @@
       FindBarSpace = 0;
       redraw();  /* Main->redraw(); is not enough */
    }
+}
 
+/*
+ * Make panels disappear growing the render area.
+ * WORKAROUND: here we avoid hidden widgets resize by setting their
+ *             size to (0,0) while hidden.
+ *             (Already reported to FLTK team)
+ */
+void UI::fullscreen_toggle()
+{
+   int dh = 0;
+   int hide = StatusBar->visible();
+
+   // hide/show panels
+   init_sizes();
+   if (LocBar) {
+      dh += lh;
+      hide ? LocBar->size(0,0) : LocBar->size(w(),lh);
+      hide ? LocBar->hide() : LocBar->show();
+   }
+   if (NavBar) {
+      dh += nh;
+      hide ? NavBar->size(0,0) : NavBar->size(w(),nh);
+      hide ? NavBar->hide() : NavBar->show();
+   }
+   if (StatusBar) {
+      dh += sh;
+      hide ? StatusBar->size(0,0) : StatusBar->size(w(),sh);;
+      hide ? StatusBar->hide() : StatusBar->show();;
+   }
+
+   Main->size(Main->w(), Main->h() + (hide ? dh : -dh));
+   redraw();
 }
--- a/src/ui.hh	Fri Mar 18 16:25:58 2011 +0000
+++ b/src/ui.hh	Wed Mar 23 11:42:35 2011 -0300
@@ -169,8 +169,7 @@
    void set_panelmode(UIPanelmode mode);
    UIPanelmode get_panelmode();
    void findbar_toggle(bool add);
-   Fl_Widget *fullscreen_button() { return FullScreen; }
-   void fullscreen_toggle() { FullScreen->do_callback(); }
+   void fullscreen_toggle();
 
    CustTabs *tabs() { return Tabs; }
    void tabs(CustTabs *tabs) { Tabs = tabs; }