Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: m-labs/flickernoise
base: 619f863
...
head fork: m-labs/flickernoise
compare: a4b3833
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 27, 2012
Xiangfu Liu videoin: add fullscreen button 8b029fd
Xiangfu Liu videoin: finish fullscreen function a4b3833
Showing with 46 additions and 3 deletions.
  1. +46 −3 src/gui/videoin.c
49 src/gui/videoin.c
View
@@ -32,6 +32,8 @@
#include "cp.h"
#include "../input.h"
#include "videoin.h"
+#include "../compiler/compiler.h"
+#include "guirender.h"
static int appid;
@@ -193,6 +195,43 @@ static void close_videoin_window(void)
resmgr_release(RESOURCE_VIDEOIN);
}
+static void dummy_rmc(const char *msg)
+{
+}
+
+static void stop_callback(void)
+{
+ if(!resmgr_acquire("Video in settings", RESOURCE_VIDEOIN))
+ return;
+
+ video_fd = open("/dev/video", O_RDWR);
+ if(video_fd == -1) {
+ perror("Unable to open video device");
+ resmgr_release(RESOURCE_VIDEOIN);
+ return;
+ }
+ input_add_callback(preview_update);
+}
+
+static void fullscreen_callback(mtk_event *e, void *arg)
+{
+ struct patch *p;
+ char *dummy_filename = "FS";
+ char *code = "video_a=1;decay=0;";
+
+ p = patch_compile_filename(dummy_filename, code, dummy_rmc);
+ if(p == NULL)
+ return;
+
+ close(video_fd);
+ input_delete_callback(preview_update);
+ resmgr_release(RESOURCE_VIDEOIN);
+
+ guirender(appid, p, stop_callback);
+
+ patch_free(p);
+}
+
static void ok_callback(mtk_event *e, void *arg)
{
set_config();
@@ -280,11 +319,13 @@ void init_videoin(void)
"g.rowconfig(10, -size 10)",
"g_btn = new Grid()",
+ "b_fullscreen = new Button(-text \"Full Screen\")",
"b_ok = new Button(-text \"OK\")",
"b_cancel = new Button(-text \"Cancel\")",
- "g_btn.columnconfig(1, -size 190)",
- "g_btn.place(b_ok, -column 2 -row 1)",
- "g_btn.place(b_cancel, -column 3 -row 1)",
+ "g_btn.place(b_fullscreen, -column 1 -row 1)",
+ "g_btn.columnconfig(2, -size 100)",
+ "g_btn.place(b_ok, -column 3 -row 1)",
+ "g_btn.place(b_cancel, -column 4 -row 1)",
"g.place(g_btn, -column 1 -row 11)",
"w = new Window(-content g -title \"Video input settings\" -worky 30)",
@@ -302,6 +343,8 @@ void init_videoin(void)
mtk_bind(appid, "s_contrast", "change", slide_callback, (void *)CONTROL_CONTRAST);
mtk_bind(appid, "s_hue", "change", slide_callback, (void *)CONTROL_HUE);
+ mtk_bind(appid, "b_fullscreen", "commit", fullscreen_callback, NULL);
+
mtk_bind(appid, "b_ok", "commit", ok_callback, NULL);
mtk_bind(appid, "b_cancel", "commit", close_callback, NULL);

No commit comments for this range

Something went wrong with that request. Please try again.