patch history menu positioning

"corvid" <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <20110915151713.GB11600@local>
I was just thinking that it would be nice if the history menus were
positioned like the tools menu.

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
history_popup_position.patch (text/plain, 3.2 KB)
diff -r c65ce48b7ec9 src/menu.cc
--- a/src/menu.cc	Wed Sep 14 21:33:51 2011 +0000
+++ b/src/menu.cc	Thu Sep 15 15:10:44 2011 +0000
@@ -528,14 +528,14 @@
  *
  * direction: {backward = -1, forward = 1}
  */
-void a_Menu_history_popup(BrowserWindow *bw, int direction)
+void a_Menu_history_popup(BrowserWindow *bw, int x, int y, int direction)
 {
    static Fl_Menu_Item *pm = 0;
    int i, n;
 
    popup_bw = bw;
-   popup_x = Fl::event_x();
-   popup_y = Fl::event_y();
+   popup_x = x;
+   popup_y = y;
    history_direction = direction;
 
    // TODO: hook popdown event with delete or similar.
diff -r c65ce48b7ec9 src/menu.hh
--- a/src/menu.hh	Wed Sep 14 21:33:51 2011 +0000
+++ b/src/menu.hh	Thu Sep 15 15:10:44 2011 +0000
@@ -17,7 +17,7 @@
                        void *vform, bool_t showing_hiddens);
 void a_Menu_file_popup(BrowserWindow *bw, void *v_wid);
 void a_Menu_bugmeter_popup(BrowserWindow *bw, const DilloUrl *url);
-void a_Menu_history_popup(BrowserWindow *bw, int direction);
+void a_Menu_history_popup(BrowserWindow *bw, int x, int y, int direction);
 void a_Menu_tools_popup(BrowserWindow *bw, void *v_wid);
 
 
diff -r c65ce48b7ec9 src/ui.cc
--- a/src/ui.cc	Wed Sep 14 21:33:51 2011 +0000
+++ b/src/ui.cc	Thu Sep 15 15:10:44 2011 +0000
@@ -305,14 +305,16 @@
       if (b == FL_LEFT_MOUSE) {
          a_UIcmd_back(a_UIcmd_get_bw_by_widget(wid));
       } else if (b == FL_RIGHT_MOUSE) {
-         a_UIcmd_back_popup(a_UIcmd_get_bw_by_widget(wid));
+         a_UIcmd_back_popup(a_UIcmd_get_bw_by_widget(wid), wid->x(),
+                            wid->y() + wid->h());
       }
       break;
    case UI_FORW:
       if (b == FL_LEFT_MOUSE) {
          a_UIcmd_forw(a_UIcmd_get_bw_by_widget(wid));
       } else if (b == FL_RIGHT_MOUSE) {
-         a_UIcmd_forw_popup(a_UIcmd_get_bw_by_widget(wid));
+         a_UIcmd_forw_popup(a_UIcmd_get_bw_by_widget(wid), wid->x(),
+                            wid->y() + wid->h());
       }
       break;
    case UI_HOME:
diff -r c65ce48b7ec9 src/uicmd.cc
--- a/src/uicmd.cc	Wed Sep 14 21:33:51 2011 +0000
+++ b/src/uicmd.cc	Thu Sep 15 15:10:44 2011 +0000
@@ -686,9 +686,9 @@
 /*
  * Popup the navigation menu of the Back button
  */
-void a_UIcmd_back_popup(void *vbw)
+void a_UIcmd_back_popup(void *vbw, int x, int y)
 {
-   a_Menu_history_popup((BrowserWindow*)vbw, -1);
+   a_Menu_history_popup((BrowserWindow*)vbw, x, y, -1);
 }
 
 /*
@@ -702,9 +702,9 @@
 /*
  * Popup the navigation menu of the Forward button
  */
-void a_UIcmd_forw_popup(void *vbw)
+void a_UIcmd_forw_popup(void *vbw, int x, int y)
 {
-   a_Menu_history_popup((BrowserWindow*)vbw, 1);
+   a_Menu_history_popup((BrowserWindow*)vbw, x, y, 1);
 }
 
 /*
diff -r c65ce48b7ec9 src/uicmd.hh
--- a/src/uicmd.hh	Wed Sep 14 21:33:51 2011 +0000
+++ b/src/uicmd.hh	Thu Sep 15 15:10:44 2011 +0000
@@ -17,9 +17,9 @@
 void a_UIcmd_open_url_nw(BrowserWindow *bw, const DilloUrl *url);
 void a_UIcmd_open_url_nt(void *vbw, const DilloUrl *url, int focus);
 void a_UIcmd_back(void *vbw);
-void a_UIcmd_back_popup(void *vbw);
+void a_UIcmd_back_popup(void *vbw, int x, int y);
 void a_UIcmd_forw(void *vbw);
-void a_UIcmd_forw_popup(void *vbw);
+void a_UIcmd_forw_popup(void *vbw, int x, int y);
 void a_UIcmd_home(void *vbw);
 void a_UIcmd_reload(void *vbw);
 void a_UIcmd_repush(void *vbw);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.