#include <gdk/gdkkeysyms-compat.h>
#include "hints.h"
#include "dom.h"
+#include "main.h"
#define MAX_HINTS 200
#define HINT_CONTAINER_ID "__hint_container"
const gchar* input, Window* win, gulong top_width,
gulong top_height, gulong offsetX, gulong offsetY);
static void hints_focus(const gulong num);
+static void hints_fire(const gulong num);
static Hint* hints_get_hint_by_number(const gulong num);
static GList* hints_get_hint_list_by_number(const gulong num);
static gchar* hints_get_xpath(const gchar* input);
}
}
-void hints_fire(const gulong num)
-{
- PRINT_DEBUG("fire hint %lu", num);
-}
-
void hints_clear_focus(void)
{
currentFocusNum = num;
}
+static void hints_fire(const gulong num)
+{
+ Hint* hint = hints_get_hint_by_number(num);
+ if (hint) {
+ Element* element = hint->elem;
+ /* TODO
+ * if the elemt has a target attribute - remove it temporary
+ * fire mousedown and click events on the element
+ * if it is an form element focus it and return
+ * get the src or href attribute and call vp_fired_hint */
+
+ Arg a;
+ a.i = currentMode;
+ a.s = webkit_dom_html_anchor_element_get_href(WEBKIT_DOM_HTML_ANCHOR_ELEMENT(element));
+ vp_fired_hint(&a);
+
+ hints_clear();
+ }
+}
+
static Hint* hints_get_hint_by_number(const gulong num)
{
GList* list = hints_get_hint_list_by_number(num);
void hints_create(const gchar* input, HintMode mode);
void hints_update(const gulong num);
-void hints_fire(const gulong num);
void hints_clear(void);
void hints_clear_focus(void);
void hints_focus_next(const gboolean back);
g_free(uri);
/* change state to normal mode */
- vp_set_mode(VP_MODE_NORMAL, FALSE);
+ vp_set_mode(VP_MODE_NORMAL, TRUE);
return TRUE;
}
}
}
+void vp_fired_hint(const Arg* arg)
+{
+ vp_load_uri(arg);
+}
+
static void vp_print_version(void)
{
fprintf(stderr, "%s/%s (build %s %s)\n", VERSION, PROJECT, __DATE__, __TIME__);
void vp_update_statusbar(void);
void vp_update_urlbar(const gchar* uri);
void vp_echo(const MessageType type, gboolean hide, const char *error, ...);
+void vp_fired_hint(const Arg* arg);
gboolean vp_set_mode(Mode mode, gboolean clean);
void vp_set_widget_font(GtkWidget* widget, const VpColor* fg, const VpColor* bg, PangoFontDescription* font);
gboolean vp_load_uri(const Arg* arg);