aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2011-09-19 16:23:51 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-10-07 00:13:35 (GMT)
commit87ca7cccd0f51bba82c81c5866d6017da00c6359 (patch)
treeb8e757335736d901adc2a6d00bd1e3fc664b6820 /src
parent97d1c4620199805d1f5cff9262eab9c3a2bf87df (diff)
Add borderless mode, not optional yet
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/tvtimeconf.c25
-rw-r--r--src/xcommon.c16
-rw-r--r--src/xcommon.h35
3 files changed, 75 insertions, 1 deletions
diff --git a/src/tvtimeconf.c b/src/tvtimeconf.c
index 9cffbe1..7e38f14 100644
--- a/src/tvtimeconf.c
+++ b/src/tvtimeconf.c
@@ -59,6 +59,7 @@ struct config_s
int squarepixels;
int debug;
int fullscreen;
+ int borderless;
int alwaysontop;
int priority;
int ntsc_mode;
@@ -323,6 +324,10 @@ static void parse_option( config_t *ct, xmlNodePtr node )
ct->fullscreen = atoi( curval );
}
+ if( !xmlStrcasecmp( name, BAD_CAST "Borderless" ) ) {
+ ct->borderless = atoi( curval );
+ }
+
if( !xmlStrcasecmp( name, BAD_CAST "AlwaysOnTop" ) ) {
ct->alwaysontop = atoi( curval );
}
@@ -633,6 +638,7 @@ static void print_usage( char **argv )
" (defaults to 720 pixels).\n"), stderr );
lfputs( _(" -k, --slave Disables input handling in tvtime (slave mode).\n"), stderr );
lfputs( _(" -m, --fullscreen Start tvtime in fullscreen mode.\n"), stderr );
+ lfputs( _(" -l, --borderless Start tvtime without a window border.\n"), stderr );
lfputs( _(" -M, --window Start tvtime in window mode.\n"), stderr );
lfputs( _(" -n, --norm=NORM The norm to use for the input. tvtime supports:\n"
" NTSC, NTSC-JP, SECAM, PAL, PAL-Nc, PAL-M,\n"
@@ -686,6 +692,7 @@ static void print_config_usage( char **argv )
lfputs( _(" -I, --inputwidth=SAMPLING Horizontal resolution of input\n"
" (defaults to 720 pixels).\n"), stderr );
lfputs( _(" -m, --fullscreen Start tvtime in fullscreen mode.\n"), stderr );
+ lfputs( _(" -l, --borderless Start tvtime without a window border.\n"), stderr );
lfputs( _(" -M, --window Start tvtime in window mode.\n"), stderr );
lfputs( _(" -n, --norm=NORM The norm to use for the input. tvtime supports:\n"
" NTSC, NTSC-JP, SECAM, PAL, PAL-Nc, PAL-M,\n"
@@ -741,6 +748,7 @@ config_t *config_new( void )
ct->squarepixels = 1;
ct->debug = 0;
ct->fullscreen = 0;
+ ct->borderless = 0;
ct->alwaysontop = 0;
ct->priority = -10;
ct->ntsc_mode = 0;
@@ -920,6 +928,7 @@ int config_parse_tvtime_command_line( config_t *ct, int argc, char **argv )
{ "mixer", 1, 0, 'x' },
{ "showdrops", 0, 0, 's' },
{ "fullscreen", 0, 0, 'm' },
+ { "borderless", 0, 0, 'l' },
{ "window", 0, 0, 'M' },
{ "slave", 0, 0, 'k' },
{ "widescreen", 0, 0, 'a' },
@@ -936,13 +945,14 @@ int config_parse_tvtime_command_line( config_t *ct, int argc, char **argv )
int c;
if( argc ) {
- while( (c = getopt_long( argc, argv, "aAhkmMsSvF:r:g:I:d:b:i:c:n:D:f:x:X:t:l:Qg:",
+ while( (c = getopt_long( argc, argv, "aAhkmMsSvV:F:r:g:I:d:b:i:c:n:D:f:x:X:t:l:Qg:",
long_options, &option_index )) != -1 ) {
switch( c ) {
case 'a': ct->aspect = 1; break;
case 'A': ct->aspect = 0; break;
case 'k': ct->slave_mode = 1; break;
case 'm': ct->fullscreen = 1; break;
+ //case 'l': ct->borderless = 1; break;
case 'M': ct->fullscreen = 0; break;
case 's': ct->debug = 1; break;
case 'S': saveoptions = 1; break;
@@ -1019,6 +1029,9 @@ int config_parse_tvtime_command_line( config_t *ct, int argc, char **argv )
snprintf( tempstring, sizeof( tempstring ), "%d", ct->fullscreen );
config_save( ct, "Fullscreen", tempstring );
+ snprintf( tempstring, sizeof( tempstring ), "%d", ct->borderless );
+ config_save( ct, "Borderless", tempstring );
+
snprintf( tempstring, sizeof( tempstring ), "%d", ct->verbose );
config_save( ct, "Verbose", tempstring );
@@ -1061,6 +1074,7 @@ int config_parse_tvtime_config_command_line( config_t *ct, int argc, char **argv
{ "device", 2, 0, 'd' },
{ "mixer", 1, 0, 'x' },
{ "fullscreen", 0, 0, 'm' },
+ { "borderless", 0, 0, 'l' },
{ "window", 0, 0, 'M' },
{ "widescreen", 0, 0, 'a' },
{ "nowidescreen", 0, 0, 'A' },
@@ -1087,6 +1101,7 @@ int config_parse_tvtime_config_command_line( config_t *ct, int argc, char **argv
case 'a': ct->aspect = 1; break;
case 'A': ct->aspect = 0; break;
case 'm': ct->fullscreen = 1; break;
+ //case 'l': ct->borderless = 1; break;
case 'M': ct->fullscreen = 0; break;
case 'F': if( ct->config_filename ) free( ct->config_filename );
filename_specified = 1;
@@ -1222,6 +1237,9 @@ int config_parse_tvtime_config_command_line( config_t *ct, int argc, char **argv
snprintf( tempstring, sizeof( tempstring ), "%d", ct->fullscreen );
config_save( ct, "Fullscreen", tempstring );
+ snprintf( tempstring, sizeof( tempstring ), "%d", ct->borderless );
+ config_save( ct, "Borderless", tempstring );
+
snprintf( tempstring, sizeof( tempstring ), "%d", ct->verbose );
config_save( ct, "Verbose", tempstring );
@@ -1539,6 +1557,11 @@ int config_get_fullscreen( config_t *ct )
return ct->fullscreen;
}
+int config_get_borderless( config_t *ct )
+{
+ return ct->borderless;
+}
+
int config_get_alwaysontop( config_t *ct )
{
return ct->alwaysontop;
diff --git a/src/xcommon.c b/src/xcommon.c
index a62d4f5..fa24222 100644
--- a/src/xcommon.c
+++ b/src/xcommon.c
@@ -1050,6 +1050,22 @@ int xcommon_open_display( const char *user_geometry, int aspect, int verbose )
XSetStandardProperties( display, wm_window, hello, hello, None, 0, 0, &hint );
+ Atom prop = None;
+ MWMHints mwmhints;
+// if config_get_borderless
+ prop = XInternAtom( display, "_MOTIF_WM_INFO", True );
+ if( prop == None ) {
+ mwmhints.flags = 0;
+ } else {
+ mwmhints.flags = MWM_HINTS_DECORATIONS;
+ mwmhints.decorations = 0;
+ }
+
+ if( mwmhints.flags ) {
+ prop = XInternAtom( display, "_MOTIF_WM_HINTS", False );
+ XChangeProperty( display, wm_window, prop, prop, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS );
+ }
+
/* The class hint is useful for window managers like WindowMaker. */
classhint.res_class = "tvtime";
classhint.res_name = "TVWindow";
diff --git a/src/xcommon.h b/src/xcommon.h
index 1607310..d48a53e 100644
--- a/src/xcommon.h
+++ b/src/xcommon.h
@@ -33,6 +33,41 @@ typedef struct {
unsigned int height;
} area_t;
+typedef struct _mwmhints {
+ unsigned long flags;
+ unsigned long functions;
+ unsigned long decorations;
+ int input_mode;
+ unsigned long status;
+} MWMHints;
+
+/* Motif window hints */
+#define MWM_HINTS_FUNCTIONS (1L << 0)
+#define MWM_HINTS_DECORATIONS (1L << 1)
+#define MWM_HINTS_INPUT_MODE (1L << 2)
+#define MWM_HINTS_STATUS (1L << 3)
+/* bit definitions for MwmHints.functions */
+#define MWM_FUNC_ALL (1L << 0)
+#define MWM_FUNC_RESIZE (1L << 1)
+#define MWM_FUNC_MOVE (1L << 2)
+#define MWM_FUNC_MINIMIZE (1L << 3)
+#define MWM_FUNC_MAXIMIZE (1L << 4)
+#define MWM_FUNC_CLOSE (1L << 5)
+/* bit definitions for MwmHints.decorations */
+#define MWM_DECOR_ALL (1L << 0)
+#define MWM_DECOR_BORDER (1L << 1)
+#define MWM_DECOR_RESIZEH (1L << 2)
+#define MWM_DECOR_TITLE (1L << 3)
+#define MWM_DECOR_MENU (1L << 4)
+#define MWM_DECOR_MINIMIZE (1L << 5)
+#define MWM_DECOR_MAXIMIZE (1L << 6)
+/* bit definitions for MwmHints.inputMode */
+#define MWM_INPUT_MODELESS 0
+#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
+#define MWM_INPUT_SYSTEM_MODAL 2
+#define MWM_INPUT_FULL_APPLICATION_MODAL 3
+#define PROP_MWM_HINTS_ELEMENTS 5
+
int xcommon_open_display( const char *user_geometry, int aspect, int verbose );
void xcommon_close_display( void );

Privacy Policy