viking.h (5841B)
1 /* 2 (c) 2009 by Leon Winter 3 (c) 2009-2012 by Hannes Schueller 4 (c) 2009-2010 by Matto Fransen 5 (c) 2010-2011 by Hans-Peter Deifel 6 (c) 2010-2011 by Thomas Adam 7 see LICENSE file 8 */ 9 10 /* macros */ 11 #define LENGTH(x) (sizeof(x)/sizeof(x[0])) 12 13 /* enums */ 14 enum { ModeNormal, ModePassThrough, ModeSendKey, ModeInsert, ModeHints }; /* modes */ 15 enum { TargetCurrent, TargetNew, TargetNewWindow }; /* target */ 16 /* bitmask, 17 1 << 0: 0 = jumpTo, 1 = scroll 18 1 << 1: 0 = top/down, 1 = left/right 19 1 << 2: 0 = top/left, 1 = bottom/right 20 1 << 3: 0 = paging/halfpage, 1 = line 21 1 << 4: 0 = paging, 1 = halfpage aka buffer 22 */ 23 enum { ScrollJumpTo, ScrollMove }; 24 enum { OrientationVert, OrientationHoriz = (1 << 1) }; 25 enum { DirectionTop, 26 DirectionBottom = (1 << 2), 27 DirectionLeft = OrientationHoriz, 28 DirectionRight = OrientationHoriz | (1 << 2) 29 }; 30 enum { UnitPage, 31 UnitLine = (1 << 3), 32 UnitBuffer = (1 << 4) 33 }; 34 /* bitmask: 35 1 << 0: 0 = Reload/Cancel 1 = Forward/Back 36 Forward/Back: 37 1 << 1: 0 = Forward 1 = Back 38 Reload/Cancel: 39 1 << 1: 0 = Cancel 1 = Force/Normal Reload 40 1 << 2: 0 = Force Reload 1 = Reload 41 */ 42 enum { NavigationForwardBack = 1, NavigationReloadActions = (1 << 1) }; 43 enum { NavigationCancel, 44 NavigationBack = (NavigationForwardBack | 1 << 1), 45 NavigationForward = (NavigationForwardBack), 46 NavigationReload = (NavigationReloadActions | 1 << 2), 47 NavigationForceReload = NavigationReloadActions 48 }; 49 /* bitmask: 50 1 << 1: ClipboardPrimary (X11) 51 1 << 2: ClipboardGTK 52 1 << 3: SourceURL 53 1 << 4: SourceSelection 54 */ 55 enum { ClipboardPrimary = 1 << 1, ClipboardGTK = 1 << 2 }; 56 enum { SourceSelection = 1 << 4, SourceURL = 1 << 3 }; 57 58 enum { 59 ZoomReset, 60 ZoomIn, 61 ZoomOut, 62 }; 63 64 /* bitmask: 65 0 = Info, 1 = Warning, 2 = Error 66 1 << 2: 0 = AutoHide 1 = NoAutoHide 67 relevant for script: 68 1 << 3: 1 = Silent (no echo) 69 */ 70 enum { Info, Warning, Error, NoAutoHide = 1 << 2, Silent = 1 << 3 }; 71 enum { NthSubdir, Rootdir }; 72 enum { InsertCurrentURL = 1 }; 73 enum { Increment, Decrement }; 74 /* bitmask: 75 1 << 0: 0 = DirectionNext 1 = DirectionPrev (Relative) 76 1 << 0: 0 = DirectionBackwards 1 = DirectionForward (Absolute) 77 78 1 << 1: 0 = DirectionRelative 1 = DirectionAbsolute 79 80 1 << 2: 0 = CaseInsensitive 1 = CaseSensitive 81 1 << 3: 0 = No Wrapping 1 = Wrapping 82 */ 83 enum { DirectionRelative, DirectionAbsolute = 1 << 1 }; 84 enum { DirectionNext, DirectionPrev, HideCompletion }; 85 enum { DirectionBackwards = DirectionAbsolute, DirectionForward = 86 (1 << 0) | DirectionAbsolute }; 87 enum { CaseInsensitive, CaseSensitive = 1 << 2 }; 88 enum { Wrapping = 1 << 3 }; 89 90 enum { CreateWindow = 1 << 1, DeleteWindow = 1 << 2}; 91 92 enum { 93 CustomUrl = 1 << 1, 94 DefaultUrl = 1 << 2, 95 InNewWindow = 1 << 3, 96 SwitchToBuffer = 1 << 4 97 }; 98 99 100 /* structs here */ 101 typedef struct { 102 int i; 103 char *s; 104 } Arg; 105 106 typedef struct { 107 const char *mask; 108 char modkey; 109 const char *key; 110 Eina_Bool(*func) (const Arg * func, void *); 111 Arg arg; 112 } Key; 113 114 typedef struct { 115 const char *mask; 116 const char *modkey; 117 unsigned int button; 118 Eina_Bool(*func) (const Arg *, void *); 119 const Arg arg; 120 } Mouse; 121 122 typedef struct { 123 char *name; 124 char (*var); 125 char *webkit; 126 Eina_Bool intval; 127 Eina_Bool boolval; 128 Eina_Bool colourval; 129 Eina_Bool reload; 130 } Setting; 131 132 typedef struct { 133 char *cmd; 134 Eina_Bool(*func) (const Arg *, void *); 135 const Arg arg; 136 } Command; 137 138 typedef struct { 139 char *handle; 140 char *handler; 141 } URIHandler; 142 143 144 typedef struct _Buffer_Data Buffer_Data; 145 146 typedef struct 147 { 148 Eina_List *windows; 149 Eina_List *downloads; 150 Eina_List *keylistroot; 151 152 char *modkeys; 153 154 Ecore_Timer *session_save_timer; 155 Ecore_Timer *download_status_timer; 156 157 Hist *history; 158 Config *config; 159 Session *session; 160 161 Eina_Bool exiting : 1; 162 } App_Data; 163 164 typedef struct 165 { 166 Evas_Object *win; 167 Evas_Object *bg; 168 Evas_Object *main_box; 169 Evas_Object *webkit_box; 170 Evas_Object *url; /* "inputbox" */ 171 Evas_Object *event_box; 172 Evas_Object *status_bar; 173 Evas_Object *status_buffer_num; 174 Evas_Object *status_favicon; 175 Evas_Object *status_url; 176 Evas_Object *status_back_forward; 177 Evas_Object *status_modkey; 178 Evas_Object *status_count; 179 Evas_Object *status_zoom; 180 Evas_Object *status_scroll; 181 Evas_Object *web_inspector; 182 Evas_Object *progress_bar; 183 Evas_Object *downloads; 184 185 Eina_List *commandhistory; 186 Eina_List *buffer_list; 187 188 int commandpointer; 189 unsigned int mode; 190 unsigned int count; 191 unsigned int buf_total; 192 Eina_Bool search_direction; 193 Eina_Bool echo_active; 194 Eina_Bool manual_focus; 195 196 char current_modkey; 197 char rememberedURI[1024]; 198 char followTarget[8]; 199 char *error_msg; 200 char *search_handle; 201 202 Session_Window *session_window; 203 Buffer_Data *cur_buf; 204 App_Data *app; 205 } Window_Data; 206 207 struct _Buffer_Data 208 { 209 Evas_Object *view; 210 unsigned int buf_number; 211 unsigned int zoom_level; 212 213 Eina_Bool inspector_enabled; 214 Evas_Object *web_inspector; 215 216 Window_Data *window; 217 }; 218 219 /* constants */ 220 #define BUFFERSIZE 255 221 #define MAXTAGSIZE 200 222 223 /* maximum size of internal string variable handled by :set 224 * if you set this to anything lower than 8, colour values 225 * will stop working */ 226 #define MAX_SETTING_SIZE 1024 227 228 /* completion list size */ 229 #define MAX_LIST_SIZE 40 230 231 #define DEFAULT_URL "http://getaddrinfo.net" 232 #define PACKAGE_NAME "viking" 233 #define PACKAGE_VERSION "1" 234 235 #define CRITICAL(...) EINA_LOG_CRIT(__VA_ARGS__) 236 #define ERR(...) EINA_LOG_ERR(__VA_ARGS__) 237 #define WRN(...) EINA_LOG_WARN(__VA_ARGS__) 238 #define INF(...) EINA_LOG_INFO(__VA_ARGS__) 239 #define DBG(...) EINA_LOG_DBG(__VA_ARGS__) 240 241 #define DEFAULT_ZOOM_LEVEL 5 // Set default zoom level to 1.0 (index 5 on zoomLevels). 242