355
gdk_directfb_window_new (GdkWindow *parent,
356
GdkWindowAttr *attributes,
357
gint attributes_mask,
358
DFBWindowCapabilities window_caps,
359
DFBWindowOptions window_options,
360
DFBSurfaceCapabilities surface_caps)
363
GdkWindowObject *private;
364
GdkWindowObject *parent_private;
365
GdkWindowImplDirectFB *impl;
366
GdkWindowImplDirectFB *parent_impl;
368
DFBWindowDescription desc;
371
g_return_val_if_fail (attributes != NULL, NULL);
373
D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, parent );
375
if (!parent || attributes->window_type != GDK_WINDOW_CHILD)
376
parent = _gdk_parent_root;
378
window = g_object_new (GDK_TYPE_WINDOW, NULL);
379
private = GDK_WINDOW_OBJECT (window);
380
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
382
parent_private = GDK_WINDOW_OBJECT (parent);
383
parent_impl = GDK_WINDOW_IMPL_DIRECTFB (parent_private->impl);
384
private->parent = parent_private;
386
x = (attributes_mask & GDK_WA_X) ? attributes->x : 0;
387
y = (attributes_mask & GDK_WA_Y) ? attributes->y : 0;
389
gdk_window_set_events (window, attributes->event_mask | GDK_STRUCTURE_MASK);
391
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl);
392
impl->drawable.wrapper = GDK_DRAWABLE (window);
393
impl->gdkWindow = window;
398
_gdk_directfb_calc_abs (window);
400
impl->drawable.width = MAX (1, attributes->width);
401
impl->drawable.height = MAX (1, attributes->height);
403
private->window_type = attributes->window_type;
407
if (attributes_mask & GDK_WA_VISUAL)
408
visual = attributes->visual;
410
visual = gdk_drawable_get_visual (parent);
412
switch (attributes->wclass)
414
case GDK_INPUT_OUTPUT:
415
private->input_only = FALSE;
417
desc.flags |= DWDESC_PIXELFORMAT;
418
desc.pixelformat = ((GdkVisualDirectFB *) visual)->format;
420
if (DFB_PIXELFORMAT_HAS_ALPHA (desc.pixelformat))
422
desc.flags |= DWDESC_CAPS;
423
desc.caps = DWCAPS_ALPHACHANNEL;
428
private->input_only = TRUE;
429
desc.flags |= DWDESC_CAPS;
430
desc.caps = DWCAPS_INPUTONLY;
434
g_warning ("gdk_window_new: unsupported window class\n");
435
_gdk_window_destroy (window, FALSE);
439
switch (private->window_type)
441
case GDK_WINDOW_TOPLEVEL:
442
case GDK_WINDOW_DIALOG:
443
case GDK_WINDOW_TEMP:
444
desc.flags |= ( DWDESC_WIDTH | DWDESC_HEIGHT |
445
DWDESC_POSX | DWDESC_POSY );
448
desc.width = impl->drawable.width;
449
desc.height = impl->drawable.height;
454
if (! (desc.flags & DWDESC_CAPS))
456
desc.flags |= DWDESC_CAPS;
457
desc.caps = DWCAPS_NONE;
460
desc.caps |= window_caps;
465
desc.flags |= DWDESC_SURFACE_CAPS;
466
desc.surface_caps = surface_caps;
470
if (!create_directfb_window (impl, &desc, window_options))
473
_gdk_window_destroy (window, FALSE);
478
if (desc.caps != DWCAPS_INPUTONLY)
480
impl->window->SetOpacity(impl->window, 0x00 );
485
case GDK_WINDOW_CHILD:
488
if (!private->input_only && parent_impl->drawable.surface)
492
{ x, y, impl->drawable.width, impl->drawable.height };
493
parent_impl->drawable.surface->GetSubSurface (parent_impl->drawable.surface,
495
&impl->drawable.surface);
501
g_warning ("gdk_window_new: unsupported window type: %d",
502
private->window_type);
503
_gdk_window_destroy (window, FALSE);
508
if (impl->drawable.surface)
510
GdkColormap *colormap;
512
impl->drawable.surface->GetPixelFormat (impl->drawable.surface,
513
&impl->drawable.format);
515
private->depth = DFB_BITS_PER_PIXEL(impl->drawable.format);
517
if ((attributes_mask & GDK_WA_COLORMAP) && attributes->colormap)
519
colormap = attributes->colormap;
523
if (gdk_visual_get_system () == visual)
524
colormap = gdk_colormap_get_system ();
526
colormap =gdk_drawable_get_colormap (parent);
529
gdk_drawable_set_colormap (GDK_DRAWABLE (window), colormap);
533
impl->drawable.format = ((GdkVisualDirectFB *)visual)->format;
534
private->depth = visual->depth;
537
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
538
(attributes->cursor) : NULL));
541
parent_private->children = g_list_prepend (parent_private->children,
544
/* we hold a reference count on ourselves */
545
g_object_ref (window);
549
impl->window->GetID (impl->window, &impl->dfb_id);
550
gdk_directfb_window_id_table_insert (impl->dfb_id, window);
551
gdk_directfb_event_windows_add (window);
554
if (attributes_mask & GDK_WA_TYPE_HINT)
555
gdk_window_set_type_hint (window, attributes->type_hint);
355
562
_gdk_window_impl_new (GdkWindow *window,
356
563
GdkWindow *real_parent,