Re: Key binding for viewing page source
Alexander Voigt <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Sep 19, 2012 at 09:06:22PM +0000, corvid wrote: > I was thinking that the key check might fit more naturally in UI::handle() > rather than CustTabs::handle(), but I see that ui.cc doesn't currently know > anything about nav or history, so now I'm not sure... If it is not fundamental a design decision to leave ui.cc blind for the nav and the history, one can include nav.h and history.h in ui.cc and move the key check there (see attached patch). Best, Alex _______________________________________________ Dillo-dev mailing list [email protected] http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
view_source_keybinding2.patch
(text/x-diff, 1.9 KB)
diff -r cfe557c0700b src/keys.cc
--- a/src/keys.cc Tue Sep 18 02:27:31 2012 +0000
+++ b/src/keys.cc Thu Sep 20 09:09:39 2012 +0200
@@ -134,6 +134,7 @@
{ "right" , KEYS_RIGHT , 0 , FL_Right },
{ "top" , KEYS_TOP , 0 , FL_Home },
{ "bottom" , KEYS_BOTTOM , 0 , FL_End },
+ { "view-source" , KEYS_VIEW_SOURCE , FL_CTRL , 'u' },
};
static Dlist *bindings;
diff -r cfe557c0700b src/keys.hh
--- a/src/keys.hh Tue Sep 18 02:27:31 2012 +0000
+++ b/src/keys.hh Thu Sep 20 09:09:39 2012 +0200
@@ -46,7 +46,8 @@
KEYS_LEFT,
KEYS_RIGHT,
KEYS_TOP,
- KEYS_BOTTOM
+ KEYS_BOTTOM,
+ KEYS_VIEW_SOURCE
} KeysCommand_t;
class Keys {
diff -r cfe557c0700b src/keysrc
--- a/src/keysrc Tue Sep 18 02:27:31 2012 +0000
+++ b/src/keysrc Thu Sep 20 09:09:39 2012 +0200
@@ -72,6 +72,9 @@
# "file-menu" pops up the file menu.
#<alt>f = file-menu
+# view page source
+#<ctrl>u = view-source
+
# "goto" goes to the location bar at the top of the window.
#<ctrl>l = goto
diff -r cfe557c0700b src/ui.cc
--- a/src/ui.cc Tue Sep 18 02:27:31 2012 +0000
+++ b/src/ui.cc Thu Sep 20 09:09:39 2012 +0200
@@ -29,6 +29,9 @@
#include "pixmaps.h"
#include "uicmd.hh"
+#include "history.h"
+#include "nav.h"
+
struct iconset {
Fl_Image *ImgMeterOK, *ImgMeterBug,
*ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools,
@@ -764,6 +767,11 @@
} else if (cmd == KEYS_FILE_MENU) {
a_UIcmd_file_popup(a_UIcmd_get_bw_by_widget(this), FileButton);
ret = 1;
+ } else if (cmd == KEYS_VIEW_SOURCE) {
+ BrowserWindow *bw = a_UIcmd_get_bw_by_widget(this);
+ const DilloUrl *url = a_History_get_url(NAV_TOP_UIDX(bw));
+ a_UIcmd_view_page_source(bw, url);
+ ret = 1;
}
} else if (event == FL_RELEASE) {
if (Fl::event_button() == FL_MIDDLE_MOUSE &&