ソースを参照

Double click on thumbnail to open image

master
Bert Münnich 11年前
コミット
ed69b483ed
2個のファイルの変更12行の追加7行の削除
  1. +10
    -6
      main.c
  2. +2
    -1
      types.h

+ 10
- 6
main.c ファイルの表示

@@ -553,6 +553,7 @@ void on_keypress(XKeyEvent *kev)
void on_buttonpress(XButtonEvent *bev) void on_buttonpress(XButtonEvent *bev)
{ {
int i, sel; int i, sel;
static Time firstclick;


if (bev == NULL) if (bev == NULL)
return; return;
@@ -580,17 +581,20 @@ void on_buttonpress(XButtonEvent *bev)
switch (bev->button) { switch (bev->button) {
case Button1: case Button1:
if ((sel = tns_translate(&tns, bev->x, bev->y)) >= 0) { if ((sel = tns_translate(&tns, bev->x, bev->y)) >= 0) {
if (sel == tns.sel) { if (sel != tns.sel) {
tns_highlight(&tns, tns.sel, false);
tns_highlight(&tns, sel, true);
tns.sel = sel;
firstclick = bev->time;
redraw();
} else if (bev->time - firstclick <= TO_DOUBLE_CLICK) {
mode = MODE_IMAGE; mode = MODE_IMAGE;
set_timeout(reset_cursor, TO_CURSOR_HIDE, true); set_timeout(reset_cursor, TO_CURSOR_HIDE, true);
load_image(tns.sel); load_image(tns.sel);
redraw();
} else { } else {
tns_highlight(&tns, tns.sel, false); firstclick = bev->time;
tns_highlight(&tns, sel, true);
tns.sel = sel;
} }
redraw();
break;
} }
break; break;
case Button3: case Button3:


+ 2
- 1
types.h ファイルの表示

@@ -76,7 +76,8 @@ typedef struct {
enum { enum {
TO_REDRAW_RESIZE = 75, TO_REDRAW_RESIZE = 75,
TO_REDRAW_THUMBS = 200, TO_REDRAW_THUMBS = 200,
TO_CURSOR_HIDE = 1200 TO_CURSOR_HIDE = 1200,
TO_DOUBLE_CLICK = 300
}; };


typedef void (*timeout_f)(void); typedef void (*timeout_f)(void);


||||||
x
 
000:0
読み込み中…
キャンセル
保存