sys/: Trying to fix the random behaviour of window decorations.

Original commit message from CVS:
2004-06-27  Julien Moutte  <julien@moutte.net>

* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_decorate),
(gst_ximagesink_xwindow_new):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_decorate),
(gst_xvimagesink_xwindow_new): Trying to fix the random behaviour of
window decorations.
This commit is contained in:
Julien Moutte 2004-06-27 18:53:04 +00:00
parent 3995eac7fd
commit fa3c245918
3 changed files with 100 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2004-06-27 Julien Moutte <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_decorate),
(gst_ximagesink_xwindow_new):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_decorate),
(gst_xvimagesink_xwindow_new): Trying to fix the random behaviour of
window decorations.
2004-06-27 Wim Taymans <wim@fluendo.com>
* ext/dv/gstdvdec.c: (gst_dvdec_class_init), (gst_dvdec_init),

View file

@ -33,6 +33,18 @@
GST_DEBUG_CATEGORY_STATIC (gst_debug_ximagesink);
#define GST_CAT_DEFAULT gst_debug_ximagesink
typedef struct
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long status;
}
MotifWmHints, MwmHints;
#define MWM_HINTS_DECORATIONS (1L << 1)
static void gst_ximagesink_buffer_free (GstBuffer * buffer);
/* ElementFactory information */
@ -287,6 +299,38 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImage * ximage)
g_mutex_unlock (ximagesink->x_lock);
}
static gboolean
gst_ximagesink_xwindow_decorate (GstXImageSink * ximagesink,
GstXWindow * window)
{
Atom hints_atom = None;
MotifWmHints *hints;
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), FALSE);
g_return_val_if_fail (window != NULL, FALSE);
hints_atom = XInternAtom (ximagesink->xcontext->disp, "_MOTIF_WM_HINTS", 1);
hints = g_malloc0 (sizeof (MotifWmHints));
if (!hints) {
return FALSE;
}
hints->flags |= MWM_HINTS_DECORATIONS;
hints->decorations = 1 << 0;
XChangeProperty (ximagesink->xcontext->disp, window->win,
hints_atom, hints_atom, 32, PropModeReplace,
(guchar *) hints, sizeof (MotifWmHints) / sizeof (long));
XSync (ximagesink->xcontext->disp, FALSE);
g_free (hints);
return TRUE;
}
/* This function handles a GstXWindow creation */
static GstXWindow *
gst_ximagesink_xwindow_new (GstXImageSink * ximagesink, gint width, gint height)
@ -315,6 +359,8 @@ gst_ximagesink_xwindow_new (GstXImageSink * ximagesink, gint width, gint height)
XMapRaised (ximagesink->xcontext->disp, xwindow->win);
gst_ximagesink_xwindow_decorate (ximagesink, xwindow);
XSync (ximagesink->xcontext->disp, FALSE);
g_mutex_unlock (ximagesink->x_lock);

View file

@ -34,6 +34,18 @@
GST_DEBUG_CATEGORY_STATIC (gst_debug_xvimagesink);
#define GST_CAT_DEFAULT gst_debug_xvimagesink
typedef struct
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long status;
}
MotifWmHints, MwmHints;
#define MWM_HINTS_DECORATIONS (1L << 1)
static void gst_xvimagesink_buffer_free (GstBuffer * buffer);
/* ElementFactory information */
@ -298,6 +310,38 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, GstXvImage * xvimage)
g_mutex_unlock (xvimagesink->x_lock);
}
static gboolean
gst_xvimagesink_xwindow_decorate (GstXvImageSink * xvimagesink,
GstXWindow * window)
{
Atom hints_atom = None;
MotifWmHints *hints;
g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), FALSE);
g_return_val_if_fail (window != NULL, FALSE);
hints_atom = XInternAtom (xvimagesink->xcontext->disp, "_MOTIF_WM_HINTS", 1);
hints = g_malloc0 (sizeof (MotifWmHints));
if (!hints) {
return FALSE;
}
hints->flags |= MWM_HINTS_DECORATIONS;
hints->decorations = 1 << 0;
XChangeProperty (xvimagesink->xcontext->disp, window->win,
hints_atom, hints_atom, 32, PropModeReplace,
(guchar *) hints, sizeof (MotifWmHints) / sizeof (long));
XSync (xvimagesink->xcontext->disp, FALSE);
g_free (hints);
return TRUE;
}
/* This function handles a GstXWindow creation */
static GstXWindow *
gst_xvimagesink_xwindow_new (GstXvImageSink * xvimagesink,
@ -330,6 +374,8 @@ gst_xvimagesink_xwindow_new (GstXvImageSink * xvimagesink,
XMapRaised (xvimagesink->xcontext->disp, xwindow->win);
gst_xvimagesink_xwindow_decorate (xvimagesink, xwindow);
XSync (xvimagesink->xcontext->disp, FALSE);
g_mutex_unlock (xvimagesink->x_lock);