Fixed none opening image hints without surrounding link.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 22 Jun 2013 16:51:24 +0000 (18:51 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 22 Jun 2013 16:51:24 +0000 (18:51 +0200)
Image hints could not be opened if they where not within a link, because
clicking an image has no effect here. Now the image src is processed within
the c-layer to open it.

Makefile
src/hints.c
src/hints.h

index 67c4ad6..77aa5e9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ $(TARGET): $(OBJ)
        @echo "$(CC) $@"
        @$(CC) $(OBJ) -o $(TARGET) $(LDFLAGS)
 
-%.o: %.c $(HEAD)
+%.o: %.c %.h src/config.h
        @echo "${CC} $<"
        @$(CC) -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
 
index 0ebe2a7..2163120 100644 (file)
@@ -87,7 +87,9 @@ void hints_create(const char *input, guint mode, const guint prefixLength)
             type = 'i';
         }
 
-        if (mode & HINTS_PROCESS_OPEN) {
+        /* images cant be opened from javascript by click event so we precess
+         * the image source in this file */
+        if (mode & HINTS_PROCESS_OPEN && type != 'i') {
             usage = mode & HINTS_OPEN_NEW ? 'T' : 'O';
         } else {
             usage = 'U';
@@ -164,6 +166,11 @@ static void run_script(char *js)
             a.s = g_strconcat((mode & HINTS_OPEN_NEW) ? ":tabopen " : ":open ", v, NULL);
             command_input(&a);
             g_free(a.s);
+        } else if (mode & HINTS_PROCESS_OPEN) {
+            /* used if images should be opened */
+            a.s = v;
+            a.i = (mode & HINTS_OPEN_NEW) ? VB_TARGET_NEW : VB_TARGET_CURRENT;
+            command_open(&a);
         } else if (mode & HINTS_PROCESS_SAVE) {
             a.s = v;
             a.i = COMMAND_SAVE_URI;
index 52d4220..aee0db0 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "main.h"
 
-#define HINTS_GET_TYPE(n) ((n) & (HINTS_TYPE_LINK | HINTS_TYPE_IMAGE | HINTS_TYPE_EDITABLE))
+#define HINTS_GET_TYPE(n) ((n) & (HINTS_TYPE_LINK | HINTS_TYPE_IMAGE))
 
 enum {
     HINTS_TYPE_LINK     = 1,
@@ -32,6 +32,7 @@ enum {
     HINTS_PROCESS_YANK  = (1 << 3),
     HINTS_PROCESS_OPEN  = (1 << 4),
     HINTS_PROCESS_SAVE  = (1 << 5),
+    /* additional flag for HINTS_PROCESS_OPEN */
     HINTS_OPEN_NEW      = (1 << 6),
 };