_gdk_window_impl_new() on directfb

This commit is contained in:
Cody Russell 2009-07-27 15:39:28 -05:00
parent 10e249f035
commit 313b6f39a6

View File

@ -351,50 +351,35 @@ _gdk_windowing_window_init (void)
}
GdkWindow *
gdk_directfb_window_new (GdkWindow *parent,
GdkWindowAttr *attributes,
gint attributes_mask,
DFBWindowCapabilities window_caps,
DFBWindowOptions window_options,
DFBSurfaceCapabilities surface_caps)
void
_gdk_window_impl_new (GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkVisual *visual,
GdkEventMask event_mask,
GdkWindowAttr *attributes,
gint attributes_mask)
{
GdkWindow *window;
GdkWindowObject *private;
GdkWindowObject *parent_private;
GdkWindowImplDirectFB *impl;
GdkWindowImplDirectFB *parent_impl;
GdkVisual *visual;
DFBWindowDescription desc;
gint x, y;
g_return_val_if_fail (attributes != NULL, NULL);
D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, parent );
if (!parent || attributes->window_type != GDK_WINDOW_CHILD)
parent = _gdk_parent_root;
window = g_object_new (GDK_TYPE_WINDOW, NULL);
private = GDK_WINDOW_OBJECT (window);
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
parent_private = GDK_WINDOW_OBJECT (parent);
parent_impl = GDK_WINDOW_IMPL_DIRECTFB (parent_private->impl);
private->parent = parent_private;
x = (attributes_mask & GDK_WA_X) ? attributes->x : 0;
y = (attributes_mask & GDK_WA_Y) ? attributes->y : 0;
gdk_window_set_events (window, attributes->event_mask | GDK_STRUCTURE_MASK);
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl);
impl = g_object_new (_gdk_window_impl_get_type (), NULL);
impl->drawable.wrapper = GDK_DRAWABLE (window);
impl->gdkWindow = window;
impl->gdkWindow = window;
private->x = x;
private->y = y;
private = GDK_WINDOW_OBJECT (window);
private->impl = (GdkDrawable *)impl;
private->x = (attributes_mask & GDK_WA_X) ? attributes->x : 0;
private->y = (attributes_mask & GDK_WA_Y) ? attributes->y : 0;
parent_private = private->parent;
parent_impl = GDK_WINDOW_IMPL_DIRECTFB (parent_private->impl);
private->parent = parent_private;
_gdk_directfb_calc_abs (window);
@ -405,24 +390,20 @@ gdk_directfb_window_new (GdkWindow *parent,
desc.flags = 0;
if (attributes_mask & GDK_WA_VISUAL)
visual = attributes->visual;
else
visual = gdk_drawable_get_visual (parent);
switch (attributes->wclass)
{
case GDK_INPUT_OUTPUT:
private->input_only = FALSE;
desc.flags |= DWDESC_PIXELFORMAT;
desc.pixelformat = ((GdkVisualDirectFB *) visual)->format;
desc.pixelformat = ((GdkVisualDirectFB *)visual)->format;
if (DFB_PIXELFORMAT_HAS_ALPHA (desc.pixelformat))
{
desc.flags |= DWDESC_CAPS;
desc.caps = DWCAPS_ALPHACHANNEL;
}
break;
case GDK_INPUT_ONLY:
@ -432,9 +413,9 @@ gdk_directfb_window_new (GdkWindow *parent,
break;
default:
g_warning ("gdk_window_new: unsupported window class\n");
g_warning ("_gdk_window_impl_new: unsupported window class\n");
_gdk_window_destroy (window, FALSE);
return NULL;
return;
}
switch (private->window_type)
@ -442,59 +423,50 @@ gdk_directfb_window_new (GdkWindow *parent,
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
desc.flags |= ( DWDESC_WIDTH | DWDESC_HEIGHT |
DWDESC_POSX | DWDESC_POSY );
desc.posx = x;
desc.posy = y;
desc.flags |= (DWDESC_WIDTH | DWDESC_HEIGHT |
DWDESC_POSX | DWDESC_POSY);
desc.posx = private->x;
desc.posy = private->y;
desc.width = impl->drawable.width;
desc.height = impl->drawable.height;
#if 0
if (window_caps)
{
if (! (desc.flags & DWDESC_CAPS))
{
desc.flags |= DWDESC_CAPS;
desc.caps = DWCAPS_NONE;
}
desc.caps |= window_caps;
}
if (surface_caps)
if (!create_directfb_window (impl, &desc, DWOP_NONE))
{
desc.flags |= DWDESC_SURFACE_CAPS;
desc.surface_caps = surface_caps;
}
#endif
if (!create_directfb_window (impl, &desc, window_options))
{
g_assert(0);
g_assert (0);
_gdk_window_destroy (window, FALSE);
return NULL;
return;
}
if( desc.caps != DWCAPS_INPUTONLY )
impl->window->SetOpacity(impl->window, 0x00 );
if (desc.caps != DWCAPS_INPUTONLY)
{
impl->window->SetOpacity (impl->window, 0x00);
}
break;
case GDK_WINDOW_CHILD:
impl->window=NULL;
impl->window = NULL;
if (!private->input_only && parent_impl->drawable.surface)
{
DFBRectangle rect =
{ x, y, impl->drawable.width, impl->drawable.height };
DFBRectangle rect = { private->x,
private->y,
impl->drawable.width,
impl->drawable.height };
parent_impl->drawable.surface->GetSubSurface (parent_impl->drawable.surface,
&rect,
&impl->drawable.surface);
}
break;
default:
g_warning ("gdk_window_new: unsupported window type: %d",
g_warning ("_gdk_window_impl_new: unsupported window type: %d",
private->window_type);
_gdk_window_destroy (window, FALSE);
return NULL;
return;
}
if (impl->drawable.surface)
@ -502,38 +474,39 @@ gdk_directfb_window_new (GdkWindow *parent,
GdkColormap *colormap;
impl->drawable.surface->GetPixelFormat (impl->drawable.surface,
&impl->drawable.format);
&impl->drawable.format);
private->depth = DFB_BITS_PER_PIXEL(impl->drawable.format);
private->depth = DFB_BITS_PER_PIXEL (impl->drawable.format);
if ((attributes_mask & GDK_WA_COLORMAP) && attributes->colormap)
{
colormap = attributes->colormap;
}
{
colormap = attributes->colormap;
}
else
{
if (gdk_visual_get_system () == visual)
colormap = gdk_colormap_get_system ();
else
colormap =gdk_drawable_get_colormap (parent);
}
{
if (gdk_visual_get_system () == visual)
colormap = gdk_colormap_get_system ();
else
colormap = gdk_colormap_new (visual, FALSE);
}
gdk_drawable_set_colormap (GDK_DRAWABLE (window), colormap);
}
else
{
impl->drawable.format = ((GdkVisualDirectFB *)visual)->format;
private->depth = visual->depth;
private->depth = visual->depth;
}
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) : NULL));
gdk_window_set_cursor (window,
((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) : NULL));
if (parent_private)
parent_private->children = g_list_prepend (parent_private->children,
window);
/* we hold a reference count on ourselves */
/* we hold a reference count on ourself */
g_object_ref (window);
if (impl->window)
@ -545,21 +518,6 @@ gdk_directfb_window_new (GdkWindow *parent,
if (attributes_mask & GDK_WA_TYPE_HINT)
gdk_window_set_type_hint (window, attributes->type_hint);
return window;
}
GdkWindow *
_gdk_window_new (GdkWindow *parent,
GdkWindowAttr *attributes,
gint attributes_mask)
{
g_return_val_if_fail (attributes != NULL, NULL);
D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, parent );
return gdk_directfb_window_new (parent, attributes, attributes_mask,
DWCAPS_NONE, DWOP_NONE, DSCAPS_NONE);
}
void
@ -2827,6 +2785,7 @@ _gdk_windowing_window_get_next_serial (GdkDisplay *display)
GdkRegion *
_gdk_windowing_window_get_input_shape (GdkWindow *window)
{
return NULL;
}
void