Loading src/events.c +2 −2 Original line number Diff line number Diff line Loading @@ -322,7 +322,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev) } else { D(("Received other ButtonPress event\n")); feh_event_handle_generic(winwid, state, NoSymbol, button); feh_event_handle_generic(winwid, state, NoSymbol, button, NULL, 0); } return; } Loading Loading @@ -694,7 +694,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev) thumbnail = feh_thumbnail_get_thumbnail_from_coords(x, y); feh_thumbnail_select(winwid, thumbnail); } else { feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0); feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0, NULL, 0); } } } Loading src/feh.h +2 −2 Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ void setup_stdin(void); void restore_stdin(void); void feh_event_handle_keypress(XEvent * ev); void feh_event_handle_stdin(void); void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button); void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button, char *buf, unsigned int buf_len); fehkey *feh_str_to_kb(char * action); void feh_action_run(feh_file * file, char *action, winwidget winwid); char *format_size(double size); Loading Loading @@ -211,10 +211,10 @@ extern XineramaScreenInfo *xinerama_screens; extern int xinerama_screen; #endif /* HAVE_LIBXINERAMA */ /* Thumbnail sizes */ extern int cmdargc; extern char **cmdargv; extern Window root; extern XIC input_context; extern XContext xid_context; extern Screen *scr; extern unsigned char reset_output; Loading src/imlib.c +10 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <arpa/inet.h> #include <netdb.h> #include <locale.h> #ifdef HAVE_LIBCURL #include <curl/curl.h> #endif Loading @@ -61,6 +63,7 @@ magic_t magic = NULL; Display *disp = NULL; Visual *vis = NULL; Screen *scr = NULL; XIC input_context; Colormap cm; int depth; Atom wmDeleteWindow; Loading Loading @@ -128,6 +131,10 @@ void init_imlib_fonts(void) void init_x_and_imlib(void) { setlocale(LC_ALL, ""); if (XSupportsLocale()) { XSetLocaleModifiers("@im=none"); } disp = XOpenDisplay(NULL); if (!disp) eprintf("Can't open X display. It *is* running, yeah?"); Loading @@ -138,6 +145,9 @@ void init_x_and_imlib(void) scr = ScreenOfDisplay(disp, DefaultScreen(disp)); xid_context = XUniqueContext(); XIM im = XOpenIM(disp, NULL, NULL, NULL); input_context = XCreateIC(im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, NULL); #ifdef HAVE_LIBXINERAMA init_xinerama(); #endif /* HAVE_LIBXINERAMA */ Loading src/keyevents.c +21 −7 Original line number Diff line number Diff line Loading @@ -360,7 +360,7 @@ void feh_event_handle_stdin(void) keysym = XStringToKeysym(stdin_buf); if (window_num && keysym) feh_event_handle_generic(windows[0], is_esc * Mod1Mask, keysym, 0); feh_event_handle_generic(windows[0], is_esc * Mod1Mask, keysym, 0, NULL, 0); is_esc = 0; } Loading @@ -383,7 +383,13 @@ void feh_event_handle_keypress(XEvent * ev) } kev = (XKeyEvent *) ev; XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, NULL); int kbuf_used = Xutf8LookupString(input_context, kev, (char *) kbuf, sizeof(kbuf), &keysym, NULL); if (kbuf_used < sizeof(kbuf)) { kbuf[kbuf_used] = 0; } else { kbuf[19] = 0; } D(("Xutf8LookupString set kbuf = %s, keysym = %08x\n", kbuf, keysym)); state = kev->state & (ControlMask | ShiftMask | Mod1Mask | Mod4Mask); if (ignore_space(keysym)) Loading @@ -410,7 +416,12 @@ void feh_event_handle_keypress(XEvent * ev) if (winwid == NULL) return; feh_event_handle_generic(winwid, state, keysym, 0); if (XFilterEvent(ev, None)) { D(("Event filtered\n")); return; } feh_event_handle_generic(winwid, state, keysym, 0, kbuf, kbuf_used); } fehkey *feh_str_to_kb(char *action) Loading @@ -423,7 +434,7 @@ fehkey *feh_str_to_kb(char *action) return NULL; } void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button) { void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button, char *buf, unsigned int buf_len) { int curr_screen = 0; if (winwid->caption_entry && (keysym != NoSymbol)) { Loading Loading @@ -468,11 +479,14 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy winwidget_render_image_cached(winwid); break; default: if (isascii(keysym)) { /* append to caption */ if ((buf != NULL) && buf_len) { ESTRAPPEND(FEH_FILE(winwid->file->data)->caption, buf); } else if (isascii(keysym)) { // TODO update feh_event_handle_stdin to pass buf as well. ESTRAPPEND_CHAR(FEH_FILE(winwid->file->data)->caption, keysym); winwidget_render_image_cached(winwid); } winwidget_render_image_cached(winwid); break; } return; Loading src/winwidget.c +5 −0 Original line number Diff line number Diff line Loading @@ -858,6 +858,11 @@ void winwidget_show(winwidget winwid) XMapWindow(disp, winwid->win); if (opt.full_screen) XMoveWindow(disp, winwid->win, 0, 0); XSetICValues(input_context, XNClientWindow, winwid->win, NULL); //XSelectInput(disp, winwid->win, ButtonPressMask|StructureNotifyMask|KeyPressMask|KeyReleaseMask); XSetICFocus(input_context); /* wait for the window to map */ D(("Waiting for window to map\n")); XMaskEvent(disp, StructureNotifyMask, &ev); Loading Loading
src/events.c +2 −2 Original line number Diff line number Diff line Loading @@ -322,7 +322,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev) } else { D(("Received other ButtonPress event\n")); feh_event_handle_generic(winwid, state, NoSymbol, button); feh_event_handle_generic(winwid, state, NoSymbol, button, NULL, 0); } return; } Loading Loading @@ -694,7 +694,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev) thumbnail = feh_thumbnail_get_thumbnail_from_coords(x, y); feh_thumbnail_select(winwid, thumbnail); } else { feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0); feh_event_handle_generic(winwid, ev->xmotion.state | Mod3Mask, NoSymbol, 0, NULL, 0); } } } Loading
src/feh.h +2 −2 Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ void setup_stdin(void); void restore_stdin(void); void feh_event_handle_keypress(XEvent * ev); void feh_event_handle_stdin(void); void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button); void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button, char *buf, unsigned int buf_len); fehkey *feh_str_to_kb(char * action); void feh_action_run(feh_file * file, char *action, winwidget winwid); char *format_size(double size); Loading Loading @@ -211,10 +211,10 @@ extern XineramaScreenInfo *xinerama_screens; extern int xinerama_screen; #endif /* HAVE_LIBXINERAMA */ /* Thumbnail sizes */ extern int cmdargc; extern char **cmdargv; extern Window root; extern XIC input_context; extern XContext xid_context; extern Screen *scr; extern unsigned char reset_output; Loading
src/imlib.c +10 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <arpa/inet.h> #include <netdb.h> #include <locale.h> #ifdef HAVE_LIBCURL #include <curl/curl.h> #endif Loading @@ -61,6 +63,7 @@ magic_t magic = NULL; Display *disp = NULL; Visual *vis = NULL; Screen *scr = NULL; XIC input_context; Colormap cm; int depth; Atom wmDeleteWindow; Loading Loading @@ -128,6 +131,10 @@ void init_imlib_fonts(void) void init_x_and_imlib(void) { setlocale(LC_ALL, ""); if (XSupportsLocale()) { XSetLocaleModifiers("@im=none"); } disp = XOpenDisplay(NULL); if (!disp) eprintf("Can't open X display. It *is* running, yeah?"); Loading @@ -138,6 +145,9 @@ void init_x_and_imlib(void) scr = ScreenOfDisplay(disp, DefaultScreen(disp)); xid_context = XUniqueContext(); XIM im = XOpenIM(disp, NULL, NULL, NULL); input_context = XCreateIC(im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, NULL); #ifdef HAVE_LIBXINERAMA init_xinerama(); #endif /* HAVE_LIBXINERAMA */ Loading
src/keyevents.c +21 −7 Original line number Diff line number Diff line Loading @@ -360,7 +360,7 @@ void feh_event_handle_stdin(void) keysym = XStringToKeysym(stdin_buf); if (window_num && keysym) feh_event_handle_generic(windows[0], is_esc * Mod1Mask, keysym, 0); feh_event_handle_generic(windows[0], is_esc * Mod1Mask, keysym, 0, NULL, 0); is_esc = 0; } Loading @@ -383,7 +383,13 @@ void feh_event_handle_keypress(XEvent * ev) } kev = (XKeyEvent *) ev; XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, NULL); int kbuf_used = Xutf8LookupString(input_context, kev, (char *) kbuf, sizeof(kbuf), &keysym, NULL); if (kbuf_used < sizeof(kbuf)) { kbuf[kbuf_used] = 0; } else { kbuf[19] = 0; } D(("Xutf8LookupString set kbuf = %s, keysym = %08x\n", kbuf, keysym)); state = kev->state & (ControlMask | ShiftMask | Mod1Mask | Mod4Mask); if (ignore_space(keysym)) Loading @@ -410,7 +416,12 @@ void feh_event_handle_keypress(XEvent * ev) if (winwid == NULL) return; feh_event_handle_generic(winwid, state, keysym, 0); if (XFilterEvent(ev, None)) { D(("Event filtered\n")); return; } feh_event_handle_generic(winwid, state, keysym, 0, kbuf, kbuf_used); } fehkey *feh_str_to_kb(char *action) Loading @@ -423,7 +434,7 @@ fehkey *feh_str_to_kb(char *action) return NULL; } void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button) { void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button, char *buf, unsigned int buf_len) { int curr_screen = 0; if (winwid->caption_entry && (keysym != NoSymbol)) { Loading Loading @@ -468,11 +479,14 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy winwidget_render_image_cached(winwid); break; default: if (isascii(keysym)) { /* append to caption */ if ((buf != NULL) && buf_len) { ESTRAPPEND(FEH_FILE(winwid->file->data)->caption, buf); } else if (isascii(keysym)) { // TODO update feh_event_handle_stdin to pass buf as well. ESTRAPPEND_CHAR(FEH_FILE(winwid->file->data)->caption, keysym); winwidget_render_image_cached(winwid); } winwidget_render_image_cached(winwid); break; } return; Loading
src/winwidget.c +5 −0 Original line number Diff line number Diff line Loading @@ -858,6 +858,11 @@ void winwidget_show(winwidget winwid) XMapWindow(disp, winwid->win); if (opt.full_screen) XMoveWindow(disp, winwid->win, 0, 0); XSetICValues(input_context, XNClientWindow, winwid->win, NULL); //XSelectInput(disp, winwid->win, ButtonPressMask|StructureNotifyMask|KeyPressMask|KeyReleaseMask); XSetICFocus(input_context); /* wait for the window to map */ D(("Waiting for window to map\n")); XMaskEvent(disp, StructureNotifyMask, &ev); Loading