Skip to content

Commit bb6ff7c

Browse files
committedJan 14, 2012
performance: update the OSD if switching patches while it's still on
Before, one could bring up the OSD with F1 and then switch to a completely different patch with the OSD still showing the name of the old patch. Now the OSD is updated. This also helps when searching for a patch without having dt_mode on all the time.
1 parent f680dbf commit bb6ff7c

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed
 

‎src/gui/performance.c

+12-4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static int simple_mode_current;
5555
static int dt_mode;
5656
static int as_mode;
5757
static int input_video;
58+
static int showing_title;
5859

5960
static int add_patch(const char *filename)
6061
{
@@ -414,12 +415,19 @@ static void skip_unsuitable(int next)
414415
}
415416
}
416417

418+
static void osd_off(void)
419+
{
420+
showing_title = 0;
421+
}
422+
417423
static void simple_mode_event(mtk_event *e, int *next)
418424
{
419425
if(e->type != EVENT_TYPE_PRESS)
420426
return;
421-
if(e->press.code == MTK_KEY_F1)
422-
osd_event(patches[simple_mode_current].filename);
427+
if(e->press.code == MTK_KEY_F1) {
428+
osd_event_cb(patches[simple_mode_current].filename, osd_off);
429+
showing_title = 1;
430+
}
423431
if(e->press.code == MTK_KEY_F11)
424432
*next = 1;
425433
if(e->press.code == MTK_KEY_F9)
@@ -432,8 +440,8 @@ static void simple_mode_next(int next)
432440
renderer_pulse_patch(patches[simple_mode_current].p);
433441
if(as_mode)
434442
update_next_as_time();
435-
if(dt_mode)
436-
osd_event(patches[simple_mode_current].filename);
443+
if(dt_mode || showing_title)
444+
osd_event_cb(patches[simple_mode_current].filename, osd_off);
437445
}
438446

439447
static void configured_mode_event(mtk_event *e)

‎src/renderer/osd.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static unsigned short int osd_fb[OSD_W*OSD_H] __attribute__((aligned(32)));
3434
static struct font_context osd_font;
3535
static int osd_alpha;
3636
static int osd_timer;
37+
static void (*osd_callback)(void) = NULL;
3738

3839
static void round_corners(void)
3940
{
@@ -90,6 +91,12 @@ void osd_event(const char *string)
9091
osd_timer = OSD_DURATION;
9192
}
9293

94+
void osd_event_cb(const char *string, void (*faded)(void))
95+
{
96+
osd_event(string);
97+
osd_callback = faded;
98+
}
99+
93100
void osd_per_frame(int tmu_fd, unsigned short *dest, int hres, int vres)
94101
{
95102
struct tmu_td td;
@@ -107,8 +114,12 @@ void osd_per_frame(int tmu_fd, unsigned short *dest, int hres, int vres)
107114
osd_alpha = 0;
108115
}
109116

110-
if(osd_alpha == 0)
117+
if(osd_alpha == 0) {
118+
if(osd_callback)
119+
osd_callback();
120+
osd_callback = NULL;
111121
return;
122+
}
112123

113124
osd_x = (hres - OSD_W) >> 1;
114125
osd_y = vres - OSD_H - 20;

‎src/renderer/osd.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
void osd_init(void);
2222
void osd_event(const char *string);
23+
void osd_event_cb(const char *string, void (*faded)(void));
2324
void osd_per_frame(int tmu_fd, unsigned short *dest, int hres, int vres);
2425

2526
#endif /* __OSD_H */

0 commit comments

Comments
 (0)
Please sign in to comment.