browser mode - clean up and dot some i's and corss some t's

hide control bar/pos when in browse mode, disable lots of key controls
and pause/unpause click and a bunch more. much cleaner now
v-0.4.0
Carsten Haitzler 5 years ago
parent 712d88dbf0
commit 8dfcdf2435
  1. 72
      data/themes/default.edc
  2. 36
      src/bin/browser.c
  3. 1
      src/bin/browser.h
  4. 40
      src/bin/key.c
  5. 1
      src/bin/win.c

@ -47,17 +47,43 @@ collections {
public pos_timer;
public drag_is_down;
public novideo;
public browser;
public pos_timeout(val) {
set_int(pos_visible, 0);
set_int(pos_timer, 0);
stop_program(PROGRAM:"posshow");
run_program(PROGRAM:"poshide");
if (!get_int(novideo)) {
if (get_int(pos_visible)) {
set_int(pos_visible, 0);
stop_program(PROGRAM:"poshide");
stop_program(PROGRAM:"posshow");
run_program(PROGRAM:"poshide");
stop_program(PROGRAM:"cbarhide");
stop_program(PROGRAM:"cbarshow");
run_program(PROGRAM:"cbarhide");
}
}
public pos_show() {
if (!get_int(browser)) {
new t;
if (!get_int(pos_visible)) {
set_int(pos_visible, 1);
stop_program(PROGRAM:"poshide");
stop_program(PROGRAM:"posshow");
run_program(PROGRAM:"posshow");
stop_program(PROGRAM:"cbarhide");
stop_program(PROGRAM:"cbarshow");
run_program(PROGRAM:"cbarshow");
}
t = get_int(pos_timer);
if (t) cancel_timer(t);
if (!get_int(novideo)) {
t = timer(5.0, "pos_timeout", 1);
} else {
t = 0;
}
set_int(pos_timer, t);
}
}
}
parts {
@ -403,12 +429,14 @@ collections {
signal: "state,novideo"; source: "rage";
script {
set_int(novideo, 1);
pos_show();
}
}
program {
signal: "state,video"; source: "rage";
script {
set_int(novideo, 0);
pos_show();
}
}
@ -462,6 +490,17 @@ collections {
transition: DECELERATE 0.3;
target: "rage.browser";
}
program {
signal: "browser,state,visible"; source: "rage";
script {
set_int(browser, 1);
if (get_int(pos_visible)) {
new t = get_int(pos_timer);
if (t) cancel_timer(t);
pos_timeout(0);
}
}
}
program {
signal: "browser,state,hidden"; source: "rage";
action: STATE_SET "default" 0.0;
@ -471,6 +510,13 @@ collections {
}
program { name: "browser_hidden";
action: SIGNAL_EMIT "browser,state,hidden,finished" "rage";
after: "browser_hidden2";
}
program { name: "browser_hidden2";
script {
set_int(browser, 0);
pos_show();
}
}
part { name: "rage.list"; type: SWALLOW;
@ -1615,24 +1661,10 @@ collections {
color: 0 0 0 0;
}
}
program { name: "move1";
program { // mouse moves around causing control bar to show until idle
signal: "mouse,move"; source: "event";
script {
new t;
if (!get_int(pos_visible)) {
stop_program(PROGRAM:"poshide");
run_program(PROGRAM:"posshow");
if (!get_int(novideo)) {
stop_program(PROGRAM:"cbarhide");
run_program(PROGRAM:"cbarshow");
}
set_int(pos_visible, 1);
}
t = get_int(pos_timer);
if (t) cancel_timer(t);
t = timer(5.0, "pos_timeout", 1);
set_int(pos_timer, t);
pos_show();
}
}
program { name: "posshow";

@ -892,6 +892,8 @@ _cb_key_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
{
Evas_Event_Key_Down *ev = event_info;
Evas_Object *win = data;
printf("brow %s\n", ev->key);
if ((!strcmp(ev->key, "Left")) ||
(!strcmp(ev->key, "bracketleft")))
{
@ -903,17 +905,23 @@ _cb_key_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
_sel_go(win, dir_entry, 1, 0);
}
else if ((!strcmp(ev->key, "Up")) ||
(!strcmp(ev->key, "Prior")) ||
(!strcmp(ev->key, "XF86AudioPrev")))
{
_sel_go(win, dir_entry, 0, -1);
}
else if ((!strcmp(ev->key, "Prior")))
{
_sel_go(win, dir_entry, 0, -10);
}
else if ((!strcmp(ev->key, "Down")) ||
(!strcmp(ev->key, "Next")) ||
(!strcmp(ev->key, "XF86AudioNext")))
{
_sel_go(win, dir_entry, 0, 1);
}
else if ((!strcmp(ev->key, "Next")))
{
_sel_go(win, dir_entry, 0, 10);
}
else if ((!strcmp(ev->key, "space")) ||
(!strcmp(ev->key, "Pause")) ||
(!strcmp(ev->keyname, "p")) ||
@ -930,6 +938,24 @@ _cb_key_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
browser_hide(win);
}
else key_handle(win, ev);
elm_object_focus_set(bt, EINA_TRUE);
}
static Ecore_Timer *focus_timer = NULL;
static Eina_Bool
_browser_focus_timer_cb(void *data)
{
focus_timer = NULL;
elm_object_focus_set(data, EINA_TRUE);
return EINA_FALSE;
}
Eina_Bool
browser_visible(void)
{
if (bx) return EINA_TRUE;
return EINA_FALSE;
}
void
@ -968,9 +994,11 @@ browser_show(Evas_Object *win)
elm_win_resize_object_add(win, bt);
evas_object_lower(bt);
evas_object_show(bt);
elm_object_focus_set(bt, EINA_TRUE);
evas_object_event_callback_add(bt, EVAS_CALLBACK_KEY_DOWN,
_cb_key_down, win);
if (focus_timer) ecore_timer_del(focus_timer);
focus_timer = ecore_timer_add(0.7, _browser_focus_timer_cb, bt);
}
elm_layout_signal_emit(inf->lay, "browser,state,visible", "rage");
}
@ -998,6 +1026,8 @@ browser_hide(Evas_Object *win)
Inf *inf = evas_object_data_get(win, "inf");
if (!bx) return;
if (focus_timer) ecore_timer_del(focus_timer);
focus_timer = NULL;
elm_layout_signal_callback_add(inf->lay, "browser,state,hidden,finished", "rage",
_cb_hidden, win);
elm_layout_signal_emit(inf->lay, "browser,state,hidden", "rage");

@ -1,6 +1,7 @@
#ifndef _BROWSER_H__
#define _BROWSER_H__ 1
Eina_Bool browser_visible(void);
void browser_show(Evas_Object *win);
void browser_hide(Evas_Object *win);
void browser_toggle(Evas_Object *win);

@ -15,6 +15,7 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
if ((!strcmp(ev->key, "Left")) ||
(!strcmp(ev->key, "bracketleft")))
{
if (browser_visible()) return;
if ((video_spu_button_count(inf->vid) > 0) &&
(!strcmp(ev->key, "Left")))
video_event_send(inf->vid, EMOTION_EVENT_LEFT);
@ -44,6 +45,7 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
double pos = video_position_get(inf->vid);
double len = video_length_get(inf->vid);
if (browser_visible()) return;
if ((video_spu_button_count(inf->vid) > 0) &&
(!strcmp(ev->key, "Right")))
video_event_send(inf->vid, EMOTION_EVENT_RIGHT);
@ -68,6 +70,7 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
(!strcmp(ev->key, "plus")) ||
(!strcmp(ev->key, "equal")))
{
if (browser_visible()) return;
if ((video_spu_button_count(inf->vid) > 0) &&
(!strcmp(ev->key, "Up")))
video_event_send(inf->vid, EMOTION_EVENT_UP);
@ -82,6 +85,7 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
else if ((!strcmp(ev->key, "Down")) ||
(!strcmp(ev->key, "minus")))
{
if (browser_visible()) return;
if ((video_spu_button_count(inf->vid) > 0) &&
(!strcmp(ev->key, "Down")))
video_event_send(inf->vid, EMOTION_EVENT_DOWN);
@ -98,6 +102,7 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
(!strcmp(ev->keyname, "p")) ||
(!strcmp(ev->key, "XF86AudioPlay")))
{
if (browser_visible()) return;
win_do_play_pause(win);
}
else if ((!strcmp(ev->keyname, "s")) ||
@ -105,6 +110,7 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
(!strcmp(ev->key, "BackSpace")) ||
(!strcmp(ev->key, "Delete")))
{
if (browser_visible()) return;
video_stop(inf->vid);
elm_layout_signal_emit(inf->lay, "action,stop", "rage");
elm_layout_signal_emit(inf->lay, "state,default", "rage");
@ -120,30 +126,36 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
else if ((!strcmp(ev->key, "Prior")) ||
(!strcmp(ev->key, "XF86AudioPrev")))
{
if (browser_visible()) return;
win_do_prev(win);
}
else if ((!strcmp(ev->key, "Next")) ||
(!strcmp(ev->key, "XF86AudioNext")))
{
if (browser_visible()) return;
win_do_next(win);
}
else if (!strcmp(ev->key, "Home"))
{
if (browser_visible()) return;
if (win_video_have_prev(win)) win_video_first(win);
else win_video_prev(win);
}
else if (!strcmp(ev->key, "End"))
{
if (browser_visible()) return;
if (win_video_have_next(win)) win_video_last(win);
else win_video_next(win);
}
else if (!strcmp(ev->key, "Delete"))
{
if (browser_visible()) return;
win_video_delete(win);
}
else if ((!strcmp(ev->keyname, "m")) ||
(!strcmp(ev->key, "XF86AudioMute")))
{
if (browser_visible()) return;
video_mute_set(inf->vid, !video_mute_get(inf->vid));
if (video_mute_get(inf->vid))
elm_layout_signal_emit(inf->lay, "action,mute", "rage");
@ -152,6 +164,7 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
}
else if (!strcmp(ev->keyname, "l"))
{
if (browser_visible()) return;
video_loop_set(inf->vid, !video_loop_get(inf->vid));
if (video_loop_get(inf->vid))
elm_layout_signal_emit(inf->lay, "action,loop", "rage");
@ -172,20 +185,24 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
{
int w, h;
if (browser_visible()) return;
video_ratio_size_get(inf->vid, &w, &h);
if ((w > 1) && (h > 1)) evas_object_resize(win, w, h);
}
else if (!strcmp(ev->keyname, "backslash"))
{
if (browser_visible()) return;
if (inf->browse_mode) browser_toggle(win);
else win_list_toggle(win);
}
else if (!strcmp(ev->keyname, "y"))
{
if (browser_visible()) return;
video_lowquality_set(inf->vid, !video_lowquality_get(inf->vid));
}
else if (!strcmp(ev->keyname, "z"))
{
if (browser_visible()) return;
if (inf->zoom_mode == 0) inf->zoom_mode = 1;
else inf->zoom_mode = 0;
win_aspect_adjust(win);
@ -196,99 +213,122 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
}
else if (!strcmp(ev->keyname, "e"))
{
if (browser_visible()) return;
video_eject(inf->vid);
elm_layout_signal_emit(inf->lay, "action,eject", "rage");
}
else if ((!strcmp(ev->key, "Return")) ||
(!strcmp(ev->key, "KP_Enter")))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_SELECT);
}
else if ((!strcmp(ev->key, "comma")) ||
(!strcmp(ev->key, "less")))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_ANGLE_PREV);
}
else if ((!strcmp(ev->key, "period")) ||
(!strcmp(ev->key, "greater")))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_ANGLE_NEXT);
}
else if (!strcmp(ev->key, "Tab"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_FORCE);
}
else if (!strcmp(ev->key, "0"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_0);
}
else if (!strcmp(ev->key, "1"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_1);
}
else if (!strcmp(ev->key, "2"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_2);
}
else if (!strcmp(ev->key, "3"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_3);
}
else if (!strcmp(ev->key, "4"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_4);
}
else if (!strcmp(ev->key, "5"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_5);
}
else if (!strcmp(ev->key, "6"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_6);
}
else if (!strcmp(ev->key, "7"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_7);
}
else if (!strcmp(ev->key, "8"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_8);
}
else if (!strcmp(ev->key, "9"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_9);
}
else if ((!strcmp(ev->key, "grave")) ||
(!strcmp(ev->key, "asciitilde")))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_10);
}
else if (!strcmp(ev->key, "F1"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_MENU1);
}
else if (!strcmp(ev->key, "F2"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_MENU2);
}
else if (!strcmp(ev->key, "F3"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_MENU3);
}
else if (!strcmp(ev->key, "F4"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_MENU4);
}
else if (!strcmp(ev->key, "F5"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_MENU5);
}
else if (!strcmp(ev->key, "F6"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_MENU6);
}
else if (!strcmp(ev->key, "F7"))
{
if (browser_visible()) return;
video_event_send(inf->vid, EMOTION_EVENT_MENU7);
}
}

@ -129,6 +129,7 @@ _cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
Inf *inf = evas_object_data_get(data, "inf");
if (!inf) return;
if (browser_visible()) return;
if (ev->button == 3)
{
elm_layout_signal_emit(inf->lay, "about,show", "rage");

Loading…
Cancel
Save