| 1 |
/* GDK - The GIMP Drawing Kit |
| 2 |
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
| 3 |
* Copyright (C) 1998-1999 Tor Lillqvist |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, write to the |
| 17 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 |
* Boston, MA 02111-1307, USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
/* |
| 22 |
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
| 23 |
* file for a list of people on the GTK+ Team. |
| 24 |
*/ |
| 25 |
|
| 26 |
/* |
| 27 |
* GTK+ DirectFB backend |
| 28 |
* Copyright (C) 2001-2002 convergence integrated media GmbH |
| 29 |
* Copyright (C) 2002-2004 convergence GmbH |
| 30 |
* Written by Denis Oliver Kropp <[email protected]> and |
| 31 |
* Sven Neumann <[email protected]> |
| 32 |
*/ |
| 33 |
|
| 34 |
#include "config.h" |
| 35 |
#include "gdk.h" |
| 36 |
#include "gdkwindowimpl.h" |
| 37 |
#include "gdkwindow.h" |
| 38 |
|
| 39 |
#include "gdkdirectfb.h" |
| 40 |
#include "gdkprivate-directfb.h" |
| 41 |
#include "gdkdisplay-directfb.h" |
| 42 |
|
| 43 |
#include "gdkregion-generic.h" |
| 44 |
|
| 45 |
#include "gdkinternals.h" |
| 46 |
#include "gdkalias.h" |
| 47 |
#include "cairo.h" |
| 48 |
#include <assert.h> |
| 49 |
|
| 50 |
#include <direct/debug.h> |
| 51 |
|
| 52 |
#include <directfb_util.h> |
| 53 |
|
| 54 |
D_DEBUG_DOMAIN (GDKDFB_Crossing, "GDKDFB/Crossing", "GDK DirectFB Crossing Events"); |
| 55 |
D_DEBUG_DOMAIN (GDKDFB_Updates, "GDKDFB/Updates", "GDK DirectFB Updates"); |
| 56 |
D_DEBUG_DOMAIN (GDKDFB_Paintable, "GDKDFB/Paintable", "GDK DirectFB Paintable"); |
| 57 |
D_DEBUG_DOMAIN (GDKDFB_Window, "GDKDFB/Window", "GDK DirectFB Window"); |
| 58 |
|
| 59 |
|
| 60 |
static GdkRegion * gdk_window_impl_directfb_get_visible_region (GdkDrawable *drawable); |
| 61 |
static void gdk_window_impl_directfb_set_colormap (GdkDrawable *drawable, |
| 62 |
GdkColormap *colormap); |
| 63 |
static void gdk_window_impl_directfb_init (GdkWindowImplDirectFB *window); |
| 64 |
static void gdk_window_impl_directfb_class_init (GdkWindowImplDirectFBClass *klass); |
| 65 |
static void gdk_window_impl_directfb_finalize (GObject *object); |
| 66 |
|
| 67 |
static void gdk_window_impl_iface_init (GdkWindowImplIface *iface); |
| 68 |
static void gdk_directfb_window_destroy (GdkWindow *window, |
| 69 |
gboolean recursing, |
| 70 |
gboolean foreign_destroy); |
| 71 |
|
| 72 |
typedef struct |
| 73 |
{ |
| 74 |
GdkWindowChildChanged changed; |
| 75 |
GdkWindowChildGetPos get_pos; |
| 76 |
gpointer user_data; |
| 77 |
} GdkWindowChildHandlerData; |
| 78 |
|
| 79 |
|
| 80 |
static GdkWindow *gdk_directfb_window_containing_pointer = NULL; |
| 81 |
static GdkWindow *gdk_directfb_focused_window = NULL; |
| 82 |
static gpointer parent_class = NULL; |
| 83 |
GdkWindow * _gdk_parent_root = NULL; |
| 84 |
|
| 85 |
static void gdk_window_impl_directfb_paintable_init (GdkPaintableIface *iface); |
| 86 |
|
| 87 |
G_DEFINE_TYPE_WITH_CODE (GdkWindowImplDirectFB, |
| 88 |
gdk_window_impl_directfb, |
| 89 |
GDK_TYPE_DRAWABLE_IMPL_DIRECTFB, |
| 90 |
G_IMPLEMENT_INTERFACE (GDK_TYPE_WINDOW_IMPL, |
| 91 |
gdk_window_impl_iface_init) |
| 92 |
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE, |
| 93 |
gdk_window_impl_directfb_paintable_init)); |
| 94 |
|
| 95 |
GType |
| 96 |
_gdk_window_impl_get_type (void) |
| 97 |
{ |
| 98 |
return gdk_window_impl_directfb_get_type (); |
| 99 |
} |
| 100 |
|
| 101 |
static void |
| 102 |
gdk_window_impl_directfb_init (GdkWindowImplDirectFB *impl) |
| 103 |
{ |
| 104 |
impl->drawable.width = 1; |
| 105 |
impl->drawable.height = 1; |
| 106 |
//cannot use gdk_cursor_new here since gdk_display_get_default |
| 107 |
//does not work yet. |
| 108 |
impl->cursor = gdk_cursor_new_for_display (GDK_DISPLAY_OBJECT (_gdk_display), |
| 109 |
GDK_LEFT_PTR); |
| 110 |
impl->opacity = 255; |
| 111 |
} |
| 112 |
|
| 113 |
static void |
| 114 |
gdk_window_impl_directfb_class_init (GdkWindowImplDirectFBClass *klass) |
| 115 |
{ |
| 116 |
GObjectClass *object_class = G_OBJECT_CLASS (klass); |
| 117 |
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); |
| 118 |
|
| 119 |
parent_class = g_type_class_peek_parent (klass); |
| 120 |
|
| 121 |
object_class->finalize = gdk_window_impl_directfb_finalize; |
| 122 |
|
| 123 |
drawable_class->set_colormap = gdk_window_impl_directfb_set_colormap; |
| 124 |
|
| 125 |
/* Visible and clip regions are the same */ |
| 126 |
|
| 127 |
drawable_class->get_clip_region = |
| 128 |
gdk_window_impl_directfb_get_visible_region; |
| 129 |
|
| 130 |
drawable_class->get_visible_region = |
| 131 |
gdk_window_impl_directfb_get_visible_region; |
| 132 |
} |
| 133 |
|
| 134 |
static void |
| 135 |
g_free_2nd (gpointer a, |
| 136 |
gpointer b, |
| 137 |
gpointer data) |
| 138 |
{ |
| 139 |
g_free (b); |
| 140 |
} |
| 141 |
|
| 142 |
static void |
| 143 |
gdk_window_impl_directfb_finalize (GObject *object) |
| 144 |
{ |
| 145 |
GdkWindowImplDirectFB *impl = GDK_WINDOW_IMPL_DIRECTFB (object); |
| 146 |
|
| 147 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p ) <- %dx%d\n", G_STRFUNC, |
| 148 |
impl, impl->drawable.width, impl->drawable.height); |
| 149 |
|
| 150 |
if (GDK_WINDOW_IS_MAPPED (impl->drawable.wrapper)) |
| 151 |
gdk_window_hide (impl->drawable.wrapper); |
| 152 |
|
| 153 |
if (impl->cursor) |
| 154 |
gdk_cursor_unref (impl->cursor); |
| 155 |
|
| 156 |
if (impl->properties) |
| 157 |
{ |
| 158 |
g_hash_table_foreach (impl->properties, g_free_2nd, NULL); |
| 159 |
g_hash_table_destroy (impl->properties); |
| 160 |
} |
| 161 |
if (impl->window) |
| 162 |
{ |
| 163 |
gdk_directfb_window_id_table_remove (impl->dfb_id); |
| 164 |
/* native window resource must be release before we can finalize !*/ |
| 165 |
impl->window = NULL; |
| 166 |
} |
| 167 |
|
| 168 |
if (G_OBJECT_CLASS (parent_class)->finalize) |
| 169 |
G_OBJECT_CLASS (parent_class)->finalize (object); |
| 170 |
} |
| 171 |
|
| 172 |
static GdkRegion * |
| 173 |
gdk_window_impl_directfb_get_visible_region (GdkDrawable *drawable) |
| 174 |
{ |
| 175 |
GdkDrawableImplDirectFB *priv = GDK_DRAWABLE_IMPL_DIRECTFB (drawable); |
| 176 |
GdkRectangle rect = { 0, 0, 0, 0 }; |
| 177 |
DFBRectangle drect = { 0, 0, 0, 0 }; |
| 178 |
|
| 179 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, drawable); |
| 180 |
|
| 181 |
if (priv->surface) |
| 182 |
priv->surface->GetVisibleRectangle (priv->surface, &drect); |
| 183 |
rect.x = drect.x; |
| 184 |
rect.y = drect.y; |
| 185 |
rect.width = drect.w; |
| 186 |
rect.height = drect.h; |
| 187 |
|
| 188 |
D_DEBUG_AT (GDKDFB_Window, " -> returning %4d,%4d-%4dx%4d\n", |
| 189 |
drect.x, drect.y, drect.w, drect.h); |
| 190 |
|
| 191 |
return gdk_region_rectangle (&rect); |
| 192 |
} |
| 193 |
|
| 194 |
static void |
| 195 |
gdk_window_impl_directfb_set_colormap (GdkDrawable *drawable, |
| 196 |
GdkColormap *colormap) |
| 197 |
{ |
| 198 |
GDK_DRAWABLE_CLASS (parent_class)->set_colormap (drawable, colormap); |
| 199 |
|
| 200 |
if (colormap) |
| 201 |
{ |
| 202 |
GdkDrawableImplDirectFB *priv = GDK_DRAWABLE_IMPL_DIRECTFB (drawable); |
| 203 |
|
| 204 |
if (priv->surface) |
| 205 |
{ |
| 206 |
IDirectFBPalette *palette = gdk_directfb_colormap_get_palette (colormap); |
| 207 |
|
| 208 |
if (palette) |
| 209 |
priv->surface->SetPalette (priv->surface, palette); |
| 210 |
} |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
|
| 215 |
static gboolean |
| 216 |
create_directfb_window (GdkWindowImplDirectFB *impl, |
| 217 |
DFBWindowDescription *desc, |
| 218 |
DFBWindowOptions window_options) |
| 219 |
{ |
| 220 |
DFBResult ret; |
| 221 |
IDirectFBWindow *window; |
| 222 |
|
| 223 |
D_DEBUG_AT (GDKDFB_Window, "%s( %4dx%4d, caps 0x%08x )\n", G_STRFUNC, |
| 224 |
desc->width, desc->height, desc->caps); |
| 225 |
|
| 226 |
ret = _gdk_display->layer->CreateWindow (_gdk_display->layer, desc, &window); |
| 227 |
|
| 228 |
if (ret != DFB_OK) |
| 229 |
{ |
| 230 |
DirectFBError ("gdk_window_new: Layer->CreateWindow failed", ret); |
| 231 |
g_assert (0); |
| 232 |
return FALSE; |
| 233 |
} |
| 234 |
|
| 235 |
if ((desc->flags & DWDESC_CAPS) && (desc->caps & DWCAPS_INPUTONLY)) |
| 236 |
{ |
| 237 |
impl->drawable.surface = NULL; |
| 238 |
} else |
| 239 |
window->GetSurface (window, &impl->drawable.surface); |
| 240 |
|
| 241 |
if (window_options) |
| 242 |
{ |
| 243 |
DFBWindowOptions options; |
| 244 |
window->GetOptions (window, &options); |
| 245 |
window->SetOptions (window, options | window_options); |
| 246 |
} |
| 247 |
|
| 248 |
impl->window = window; |
| 249 |
|
| 250 |
#ifndef GDK_DIRECTFB_NO_EXPERIMENTS |
| 251 |
//direct_log_printf (NULL, "Initializing (window %p, wimpl %p)\n", win, impl); |
| 252 |
|
| 253 |
dfb_updates_init (&impl->flips, impl->flip_regions, |
| 254 |
G_N_ELEMENTS (impl->flip_regions)); |
| 255 |
#endif |
| 256 |
|
| 257 |
return TRUE; |
| 258 |
} |
| 259 |
|
| 260 |
void |
| 261 |
_gdk_windowing_window_init (GdkScreen *screen) |
| 262 |
{ |
| 263 |
GdkWindowObject *private; |
| 264 |
GdkDrawableImplDirectFB *draw_impl; |
| 265 |
DFBDisplayLayerConfig dlc; |
| 266 |
|
| 267 |
g_assert (_gdk_parent_root == NULL); |
| 268 |
|
| 269 |
_gdk_display->layer->GetConfiguration (_gdk_display->layer, &dlc); |
| 270 |
|
| 271 |
_gdk_parent_root = g_object_new (GDK_TYPE_WINDOW, NULL); |
| 272 |
|
| 273 |
private = GDK_WINDOW_OBJECT (_gdk_parent_root); |
| 274 |
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL); |
| 275 |
private->impl_window = private; |
| 276 |
|
| 277 |
draw_impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl); |
| 278 |
|
| 279 |
/* custom root window init */ |
| 280 |
{ |
| 281 |
DFBWindowDescription desc; |
| 282 |
desc.flags = 0; |
| 283 |
/*XXX I must do this now its a bug ALPHA ROOT*/ |
| 284 |
|
| 285 |
desc.flags = DWDESC_CAPS; |
| 286 |
desc.caps = 0; |
| 287 |
desc.caps |= DWCAPS_NODECORATION; |
| 288 |
desc.caps |= DWCAPS_ALPHACHANNEL; |
| 289 |
desc.flags |= (DWDESC_WIDTH | DWDESC_HEIGHT | |
| 290 |
DWDESC_POSX | DWDESC_POSY); |
| 291 |
desc.posx = 0; |
| 292 |
desc.posy = 0; |
| 293 |
desc.width = dlc.width; |
| 294 |
desc.height = dlc.height; |
| 295 |
|
| 296 |
create_directfb_window (GDK_WINDOW_IMPL_DIRECTFB (private->impl), |
| 297 |
&desc, 0); |
| 298 |
|
| 299 |
g_assert (GDK_WINDOW_IMPL_DIRECTFB (private->impl)->window != NULL); |
| 300 |
g_assert (draw_impl->surface != NULL); |
| 301 |
} |
| 302 |
|
| 303 |
private->window_type = GDK_WINDOW_ROOT; |
| 304 |
private->viewable = TRUE; |
| 305 |
private->x = 0; |
| 306 |
private->y = 0; |
| 307 |
private->abs_x = 0; |
| 308 |
private->abs_y = 0; |
| 309 |
private->width = dlc.width; |
| 310 |
private->height = dlc.height; |
| 311 |
|
| 312 |
// impl->drawable.paint_region = NULL; |
| 313 |
/* impl->window = NULL; */ |
| 314 |
draw_impl->abs_x = 0; |
| 315 |
draw_impl->abs_y = 0; |
| 316 |
draw_impl->width = dlc.width; |
| 317 |
draw_impl->height = dlc.height; |
| 318 |
draw_impl->wrapper = GDK_DRAWABLE (private); |
| 319 |
draw_impl->colormap = gdk_screen_get_system_colormap (screen); |
| 320 |
g_object_ref (draw_impl->colormap); |
| 321 |
|
| 322 |
draw_impl->surface->GetPixelFormat (draw_impl->surface, |
| 323 |
&draw_impl->format); |
| 324 |
private->depth = DFB_BITS_PER_PIXEL (draw_impl->format); |
| 325 |
|
| 326 |
_gdk_window_update_size (_gdk_parent_root); |
| 327 |
} |
| 328 |
|
| 329 |
|
| 330 |
GdkWindow * |
| 331 |
gdk_directfb_window_new (GdkWindow *parent, |
| 332 |
GdkWindowAttr *attributes, |
| 333 |
gint attributes_mask, |
| 334 |
DFBWindowCapabilities window_caps, |
| 335 |
DFBWindowOptions window_options, |
| 336 |
DFBSurfaceCapabilities surface_caps) |
| 337 |
{ |
| 338 |
GdkWindow *window; |
| 339 |
GdkWindowObject *private; |
| 340 |
GdkWindowObject *parent_private; |
| 341 |
GdkWindowImplDirectFB *impl; |
| 342 |
GdkWindowImplDirectFB *parent_impl; |
| 343 |
GdkVisual *visual; |
| 344 |
DFBWindowDescription desc; |
| 345 |
gint x, y; |
| 346 |
|
| 347 |
g_return_val_if_fail (attributes != NULL, NULL); |
| 348 |
|
| 349 |
D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", G_STRFUNC, parent ); |
| 350 |
|
| 351 |
if (!parent || attributes->window_type != GDK_WINDOW_CHILD) |
| 352 |
parent = _gdk_parent_root; |
| 353 |
|
| 354 |
window = g_object_new (GDK_TYPE_WINDOW, NULL); |
| 355 |
private = GDK_WINDOW_OBJECT (window); |
| 356 |
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL); |
| 357 |
|
| 358 |
parent_private = GDK_WINDOW_OBJECT (parent); |
| 359 |
parent_impl = GDK_WINDOW_IMPL_DIRECTFB (parent_private->impl); |
| 360 |
private->parent = parent_private; |
| 361 |
|
| 362 |
x = (attributes_mask & GDK_WA_X) ? attributes->x : 0; |
| 363 |
y = (attributes_mask & GDK_WA_Y) ? attributes->y : 0; |
| 364 |
|
| 365 |
gdk_window_set_events (window, attributes->event_mask | GDK_STRUCTURE_MASK); |
| 366 |
|
| 367 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 368 |
impl->drawable.wrapper = GDK_DRAWABLE (window); |
| 369 |
|
| 370 |
private->x = x; |
| 371 |
private->y = y; |
| 372 |
|
| 373 |
impl->drawable.width = MAX (1, attributes->width); |
| 374 |
impl->drawable.height = MAX (1, attributes->height); |
| 375 |
|
| 376 |
private->window_type = attributes->window_type; |
| 377 |
|
| 378 |
desc.flags = 0; |
| 379 |
|
| 380 |
if (attributes_mask & GDK_WA_VISUAL) |
| 381 |
visual = attributes->visual; |
| 382 |
else |
| 383 |
visual = gdk_drawable_get_visual (parent); |
| 384 |
|
| 385 |
switch (attributes->wclass) |
| 386 |
{ |
| 387 |
case GDK_INPUT_OUTPUT: |
| 388 |
private->input_only = FALSE; |
| 389 |
|
| 390 |
desc.flags |= DWDESC_PIXELFORMAT; |
| 391 |
desc.pixelformat = ((GdkVisualDirectFB *) visual)->format; |
| 392 |
|
| 393 |
if (DFB_PIXELFORMAT_HAS_ALPHA (desc.pixelformat)) |
| 394 |
{ |
| 395 |
desc.flags |= DWDESC_CAPS; |
| 396 |
desc.caps = DWCAPS_ALPHACHANNEL; |
| 397 |
} |
| 398 |
break; |
| 399 |
|
| 400 |
case GDK_INPUT_ONLY: |
| 401 |
private->input_only = TRUE; |
| 402 |
desc.flags |= DWDESC_CAPS; |
| 403 |
desc.caps = DWCAPS_INPUTONLY; |
| 404 |
break; |
| 405 |
|
| 406 |
default: |
| 407 |
g_warning ("gdk_window_new: unsupported window class\n"); |
| 408 |
_gdk_window_destroy (window, FALSE); |
| 409 |
return NULL; |
| 410 |
} |
| 411 |
|
| 412 |
switch (private->window_type) |
| 413 |
{ |
| 414 |
case GDK_WINDOW_TOPLEVEL: |
| 415 |
case GDK_WINDOW_DIALOG: |
| 416 |
case GDK_WINDOW_TEMP: |
| 417 |
desc.flags |= ( DWDESC_WIDTH | DWDESC_HEIGHT | |
| 418 |
DWDESC_POSX | DWDESC_POSY ); |
| 419 |
desc.posx = x; |
| 420 |
desc.posy = y; |
| 421 |
desc.width = impl->drawable.width; |
| 422 |
desc.height = impl->drawable.height; |
| 423 |
|
| 424 |
#if 0 |
| 425 |
if (window_caps) |
| 426 |
{ |
| 427 |
if (! (desc.flags & DWDESC_CAPS)) |
| 428 |
{ |
| 429 |
desc.flags |= DWDESC_CAPS; |
| 430 |
desc.caps = DWCAPS_NONE; |
| 431 |
} |
| 432 |
|
| 433 |
desc.caps |= window_caps; |
| 434 |
} |
| 435 |
|
| 436 |
if (surface_caps) |
| 437 |
{ |
| 438 |
desc.flags |= DWDESC_SURFACE_CAPS; |
| 439 |
desc.surface_caps = surface_caps; |
| 440 |
} |
| 441 |
#endif |
| 442 |
|
| 443 |
if (!create_directfb_window (impl, &desc, window_options)) |
| 444 |
{ |
| 445 |
g_assert(0); |
| 446 |
_gdk_window_destroy (window, FALSE); |
| 447 |
|
| 448 |
return NULL; |
| 449 |
} |
| 450 |
|
| 451 |
if (desc.caps != DWCAPS_INPUTONLY) |
| 452 |
{ |
| 453 |
impl->window->SetOpacity(impl->window, 0x00 ); |
| 454 |
} |
| 455 |
|
| 456 |
break; |
| 457 |
|
| 458 |
case GDK_WINDOW_CHILD: |
| 459 |
impl->window=NULL; |
| 460 |
|
| 461 |
if (!private->input_only && parent_impl->drawable.surface) |
| 462 |
{ |
| 463 |
|
| 464 |
DFBRectangle rect = |
| 465 |
{ x, y, impl->drawable.width, impl->drawable.height }; |
| 466 |
parent_impl->drawable.surface->GetSubSurface (parent_impl->drawable.surface, |
| 467 |
&rect, |
| 468 |
&impl->drawable.surface); |
| 469 |
} |
| 470 |
|
| 471 |
break; |
| 472 |
|
| 473 |
default: |
| 474 |
g_warning ("gdk_window_new: unsupported window type: %d", |
| 475 |
private->window_type); |
| 476 |
_gdk_window_destroy (window, FALSE); |
| 477 |
|
| 478 |
return NULL; |
| 479 |
} |
| 480 |
|
| 481 |
if (impl->drawable.surface) |
| 482 |
{ |
| 483 |
GdkColormap *colormap; |
| 484 |
|
| 485 |
impl->drawable.surface->GetPixelFormat (impl->drawable.surface, |
| 486 |
&impl->drawable.format); |
| 487 |
|
| 488 |
private->depth = DFB_BITS_PER_PIXEL(impl->drawable.format); |
| 489 |
|
| 490 |
if ((attributes_mask & GDK_WA_COLORMAP) && attributes->colormap) |
| 491 |
{ |
| 492 |
colormap = attributes->colormap; |
| 493 |
} |
| 494 |
else |
| 495 |
{ |
| 496 |
if (gdk_visual_get_system () == visual) |
| 497 |
colormap = gdk_colormap_get_system (); |
| 498 |
else |
| 499 |
colormap =gdk_drawable_get_colormap (parent); |
| 500 |
} |
| 501 |
|
| 502 |
gdk_drawable_set_colormap (GDK_DRAWABLE (window), colormap); |
| 503 |
} |
| 504 |
else |
| 505 |
{ |
| 506 |
impl->drawable.format = ((GdkVisualDirectFB *)visual)->format; |
| 507 |
private->depth = visual->depth; |
| 508 |
} |
| 509 |
|
| 510 |
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ? |
| 511 |
(attributes->cursor) : NULL)); |
| 512 |
|
| 513 |
if (parent_private) |
| 514 |
parent_private->children = g_list_prepend (parent_private->children, |
| 515 |
window); |
| 516 |
|
| 517 |
/* we hold a reference count on ourselves */ |
| 518 |
g_object_ref (window); |
| 519 |
|
| 520 |
if (impl->window) |
| 521 |
{ |
| 522 |
impl->window->GetID (impl->window, &impl->dfb_id); |
| 523 |
gdk_directfb_window_id_table_insert (impl->dfb_id, window); |
| 524 |
gdk_directfb_event_windows_add (window); |
| 525 |
} |
| 526 |
|
| 527 |
if (attributes_mask & GDK_WA_TYPE_HINT) |
| 528 |
gdk_window_set_type_hint (window, attributes->type_hint); |
| 529 |
|
| 530 |
return window; |
| 531 |
} |
| 532 |
|
| 533 |
|
| 534 |
void |
| 535 |
_gdk_window_impl_new (GdkWindow *window, |
| 536 |
GdkWindow *real_parent, |
| 537 |
GdkScreen *screen, |
| 538 |
GdkVisual *visual, |
| 539 |
GdkEventMask event_mask, |
| 540 |
GdkWindowAttr *attributes, |
| 541 |
gint attributes_mask) |
| 542 |
{ |
| 543 |
GdkWindowObject *private; |
| 544 |
GdkWindowObject *parent_private; |
| 545 |
GdkWindowImplDirectFB *impl; |
| 546 |
GdkWindowImplDirectFB *parent_impl; |
| 547 |
DFBWindowDescription desc; |
| 548 |
|
| 549 |
impl = g_object_new (_gdk_window_impl_get_type (), NULL); |
| 550 |
impl->drawable.wrapper = GDK_DRAWABLE (window); |
| 551 |
|
| 552 |
private = GDK_WINDOW_OBJECT (window); |
| 553 |
private->impl = (GdkDrawable *)impl; |
| 554 |
|
| 555 |
parent_private = GDK_WINDOW_OBJECT (real_parent); |
| 556 |
parent_impl = GDK_WINDOW_IMPL_DIRECTFB (parent_private->impl); |
| 557 |
|
| 558 |
impl->drawable.width = MAX (1, attributes->width); |
| 559 |
impl->drawable.height = MAX (1, attributes->height); |
| 560 |
|
| 561 |
desc.flags = 0; |
| 562 |
|
| 563 |
switch (attributes->wclass) |
| 564 |
{ |
| 565 |
case GDK_INPUT_OUTPUT: |
| 566 |
desc.flags |= DWDESC_PIXELFORMAT; |
| 567 |
desc.pixelformat = ((GdkVisualDirectFB *)visual)->format; |
| 568 |
|
| 569 |
if (DFB_PIXELFORMAT_HAS_ALPHA (desc.pixelformat)) |
| 570 |
{ |
| 571 |
desc.flags |= DWDESC_CAPS; |
| 572 |
desc.caps = DWCAPS_ALPHACHANNEL; |
| 573 |
} |
| 574 |
|
| 575 |
break; |
| 576 |
|
| 577 |
case GDK_INPUT_ONLY: |
| 578 |
desc.flags |= DWDESC_CAPS; |
| 579 |
desc.caps = DWCAPS_INPUTONLY; |
| 580 |
break; |
| 581 |
|
| 582 |
default: |
| 583 |
g_warning ("_gdk_window_impl_new: unsupported window class\n"); |
| 584 |
_gdk_window_destroy (window, FALSE); |
| 585 |
return; |
| 586 |
} |
| 587 |
|
| 588 |
switch (private->window_type) |
| 589 |
{ |
| 590 |
case GDK_WINDOW_TOPLEVEL: |
| 591 |
case GDK_WINDOW_DIALOG: |
| 592 |
case GDK_WINDOW_TEMP: |
| 593 |
desc.flags |= (DWDESC_WIDTH | DWDESC_HEIGHT | |
| 594 |
DWDESC_POSX | DWDESC_POSY); |
| 595 |
desc.posx = private->x; |
| 596 |
desc.posy = private->y; |
| 597 |
desc.width = impl->drawable.width; |
| 598 |
desc.height = impl->drawable.height; |
| 599 |
|
| 600 |
if (!create_directfb_window (impl, &desc, DWOP_NONE)) |
| 601 |
{ |
| 602 |
g_assert (0); |
| 603 |
_gdk_window_destroy (window, FALSE); |
| 604 |
|
| 605 |
return; |
| 606 |
} |
| 607 |
|
| 608 |
if (desc.caps != DWCAPS_INPUTONLY) |
| 609 |
{ |
| 610 |
impl->window->SetOpacity (impl->window, 0x00); |
| 611 |
} |
| 612 |
|
| 613 |
break; |
| 614 |
|
| 615 |
case GDK_WINDOW_CHILD: |
| 616 |
impl->window = NULL; |
| 617 |
|
| 618 |
if (!private->input_only && parent_impl->drawable.surface) |
| 619 |
{ |
| 620 |
DFBRectangle rect = { private->x, |
| 621 |
private->y, |
| 622 |
impl->drawable.width, |
| 623 |
impl->drawable.height }; |
| 624 |
parent_impl->drawable.surface->GetSubSurface (parent_impl->drawable.surface, |
| 625 |
&rect, |
| 626 |
&impl->drawable.surface); |
| 627 |
} |
| 628 |
|
| 629 |
break; |
| 630 |
|
| 631 |
default: |
| 632 |
g_warning ("_gdk_window_impl_new: unsupported window type: %d", |
| 633 |
private->window_type); |
| 634 |
_gdk_window_destroy (window, FALSE); |
| 635 |
|
| 636 |
return; |
| 637 |
} |
| 638 |
|
| 639 |
if (impl->drawable.surface) |
| 640 |
{ |
| 641 |
GdkColormap *colormap; |
| 642 |
|
| 643 |
impl->drawable.surface->GetPixelFormat (impl->drawable.surface, |
| 644 |
&impl->drawable.format); |
| 645 |
|
| 646 |
if ((attributes_mask & GDK_WA_COLORMAP) && attributes->colormap) |
| 647 |
{ |
| 648 |
colormap = attributes->colormap; |
| 649 |
} |
| 650 |
else |
| 651 |
{ |
| 652 |
if (gdk_visual_get_system () == visual) |
| 653 |
colormap = gdk_colormap_get_system (); |
| 654 |
else |
| 655 |
colormap = gdk_colormap_new (visual, FALSE); |
| 656 |
} |
| 657 |
|
| 658 |
gdk_drawable_set_colormap (GDK_DRAWABLE (window), colormap); |
| 659 |
} |
| 660 |
else |
| 661 |
{ |
| 662 |
impl->drawable.format = ((GdkVisualDirectFB *)visual)->format; |
| 663 |
} |
| 664 |
|
| 665 |
gdk_window_set_cursor (window, |
| 666 |
((attributes_mask & GDK_WA_CURSOR) ? |
| 667 |
(attributes->cursor) : NULL)); |
| 668 |
|
| 669 |
/* we hold a reference count on ourself */ |
| 670 |
g_object_ref (window); |
| 671 |
|
| 672 |
if (impl->window) |
| 673 |
{ |
| 674 |
impl->window->GetID (impl->window, &impl->dfb_id); |
| 675 |
gdk_directfb_window_id_table_insert (impl->dfb_id, window); |
| 676 |
gdk_directfb_event_windows_add (window); |
| 677 |
} |
| 678 |
|
| 679 |
if (attributes_mask & GDK_WA_TYPE_HINT) |
| 680 |
gdk_window_set_type_hint (window, attributes->type_hint); |
| 681 |
} |
| 682 |
|
| 683 |
void |
| 684 |
_gdk_windowing_window_destroy_foreign (GdkWindow *window) |
| 685 |
{ |
| 686 |
/* It's somebody else's window, but in our hierarchy, |
| 687 |
* so reparent it to the root window, and then send |
| 688 |
* it a delete event, as if we were a WM |
| 689 |
*/ |
| 690 |
gdk_directfb_window_destroy (window, TRUE, TRUE); |
| 691 |
} |
| 692 |
|
| 693 |
static void |
| 694 |
gdk_directfb_window_destroy (GdkWindow *window, |
| 695 |
gboolean recursing, |
| 696 |
gboolean foreign_destroy) |
| 697 |
{ |
| 698 |
GdkWindowObject *private; |
| 699 |
GdkWindowImplDirectFB *impl; |
| 700 |
|
| 701 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 702 |
|
| 703 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p, %srecursing, %sforeign )\n", G_STRFUNC, window, |
| 704 |
recursing ? "" : "not ", foreign_destroy ? "" : "no "); |
| 705 |
|
| 706 |
private = GDK_WINDOW_OBJECT (window); |
| 707 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 708 |
|
| 709 |
_gdk_selection_window_destroyed (window); |
| 710 |
gdk_directfb_event_windows_remove (window); |
| 711 |
|
| 712 |
if (window == _gdk_directfb_pointer_grab_window) |
| 713 |
gdk_pointer_ungrab (GDK_CURRENT_TIME); |
| 714 |
if (window == _gdk_directfb_keyboard_grab_window) |
| 715 |
gdk_keyboard_ungrab (GDK_CURRENT_TIME); |
| 716 |
|
| 717 |
if (window == gdk_directfb_focused_window) |
| 718 |
gdk_directfb_change_focus (NULL); |
| 719 |
|
| 720 |
if (impl->drawable.surface) { |
| 721 |
GdkDrawableImplDirectFB *dimpl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl); |
| 722 |
if (dimpl->cairo_surface) |
| 723 |
cairo_surface_destroy (dimpl->cairo_surface); |
| 724 |
impl->drawable.surface->Release (impl->drawable.surface); |
| 725 |
impl->drawable.surface = NULL; |
| 726 |
} |
| 727 |
|
| 728 |
if (!recursing && !foreign_destroy && impl->window ) { |
| 729 |
impl->window->SetOpacity (impl->window, 0); |
| 730 |
impl->window->Close (impl->window); |
| 731 |
impl->window->Release (impl->window); |
| 732 |
impl->window = NULL; |
| 733 |
} |
| 734 |
} |
| 735 |
|
| 736 |
/* This function is called when the window is really gone. |
| 737 |
*/ |
| 738 |
void |
| 739 |
gdk_window_destroy_notify (GdkWindow *window) |
| 740 |
{ |
| 741 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 742 |
|
| 743 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, window); |
| 744 |
|
| 745 |
if (!GDK_WINDOW_DESTROYED (window)) |
| 746 |
{ |
| 747 |
if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN) |
| 748 |
g_warning ("GdkWindow %p unexpectedly destroyed", window); |
| 749 |
|
| 750 |
_gdk_window_destroy (window, TRUE); |
| 751 |
} |
| 752 |
g_object_unref (window); |
| 753 |
} |
| 754 |
|
| 755 |
/* Focus follows pointer */ |
| 756 |
GdkWindow * |
| 757 |
gdk_directfb_window_find_toplevel (GdkWindow *window) |
| 758 |
{ |
| 759 |
while (window && window != _gdk_parent_root) |
| 760 |
{ |
| 761 |
GdkWindow *parent = (GdkWindow *) (GDK_WINDOW_OBJECT (window))->parent; |
| 762 |
|
| 763 |
if ((parent == _gdk_parent_root) && GDK_WINDOW_IS_MAPPED (window)) |
| 764 |
return window; |
| 765 |
|
| 766 |
window = parent; |
| 767 |
} |
| 768 |
|
| 769 |
return _gdk_parent_root; |
| 770 |
} |
| 771 |
|
| 772 |
GdkWindow * |
| 773 |
gdk_directfb_window_find_focus (void) |
| 774 |
{ |
| 775 |
if (_gdk_directfb_keyboard_grab_window) |
| 776 |
return _gdk_directfb_keyboard_grab_window; |
| 777 |
|
| 778 |
if (!gdk_directfb_focused_window) |
| 779 |
gdk_directfb_focused_window = g_object_ref (_gdk_parent_root); |
| 780 |
|
| 781 |
return gdk_directfb_focused_window; |
| 782 |
} |
| 783 |
|
| 784 |
void |
| 785 |
gdk_directfb_change_focus (GdkWindow *new_focus_window) |
| 786 |
{ |
| 787 |
GdkEventFocus *event; |
| 788 |
GdkWindow *old_win; |
| 789 |
GdkWindow *new_win; |
| 790 |
GdkWindow *event_win; |
| 791 |
|
| 792 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, new_focus_window); |
| 793 |
|
| 794 |
/* No focus changes while the pointer is grabbed */ |
| 795 |
if (_gdk_directfb_pointer_grab_window) |
| 796 |
return; |
| 797 |
|
| 798 |
old_win = gdk_directfb_focused_window; |
| 799 |
new_win = gdk_directfb_window_find_toplevel (new_focus_window); |
| 800 |
|
| 801 |
if (old_win == new_win) |
| 802 |
return; |
| 803 |
|
| 804 |
if (old_win) |
| 805 |
{ |
| 806 |
event_win = gdk_directfb_keyboard_event_window (old_win, |
| 807 |
GDK_FOCUS_CHANGE); |
| 808 |
if (event_win) |
| 809 |
{ |
| 810 |
event = (GdkEventFocus *) gdk_directfb_event_make (event_win, |
| 811 |
GDK_FOCUS_CHANGE); |
| 812 |
event->in = FALSE; |
| 813 |
} |
| 814 |
} |
| 815 |
|
| 816 |
event_win = gdk_directfb_keyboard_event_window (new_win, |
| 817 |
GDK_FOCUS_CHANGE); |
| 818 |
if (event_win) |
| 819 |
{ |
| 820 |
event = (GdkEventFocus *) gdk_directfb_event_make (event_win, |
| 821 |
GDK_FOCUS_CHANGE); |
| 822 |
event->in = TRUE; |
| 823 |
} |
| 824 |
|
| 825 |
if (gdk_directfb_focused_window) |
| 826 |
g_object_unref (gdk_directfb_focused_window); |
| 827 |
gdk_directfb_focused_window = g_object_ref (new_win); |
| 828 |
} |
| 829 |
|
| 830 |
void |
| 831 |
gdk_window_set_accept_focus (GdkWindow *window, |
| 832 |
gboolean accept_focus) |
| 833 |
{ |
| 834 |
GdkWindowObject *private; |
| 835 |
g_return_if_fail (window != NULL); |
| 836 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 837 |
|
| 838 |
private = (GdkWindowObject *)window; |
| 839 |
|
| 840 |
accept_focus = accept_focus != FALSE; |
| 841 |
|
| 842 |
if (private->accept_focus != accept_focus) |
| 843 |
private->accept_focus = accept_focus; |
| 844 |
|
| 845 |
} |
| 846 |
|
| 847 |
void |
| 848 |
gdk_window_set_focus_on_map (GdkWindow *window, |
| 849 |
gboolean focus_on_map) |
| 850 |
{ |
| 851 |
GdkWindowObject *private; |
| 852 |
g_return_if_fail (window != NULL); |
| 853 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 854 |
|
| 855 |
private = (GdkWindowObject *)window; |
| 856 |
|
| 857 |
focus_on_map = focus_on_map != FALSE; |
| 858 |
|
| 859 |
if (private->focus_on_map != focus_on_map) |
| 860 |
private->focus_on_map = focus_on_map; |
| 861 |
} |
| 862 |
|
| 863 |
static gboolean |
| 864 |
gdk_directfb_window_raise (GdkWindow *window) |
| 865 |
{ |
| 866 |
GdkWindowObject *parent; |
| 867 |
|
| 868 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, window); |
| 869 |
|
| 870 |
parent = GDK_WINDOW_OBJECT (window)->parent; |
| 871 |
|
| 872 |
if (parent->children->data == window) |
| 873 |
return FALSE; |
| 874 |
|
| 875 |
parent->children = g_list_remove (parent->children, window); |
| 876 |
parent->children = g_list_prepend (parent->children, window); |
| 877 |
|
| 878 |
return TRUE; |
| 879 |
} |
| 880 |
|
| 881 |
static void |
| 882 |
gdk_directfb_window_lower (GdkWindow *window) |
| 883 |
{ |
| 884 |
GdkWindowObject *parent; |
| 885 |
|
| 886 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, window); |
| 887 |
|
| 888 |
parent = GDK_WINDOW_OBJECT (window)->parent; |
| 889 |
|
| 890 |
parent->children = g_list_remove (parent->children, window); |
| 891 |
parent->children = g_list_append (parent->children, window); |
| 892 |
} |
| 893 |
|
| 894 |
static gboolean |
| 895 |
all_parents_shown (GdkWindowObject *private) |
| 896 |
{ |
| 897 |
while (GDK_WINDOW_IS_MAPPED (private)) |
| 898 |
{ |
| 899 |
if (private->parent) |
| 900 |
private = GDK_WINDOW_OBJECT (private)->parent; |
| 901 |
else |
| 902 |
return TRUE; |
| 903 |
} |
| 904 |
|
| 905 |
return FALSE; |
| 906 |
} |
| 907 |
|
| 908 |
static void |
| 909 |
send_map_events (GdkWindowObject *private) |
| 910 |
{ |
| 911 |
GList *list; |
| 912 |
GdkWindow *event_win; |
| 913 |
|
| 914 |
if (!GDK_WINDOW_IS_MAPPED (private)) |
| 915 |
return; |
| 916 |
|
| 917 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, private); |
| 918 |
|
| 919 |
event_win = gdk_directfb_other_event_window ((GdkWindow *) private, GDK_MAP); |
| 920 |
if (event_win) |
| 921 |
gdk_directfb_event_make (event_win, GDK_MAP); |
| 922 |
|
| 923 |
for (list = private->children; list; list = list->next) |
| 924 |
send_map_events (list->data); |
| 925 |
} |
| 926 |
|
| 927 |
static GdkWindow * |
| 928 |
gdk_directfb_find_common_ancestor (GdkWindow *win1, |
| 929 |
GdkWindow *win2) |
| 930 |
{ |
| 931 |
GdkWindowObject *a; |
| 932 |
GdkWindowObject *b; |
| 933 |
|
| 934 |
for (a = GDK_WINDOW_OBJECT (win1); a; a = a->parent) |
| 935 |
for (b = GDK_WINDOW_OBJECT (win2); b; b = b->parent) |
| 936 |
{ |
| 937 |
if (a == b) |
| 938 |
return GDK_WINDOW (a); |
| 939 |
} |
| 940 |
|
| 941 |
return NULL; |
| 942 |
} |
| 943 |
|
| 944 |
void |
| 945 |
gdk_directfb_window_send_crossing_events (GdkWindow *src, |
| 946 |
GdkWindow *dest, |
| 947 |
GdkCrossingMode mode) |
| 948 |
{ |
| 949 |
GdkWindow *c; |
| 950 |
GdkWindow *win, *last, *next; |
| 951 |
GdkEvent *event; |
| 952 |
gint x, y, x_int, y_int; |
| 953 |
GdkModifierType modifiers; |
| 954 |
GSList *path, *list; |
| 955 |
gboolean non_linear; |
| 956 |
GdkWindow *a; |
| 957 |
GdkWindow *b; |
| 958 |
GdkWindow *event_win; |
| 959 |
|
| 960 |
D_DEBUG_AT (GDKDFB_Crossing, "%s( %p -> %p, %d )\n", G_STRFUNC, src, dest, mode); |
| 961 |
|
| 962 |
/* Do a possible cursor change before checking if we need to |
| 963 |
generate crossing events so cursor changes due to pointer |
| 964 |
grabs work correctly. */ |
| 965 |
{ |
| 966 |
static GdkCursorDirectFB *last_cursor = NULL; |
| 967 |
|
| 968 |
GdkWindowObject *private = GDK_WINDOW_OBJECT (dest); |
| 969 |
GdkWindowImplDirectFB *impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 970 |
GdkCursorDirectFB *cursor; |
| 971 |
|
| 972 |
if (_gdk_directfb_pointer_grab_cursor) |
| 973 |
cursor = (GdkCursorDirectFB*) _gdk_directfb_pointer_grab_cursor; |
| 974 |
else |
| 975 |
cursor = (GdkCursorDirectFB*) impl->cursor; |
| 976 |
|
| 977 |
if (cursor != last_cursor) |
| 978 |
{ |
| 979 |
win = gdk_directfb_window_find_toplevel (dest); |
| 980 |
private = GDK_WINDOW_OBJECT (win); |
| 981 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 982 |
|
| 983 |
if (impl->window) |
| 984 |
impl->window->SetCursorShape (impl->window, |
| 985 |
cursor->shape, |
| 986 |
cursor->hot_x, cursor->hot_y); |
| 987 |
last_cursor = cursor; |
| 988 |
} |
| 989 |
} |
| 990 |
|
| 991 |
if (dest == gdk_directfb_window_containing_pointer) { |
| 992 |
D_DEBUG_AT (GDKDFB_Crossing, " -> already containing the pointer\n"); |
| 993 |
return; |
| 994 |
} |
| 995 |
|
| 996 |
if (gdk_directfb_window_containing_pointer == NULL) |
| 997 |
gdk_directfb_window_containing_pointer = g_object_ref (_gdk_parent_root); |
| 998 |
|
| 999 |
if (src) |
| 1000 |
a = src; |
| 1001 |
else |
| 1002 |
a = gdk_directfb_window_containing_pointer; |
| 1003 |
|
| 1004 |
b = dest; |
| 1005 |
|
| 1006 |
if (a == b) { |
| 1007 |
D_DEBUG_AT (GDKDFB_Crossing, " -> src == dest\n"); |
| 1008 |
return; |
| 1009 |
} |
| 1010 |
|
| 1011 |
/* gdk_directfb_window_containing_pointer might have been destroyed. |
| 1012 |
* The refcount we hold on it should keep it, but it's parents |
| 1013 |
* might have died. |
| 1014 |
*/ |
| 1015 |
if (GDK_WINDOW_DESTROYED (a)) { |
| 1016 |
D_DEBUG_AT (GDKDFB_Crossing, " -> src is destroyed!\n"); |
| 1017 |
a = _gdk_parent_root; |
| 1018 |
} |
| 1019 |
|
| 1020 |
gdk_directfb_mouse_get_info (&x, &y, &modifiers); |
| 1021 |
|
| 1022 |
c = gdk_directfb_find_common_ancestor (a, b); |
| 1023 |
|
| 1024 |
D_DEBUG_AT (GDKDFB_Crossing, " -> common ancestor %p\n", c); |
| 1025 |
|
| 1026 |
non_linear = (c != a) && (c != b); |
| 1027 |
|
| 1028 |
D_DEBUG_AT (GDKDFB_Crossing, " -> non_linear: %s\n", non_linear ? "YES" : "NO"); |
| 1029 |
|
| 1030 |
event_win = gdk_directfb_pointer_event_window (a, GDK_LEAVE_NOTIFY); |
| 1031 |
if (event_win) |
| 1032 |
{ |
| 1033 |
D_DEBUG_AT (GDKDFB_Crossing, " -> sending LEAVE to src\n"); |
| 1034 |
|
| 1035 |
event = gdk_directfb_event_make (event_win, GDK_LEAVE_NOTIFY); |
| 1036 |
event->crossing.subwindow = NULL; |
| 1037 |
|
| 1038 |
gdk_window_get_origin (a, &x_int, &y_int); |
| 1039 |
|
| 1040 |
event->crossing.x = x - x_int; |
| 1041 |
event->crossing.y = y - y_int; |
| 1042 |
event->crossing.x_root = x; |
| 1043 |
event->crossing.y_root = y; |
| 1044 |
event->crossing.mode = mode; |
| 1045 |
|
| 1046 |
if (non_linear) |
| 1047 |
event->crossing.detail = GDK_NOTIFY_NONLINEAR; |
| 1048 |
else if (c == a) |
| 1049 |
event->crossing.detail = GDK_NOTIFY_INFERIOR; |
| 1050 |
else |
| 1051 |
event->crossing.detail = GDK_NOTIFY_ANCESTOR; |
| 1052 |
|
| 1053 |
event->crossing.focus = FALSE; |
| 1054 |
event->crossing.state = modifiers; |
| 1055 |
|
| 1056 |
D_DEBUG_AT (GDKDFB_Crossing, |
| 1057 |
" => LEAVE (%p/%p) at %4f,%4f (%4f,%4f) mode %d, detail %d\n", |
| 1058 |
event_win, a, |
| 1059 |
event->crossing.x, event->crossing.y, |
| 1060 |
event->crossing.x_root, event->crossing.y_root, |
| 1061 |
event->crossing.mode, event->crossing.detail); |
| 1062 |
} |
| 1063 |
|
| 1064 |
/* Traverse up from a to (excluding) c */ |
| 1065 |
if (c != a) |
| 1066 |
{ |
| 1067 |
last = a; |
| 1068 |
win = GDK_WINDOW (GDK_WINDOW_OBJECT (a)->parent); |
| 1069 |
while (win != c) |
| 1070 |
{ |
| 1071 |
event_win = |
| 1072 |
gdk_directfb_pointer_event_window (win, GDK_LEAVE_NOTIFY); |
| 1073 |
|
| 1074 |
if (event_win) |
| 1075 |
{ |
| 1076 |
event = gdk_directfb_event_make (event_win, GDK_LEAVE_NOTIFY); |
| 1077 |
|
| 1078 |
event->crossing.subwindow = g_object_ref (last); |
| 1079 |
|
| 1080 |
gdk_window_get_origin (win, &x_int, &y_int); |
| 1081 |
|
| 1082 |
event->crossing.x = x - x_int; |
| 1083 |
event->crossing.y = y - y_int; |
| 1084 |
event->crossing.x_root = x; |
| 1085 |
event->crossing.y_root = y; |
| 1086 |
event->crossing.mode = mode; |
| 1087 |
|
| 1088 |
if (non_linear) |
| 1089 |
event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL; |
| 1090 |
else |
| 1091 |
event->crossing.detail = GDK_NOTIFY_VIRTUAL; |
| 1092 |
|
| 1093 |
event->crossing.focus = FALSE; |
| 1094 |
event->crossing.state = modifiers; |
| 1095 |
|
| 1096 |
D_DEBUG_AT (GDKDFB_Crossing, |
| 1097 |
" -> LEAVE (%p/%p) at %4f,%4f (%4f,%4f) mode %d, detail %d\n", |
| 1098 |
event_win, win, |
| 1099 |
event->crossing.x, event->crossing.y, |
| 1100 |
event->crossing.x_root, event->crossing.y_root, |
| 1101 |
event->crossing.mode, event->crossing.detail); |
| 1102 |
} |
| 1103 |
|
| 1104 |
last = win; |
| 1105 |
win = GDK_WINDOW (GDK_WINDOW_OBJECT (win)->parent); |
| 1106 |
} |
| 1107 |
} |
| 1108 |
|
| 1109 |
/* Traverse down from c to b */ |
| 1110 |
if (c != b) |
| 1111 |
{ |
| 1112 |
path = NULL; |
| 1113 |
win = GDK_WINDOW (GDK_WINDOW_OBJECT (b)->parent); |
| 1114 |
while (win != c) |
| 1115 |
{ |
| 1116 |
path = g_slist_prepend (path, win); |
| 1117 |
win = GDK_WINDOW (GDK_WINDOW_OBJECT (win)->parent); |
| 1118 |
} |
| 1119 |
|
| 1120 |
list = path; |
| 1121 |
while (list) |
| 1122 |
{ |
| 1123 |
win = GDK_WINDOW (list->data); |
| 1124 |
list = g_slist_next (list); |
| 1125 |
|
| 1126 |
if (list) |
| 1127 |
next = GDK_WINDOW (list->data); |
| 1128 |
else |
| 1129 |
next = b; |
| 1130 |
|
| 1131 |
event_win = |
| 1132 |
gdk_directfb_pointer_event_window (win, GDK_ENTER_NOTIFY); |
| 1133 |
|
| 1134 |
if (event_win) |
| 1135 |
{ |
| 1136 |
event = gdk_directfb_event_make (event_win, GDK_ENTER_NOTIFY); |
| 1137 |
|
| 1138 |
event->crossing.subwindow = g_object_ref (next); |
| 1139 |
|
| 1140 |
gdk_window_get_origin (win, &x_int, &y_int); |
| 1141 |
|
| 1142 |
event->crossing.x = x - x_int; |
| 1143 |
event->crossing.y = y - y_int; |
| 1144 |
event->crossing.x_root = x; |
| 1145 |
event->crossing.y_root = y; |
| 1146 |
event->crossing.mode = mode; |
| 1147 |
|
| 1148 |
if (non_linear) |
| 1149 |
event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL; |
| 1150 |
else |
| 1151 |
event->crossing.detail = GDK_NOTIFY_VIRTUAL; |
| 1152 |
|
| 1153 |
event->crossing.focus = FALSE; |
| 1154 |
event->crossing.state = modifiers; |
| 1155 |
|
| 1156 |
D_DEBUG_AT (GDKDFB_Crossing, |
| 1157 |
" -> ENTER (%p/%p) at %4f,%4f (%4f,%4f) mode %d, detail %d\n", |
| 1158 |
event_win, win, |
| 1159 |
event->crossing.x, event->crossing.y, |
| 1160 |
event->crossing.x_root, event->crossing.y_root, |
| 1161 |
event->crossing.mode, event->crossing.detail); |
| 1162 |
} |
| 1163 |
} |
| 1164 |
|
| 1165 |
g_slist_free (path); |
| 1166 |
} |
| 1167 |
|
| 1168 |
event_win = gdk_directfb_pointer_event_window (b, GDK_ENTER_NOTIFY); |
| 1169 |
if (event_win) |
| 1170 |
{ |
| 1171 |
event = gdk_directfb_event_make (event_win, GDK_ENTER_NOTIFY); |
| 1172 |
|
| 1173 |
event->crossing.subwindow = NULL; |
| 1174 |
|
| 1175 |
gdk_window_get_origin (b, &x_int, &y_int); |
| 1176 |
|
| 1177 |
event->crossing.x = x - x_int; |
| 1178 |
event->crossing.y = y - y_int; |
| 1179 |
event->crossing.x_root = x; |
| 1180 |
event->crossing.y_root = y; |
| 1181 |
event->crossing.mode = mode; |
| 1182 |
|
| 1183 |
if (non_linear) |
| 1184 |
event->crossing.detail = GDK_NOTIFY_NONLINEAR; |
| 1185 |
else if (c==a) |
| 1186 |
event->crossing.detail = GDK_NOTIFY_ANCESTOR; |
| 1187 |
else |
| 1188 |
event->crossing.detail = GDK_NOTIFY_INFERIOR; |
| 1189 |
|
| 1190 |
event->crossing.focus = FALSE; |
| 1191 |
event->crossing.state = modifiers; |
| 1192 |
|
| 1193 |
D_DEBUG_AT (GDKDFB_Crossing, |
| 1194 |
" => ENTER (%p/%p) at %4f,%4f (%4f,%4f) mode %d, detail %d\n", |
| 1195 |
event_win, b, |
| 1196 |
event->crossing.x, event->crossing.y, |
| 1197 |
event->crossing.x_root, event->crossing.y_root, |
| 1198 |
event->crossing.mode, event->crossing.detail); |
| 1199 |
} |
| 1200 |
|
| 1201 |
if (mode != GDK_CROSSING_GRAB) |
| 1202 |
{ |
| 1203 |
//this seems to cause focus to change as the pointer moves yuck |
| 1204 |
//gdk_directfb_change_focus (b); |
| 1205 |
if (b != gdk_directfb_window_containing_pointer) |
| 1206 |
{ |
| 1207 |
g_object_unref (gdk_directfb_window_containing_pointer); |
| 1208 |
gdk_directfb_window_containing_pointer = g_object_ref (b); |
| 1209 |
} |
| 1210 |
} |
| 1211 |
} |
| 1212 |
|
| 1213 |
static void |
| 1214 |
show_window_internal (GdkWindow *window, |
| 1215 |
gboolean raise) |
| 1216 |
{ |
| 1217 |
GdkWindowObject *private; |
| 1218 |
GdkWindowImplDirectFB *impl; |
| 1219 |
GdkWindow *mousewin; |
| 1220 |
|
| 1221 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p, %sraise )\n", G_STRFUNC, |
| 1222 |
window, raise ? "" : "no "); |
| 1223 |
|
| 1224 |
private = GDK_WINDOW_OBJECT (window); |
| 1225 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 1226 |
|
| 1227 |
if (!private->destroyed && !GDK_WINDOW_IS_MAPPED (private)) |
| 1228 |
{ |
| 1229 |
if (raise) |
| 1230 |
gdk_window_raise (window); |
| 1231 |
|
| 1232 |
if (all_parents_shown (GDK_WINDOW_OBJECT (private)->parent)) |
| 1233 |
{ |
| 1234 |
send_map_events (private); |
| 1235 |
|
| 1236 |
mousewin = gdk_window_at_pointer (NULL, NULL); |
| 1237 |
gdk_directfb_window_send_crossing_events (NULL, mousewin, |
| 1238 |
GDK_CROSSING_NORMAL); |
| 1239 |
|
| 1240 |
if (private->input_only) |
| 1241 |
return; |
| 1242 |
|
| 1243 |
gdk_window_invalidate_rect (window, NULL, TRUE); |
| 1244 |
} |
| 1245 |
} |
| 1246 |
|
| 1247 |
if (impl->window) |
| 1248 |
{ |
| 1249 |
if (gdk_directfb_apply_focus_opacity) |
| 1250 |
impl->window->SetOpacity (impl->window, |
| 1251 |
(impl->opacity >> 1) + (impl->opacity >> 2)); |
| 1252 |
else |
| 1253 |
impl->window->SetOpacity (impl->window, impl->opacity); |
| 1254 |
/* if its the first window focus it */ |
| 1255 |
} |
| 1256 |
} |
| 1257 |
|
| 1258 |
static void |
| 1259 |
gdk_directfb_window_show (GdkWindow *window, |
| 1260 |
gboolean raise) |
| 1261 |
{ |
| 1262 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1263 |
|
| 1264 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, window); |
| 1265 |
|
| 1266 |
show_window_internal (window, raise); |
| 1267 |
} |
| 1268 |
|
| 1269 |
static void |
| 1270 |
gdk_directfb_window_hide (GdkWindow *window) |
| 1271 |
{ |
| 1272 |
GdkWindowObject *private; |
| 1273 |
GdkWindowImplDirectFB *impl; |
| 1274 |
GdkWindow *mousewin; |
| 1275 |
GdkWindow *event_win; |
| 1276 |
|
| 1277 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1278 |
|
| 1279 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, window); |
| 1280 |
|
| 1281 |
private = GDK_WINDOW_OBJECT (window); |
| 1282 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 1283 |
|
| 1284 |
if (impl->window) |
| 1285 |
impl->window->SetOpacity (impl->window, 0); |
| 1286 |
|
| 1287 |
if (!private->destroyed && GDK_WINDOW_IS_MAPPED (private)) |
| 1288 |
{ |
| 1289 |
GdkEvent *event; |
| 1290 |
|
| 1291 |
if (!private->input_only && private->parent) |
| 1292 |
{ |
| 1293 |
gdk_window_clear_area (GDK_WINDOW (private->parent), |
| 1294 |
private->x, |
| 1295 |
private->y, |
| 1296 |
impl->drawable.width, |
| 1297 |
impl->drawable.height); |
| 1298 |
} |
| 1299 |
|
| 1300 |
event_win = gdk_directfb_other_event_window (window, GDK_UNMAP); |
| 1301 |
if (event_win) |
| 1302 |
event = gdk_directfb_event_make (event_win, GDK_UNMAP); |
| 1303 |
|
| 1304 |
mousewin = gdk_window_at_pointer (NULL, NULL); |
| 1305 |
gdk_directfb_window_send_crossing_events (NULL, |
| 1306 |
mousewin, |
| 1307 |
GDK_CROSSING_NORMAL); |
| 1308 |
|
| 1309 |
if (window == _gdk_directfb_pointer_grab_window) |
| 1310 |
gdk_pointer_ungrab (GDK_CURRENT_TIME); |
| 1311 |
if (window == _gdk_directfb_keyboard_grab_window) |
| 1312 |
gdk_keyboard_ungrab (GDK_CURRENT_TIME); |
| 1313 |
} |
| 1314 |
} |
| 1315 |
|
| 1316 |
static void |
| 1317 |
gdk_directfb_window_withdraw (GdkWindow *window) |
| 1318 |
{ |
| 1319 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1320 |
|
| 1321 |
/* for now this should be enough */ |
| 1322 |
gdk_window_hide (window); |
| 1323 |
} |
| 1324 |
|
| 1325 |
void |
| 1326 |
_gdk_directfb_move_resize_child (GdkWindow *window, |
| 1327 |
gint x, |
| 1328 |
gint y, |
| 1329 |
gint width, |
| 1330 |
gint height) |
| 1331 |
{ |
| 1332 |
GdkWindowObject *private; |
| 1333 |
GdkWindowImplDirectFB *impl; |
| 1334 |
GdkWindowImplDirectFB *parent_impl; |
| 1335 |
GList *list; |
| 1336 |
|
| 1337 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1338 |
|
| 1339 |
private = GDK_WINDOW_OBJECT (window); |
| 1340 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 1341 |
|
| 1342 |
impl->drawable.width = width; |
| 1343 |
impl->drawable.height = height; |
| 1344 |
|
| 1345 |
if (!private->input_only) |
| 1346 |
{ |
| 1347 |
if (impl->drawable.surface) |
| 1348 |
{ |
| 1349 |
if (impl->drawable.cairo_surface) |
| 1350 |
cairo_surface_destroy (impl->drawable.cairo_surface); |
| 1351 |
|
| 1352 |
impl->drawable.surface->Release (impl->drawable.surface); |
| 1353 |
impl->drawable.surface = NULL; |
| 1354 |
} |
| 1355 |
|
| 1356 |
parent_impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (private->parent)->impl); |
| 1357 |
|
| 1358 |
if (parent_impl->drawable.surface) |
| 1359 |
{ |
| 1360 |
DFBRectangle rect = { x, y, width, height }; |
| 1361 |
|
| 1362 |
parent_impl->drawable.surface->GetSubSurface (parent_impl->drawable.surface, |
| 1363 |
&rect, |
| 1364 |
&impl->drawable.surface); |
| 1365 |
} |
| 1366 |
} |
| 1367 |
} |
| 1368 |
|
| 1369 |
static void |
| 1370 |
gdk_directfb_window_move (GdkWindow *window, |
| 1371 |
gint x, |
| 1372 |
gint y) |
| 1373 |
{ |
| 1374 |
GdkWindowObject *private; |
| 1375 |
GdkWindowImplDirectFB *impl; |
| 1376 |
|
| 1377 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1378 |
|
| 1379 |
private = GDK_WINDOW_OBJECT (window); |
| 1380 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 1381 |
|
| 1382 |
if (impl->window) |
| 1383 |
{ |
| 1384 |
impl->window->MoveTo (impl->window, x, y); |
| 1385 |
} |
| 1386 |
else |
| 1387 |
{ |
| 1388 |
gint width = impl->drawable.width; |
| 1389 |
gint height = impl->drawable.height; |
| 1390 |
GdkRectangle old = { private->x, private->y,width,height }; |
| 1391 |
|
| 1392 |
_gdk_directfb_move_resize_child (window, x, y, width, height); |
| 1393 |
|
| 1394 |
if (GDK_WINDOW_IS_MAPPED (private)) |
| 1395 |
{ |
| 1396 |
GdkWindow *mousewin; |
| 1397 |
GdkRectangle new = { x, y, width, height }; |
| 1398 |
|
| 1399 |
gdk_rectangle_union (&new, &old, &new); |
| 1400 |
gdk_window_invalidate_rect (GDK_WINDOW (private->parent), &new,TRUE); |
| 1401 |
|
| 1402 |
/* The window the pointer is in might have changed */ |
| 1403 |
mousewin = gdk_window_at_pointer (NULL, NULL); |
| 1404 |
gdk_directfb_window_send_crossing_events (NULL, mousewin, |
| 1405 |
GDK_CROSSING_NORMAL); |
| 1406 |
} |
| 1407 |
} |
| 1408 |
} |
| 1409 |
|
| 1410 |
static void |
| 1411 |
gdk_directfb_window_move_resize (GdkWindow *window, |
| 1412 |
gboolean with_move, |
| 1413 |
gint x, |
| 1414 |
gint y, |
| 1415 |
gint width, |
| 1416 |
gint height) |
| 1417 |
{ |
| 1418 |
GdkWindowObject *private; |
| 1419 |
GdkWindowImplDirectFB *impl; |
| 1420 |
|
| 1421 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1422 |
|
| 1423 |
private = GDK_WINDOW_OBJECT (window); |
| 1424 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 1425 |
|
| 1426 |
if (with_move && (width < 0 && height < 0)) |
| 1427 |
{ |
| 1428 |
gdk_directfb_window_move (window, x, y); |
| 1429 |
return; |
| 1430 |
} |
| 1431 |
|
| 1432 |
if (width < 1) |
| 1433 |
width = 1; |
| 1434 |
if (height < 1) |
| 1435 |
height = 1; |
| 1436 |
|
| 1437 |
if (private->destroyed || |
| 1438 |
(private->x == x && private->y == y && |
| 1439 |
impl->drawable.width == width && impl->drawable.height == height)) |
| 1440 |
return; |
| 1441 |
|
| 1442 |
if (private->parent && (private->parent->window_type != GDK_WINDOW_CHILD)) |
| 1443 |
{ |
| 1444 |
GdkWindowChildHandlerData *data; |
| 1445 |
|
| 1446 |
data = g_object_get_data (G_OBJECT (private->parent), |
| 1447 |
"gdk-window-child-handler"); |
| 1448 |
|
| 1449 |
if (data && |
| 1450 |
(*data->changed) (window, x, y, width, height, data->user_data)) |
| 1451 |
return; |
| 1452 |
} |
| 1453 |
|
| 1454 |
if (impl->drawable.width == width && impl->drawable.height == height) |
| 1455 |
{ |
| 1456 |
if (with_move) |
| 1457 |
gdk_directfb_window_move (window, x, y); |
| 1458 |
} |
| 1459 |
else if (impl->window) |
| 1460 |
{ |
| 1461 |
if (with_move) { |
| 1462 |
impl->window->MoveTo (impl->window, x, y); |
| 1463 |
} |
| 1464 |
impl->drawable.width = width; |
| 1465 |
impl->drawable.height = height; |
| 1466 |
|
| 1467 |
impl->window->Resize (impl->window, width, height); |
| 1468 |
} |
| 1469 |
else |
| 1470 |
{ |
| 1471 |
GdkRectangle old = { private->x, private->y, |
| 1472 |
impl->drawable.width, impl->drawable.height }; |
| 1473 |
GdkRectangle new = { x, y, width, height }; |
| 1474 |
|
| 1475 |
if (! with_move) |
| 1476 |
{ |
| 1477 |
new.x = private->x; |
| 1478 |
new.y = private->y; |
| 1479 |
} |
| 1480 |
|
| 1481 |
_gdk_directfb_move_resize_child (window, |
| 1482 |
new.x, new.y, new.width, new.height); |
| 1483 |
|
| 1484 |
if (GDK_WINDOW_IS_MAPPED (private)) |
| 1485 |
{ |
| 1486 |
GdkWindow *mousewin; |
| 1487 |
|
| 1488 |
gdk_rectangle_union (&new, &old, &new); |
| 1489 |
gdk_window_invalidate_rect (GDK_WINDOW (private->parent), &new,TRUE); |
| 1490 |
|
| 1491 |
/* The window the pointer is in might have changed */ |
| 1492 |
mousewin = gdk_window_at_pointer (NULL, NULL); |
| 1493 |
gdk_directfb_window_send_crossing_events (NULL, mousewin, |
| 1494 |
GDK_CROSSING_NORMAL); |
| 1495 |
} |
| 1496 |
} |
| 1497 |
} |
| 1498 |
|
| 1499 |
static gboolean |
| 1500 |
gdk_directfb_window_reparent (GdkWindow *window, |
| 1501 |
GdkWindow *new_parent, |
| 1502 |
gint x, |
| 1503 |
gint y) |
| 1504 |
{ |
| 1505 |
GdkWindowObject *window_private; |
| 1506 |
GdkWindowObject *parent_private; |
| 1507 |
GdkWindowObject *old_parent_private; |
| 1508 |
GdkWindowImplDirectFB *impl; |
| 1509 |
GdkWindowImplDirectFB *parent_impl; |
| 1510 |
GdkVisual *visual; |
| 1511 |
|
| 1512 |
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE); |
| 1513 |
|
| 1514 |
if (GDK_WINDOW_DESTROYED (window)) |
| 1515 |
return FALSE; |
| 1516 |
|
| 1517 |
if (!new_parent) |
| 1518 |
new_parent = _gdk_parent_root; |
| 1519 |
|
| 1520 |
window_private = (GdkWindowObject *) window; |
| 1521 |
old_parent_private = (GdkWindowObject *) window_private->parent; |
| 1522 |
parent_private = (GdkWindowObject *) new_parent; |
| 1523 |
parent_impl = GDK_WINDOW_IMPL_DIRECTFB (parent_private->impl); |
| 1524 |
visual = gdk_drawable_get_visual (window); |
| 1525 |
|
| 1526 |
/* already parented */ |
| 1527 |
if (window_private->parent == (GdkWindowObject *) new_parent) |
| 1528 |
return FALSE; |
| 1529 |
|
| 1530 |
window_private->parent = (GdkWindowObject *) new_parent; |
| 1531 |
|
| 1532 |
impl = GDK_WINDOW_IMPL_DIRECTFB (window_private->impl); |
| 1533 |
|
| 1534 |
if (impl->drawable.surface) { |
| 1535 |
impl->drawable.surface->Release (impl->drawable.surface); |
| 1536 |
impl->drawable.surface = NULL; |
| 1537 |
} |
| 1538 |
|
| 1539 |
if (impl->window != NULL) { |
| 1540 |
gdk_directfb_window_id_table_remove (impl->dfb_id); |
| 1541 |
impl->window->SetOpacity (impl->window, 0); |
| 1542 |
impl->window->Close (impl->window); |
| 1543 |
impl->window->Release (impl->window); |
| 1544 |
impl->window = NULL; |
| 1545 |
} |
| 1546 |
|
| 1547 |
//create window were a child of the root now |
| 1548 |
if (window_private->parent == (GdkWindowObject *)_gdk_parent_root) { |
| 1549 |
DFBWindowDescription desc; |
| 1550 |
DFBWindowOptions window_options = DWOP_NONE; |
| 1551 |
desc.flags = DWDESC_CAPS; |
| 1552 |
if (window_private->input_only) { |
| 1553 |
desc.caps = DWCAPS_INPUTONLY; |
| 1554 |
} else { |
| 1555 |
desc.flags |= DWDESC_PIXELFORMAT; |
| 1556 |
desc.pixelformat = ((GdkVisualDirectFB *) visual)->format; |
| 1557 |
if (DFB_PIXELFORMAT_HAS_ALPHA (desc.pixelformat)) { |
| 1558 |
desc.flags |= DWDESC_CAPS; |
| 1559 |
desc.caps = DWCAPS_ALPHACHANNEL; |
| 1560 |
} |
| 1561 |
} |
| 1562 |
if (window_private->window_type == GDK_WINDOW_CHILD) |
| 1563 |
window_private->window_type = GDK_WINDOW_TOPLEVEL; |
| 1564 |
desc.flags |= (DWDESC_WIDTH | DWDESC_HEIGHT | |
| 1565 |
DWDESC_POSX | DWDESC_POSY); |
| 1566 |
desc.posx = x; |
| 1567 |
desc.posy = y; |
| 1568 |
desc.width = impl->drawable.width; |
| 1569 |
desc.height = impl->drawable.height; |
| 1570 |
if (!create_directfb_window (impl, &desc, window_options)) |
| 1571 |
{ |
| 1572 |
g_assert (0); |
| 1573 |
_gdk_window_destroy (window, FALSE); |
| 1574 |
return FALSE; |
| 1575 |
} |
| 1576 |
/* we hold a reference count on ourselves */ |
| 1577 |
g_object_ref (window); |
| 1578 |
impl->window->GetID (impl->window, &impl->dfb_id); |
| 1579 |
gdk_directfb_window_id_table_insert (impl->dfb_id, window); |
| 1580 |
gdk_directfb_event_windows_add (window); |
| 1581 |
} else { |
| 1582 |
DFBRectangle rect = { x, y, |
| 1583 |
impl->drawable.width, |
| 1584 |
impl->drawable.height }; |
| 1585 |
impl->window = NULL; |
| 1586 |
parent_impl->drawable.surface->GetSubSurface (parent_impl->drawable.surface, |
| 1587 |
&rect, |
| 1588 |
&impl->drawable.surface); |
| 1589 |
} |
| 1590 |
|
| 1591 |
return TRUE; |
| 1592 |
} |
| 1593 |
|
| 1594 |
static void |
| 1595 |
gdk_window_directfb_raise (GdkWindow *window) |
| 1596 |
{ |
| 1597 |
GdkWindowImplDirectFB *impl; |
| 1598 |
|
| 1599 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, window); |
| 1600 |
|
| 1601 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1602 |
|
| 1603 |
if (GDK_WINDOW_DESTROYED (window)) |
| 1604 |
return; |
| 1605 |
|
| 1606 |
impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (window)->impl); |
| 1607 |
|
| 1608 |
if (impl->window) |
| 1609 |
{ |
| 1610 |
DFBResult ret; |
| 1611 |
|
| 1612 |
ret = impl->window->RaiseToTop (impl->window); |
| 1613 |
if (ret) |
| 1614 |
DirectFBError ("gdkwindow-directfb.c: RaiseToTop", ret); |
| 1615 |
else |
| 1616 |
gdk_directfb_window_raise (window); |
| 1617 |
} |
| 1618 |
else |
| 1619 |
{ |
| 1620 |
if (gdk_directfb_window_raise (window)) |
| 1621 |
gdk_window_invalidate_rect (window, NULL, TRUE); |
| 1622 |
} |
| 1623 |
} |
| 1624 |
|
| 1625 |
static void |
| 1626 |
gdk_window_directfb_lower (GdkWindow *window) |
| 1627 |
{ |
| 1628 |
GdkWindowImplDirectFB *impl; |
| 1629 |
|
| 1630 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, window); |
| 1631 |
|
| 1632 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1633 |
|
| 1634 |
if (GDK_WINDOW_DESTROYED (window)) |
| 1635 |
return; |
| 1636 |
|
| 1637 |
impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (window)->impl); |
| 1638 |
|
| 1639 |
if (impl->window) |
| 1640 |
{ |
| 1641 |
DFBResult ret; |
| 1642 |
|
| 1643 |
ret = impl->window->LowerToBottom (impl->window); |
| 1644 |
if (ret) |
| 1645 |
DirectFBError ("gdkwindow-directfb.c: LowerToBottom", ret); |
| 1646 |
else |
| 1647 |
gdk_directfb_window_lower (window); |
| 1648 |
} |
| 1649 |
else |
| 1650 |
{ |
| 1651 |
gdk_directfb_window_lower (window); |
| 1652 |
gdk_window_invalidate_rect (window, NULL, TRUE); |
| 1653 |
} |
| 1654 |
} |
| 1655 |
|
| 1656 |
void |
| 1657 |
gdk_window_set_hints (GdkWindow *window, |
| 1658 |
gint x, |
| 1659 |
gint y, |
| 1660 |
gint min_width, |
| 1661 |
gint min_height, |
| 1662 |
gint max_width, |
| 1663 |
gint max_height, |
| 1664 |
gint flags) |
| 1665 |
{ |
| 1666 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1667 |
|
| 1668 |
if (GDK_WINDOW_DESTROYED (window)) |
| 1669 |
return; |
| 1670 |
|
| 1671 |
D_DEBUG_AT( GDKDFB_Window, "%s( %p, %3d,%3d, min %4dx%4d, max %4dx%4d, flags 0x%08x )\n", G_STRFUNC, |
| 1672 |
window, x,y, min_width, min_height, max_width, max_height, flags ); |
| 1673 |
/* N/A */ |
| 1674 |
} |
| 1675 |
|
| 1676 |
void |
| 1677 |
gdk_window_set_geometry_hints (GdkWindow *window, |
| 1678 |
const GdkGeometry *geometry, |
| 1679 |
GdkWindowHints geom_mask) |
| 1680 |
{ |
| 1681 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1682 |
|
| 1683 |
if (GDK_WINDOW_DESTROYED (window)) |
| 1684 |
return; |
| 1685 |
|
| 1686 |
/* N/A */ |
| 1687 |
} |
| 1688 |
|
| 1689 |
void |
| 1690 |
gdk_window_set_title (GdkWindow *window, |
| 1691 |
const gchar *title) |
| 1692 |
{ |
| 1693 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1694 |
|
| 1695 |
if (GDK_WINDOW_DESTROYED (window)) |
| 1696 |
return; |
| 1697 |
|
| 1698 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p, '%s' )\n", G_STRFUNC, window, title); |
| 1699 |
/* N/A */ |
| 1700 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, window); |
| 1701 |
} |
| 1702 |
|
| 1703 |
void |
| 1704 |
gdk_window_set_role (GdkWindow *window, |
| 1705 |
const gchar *role) |
| 1706 |
{ |
| 1707 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1708 |
|
| 1709 |
if (GDK_WINDOW_DESTROYED (window)) |
| 1710 |
return; |
| 1711 |
|
| 1712 |
/* N/A */ |
| 1713 |
} |
| 1714 |
|
| 1715 |
/** |
| 1716 |
* gdk_window_set_startup_id: |
| 1717 |
* @window: a toplevel #GdkWindow |
| 1718 |
* @startup_id: a string with startup-notification identifier |
| 1719 |
* |
| 1720 |
* When using GTK+, typically you should use gtk_window_set_startup_id() |
| 1721 |
* instead of this low-level function. |
| 1722 |
* |
| 1723 |
* Since: 2.12 |
| 1724 |
* |
| 1725 |
**/ |
| 1726 |
void |
| 1727 |
gdk_window_set_startup_id (GdkWindow *window, |
| 1728 |
const gchar *startup_id) |
| 1729 |
{ |
| 1730 |
} |
| 1731 |
|
| 1732 |
void |
| 1733 |
gdk_window_set_transient_for (GdkWindow *window, |
| 1734 |
GdkWindow *parent) |
| 1735 |
{ |
| 1736 |
GdkWindowObject *private; |
| 1737 |
GdkWindowObject *root; |
| 1738 |
gint i; |
| 1739 |
|
| 1740 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1741 |
g_return_if_fail (GDK_IS_WINDOW (parent)); |
| 1742 |
|
| 1743 |
private = GDK_WINDOW_OBJECT (window); |
| 1744 |
root = GDK_WINDOW_OBJECT (_gdk_parent_root); |
| 1745 |
|
| 1746 |
g_return_if_fail (GDK_WINDOW (private->parent) == _gdk_parent_root); |
| 1747 |
g_return_if_fail (GDK_WINDOW (GDK_WINDOW_OBJECT (parent)->parent) == _gdk_parent_root); |
| 1748 |
|
| 1749 |
root->children = g_list_remove (root->children, window); |
| 1750 |
|
| 1751 |
i = g_list_index (root->children, parent); |
| 1752 |
if (i < 0) |
| 1753 |
root->children = g_list_prepend (root->children, window); |
| 1754 |
else |
| 1755 |
root->children = g_list_insert (root->children, window, i); |
| 1756 |
} |
| 1757 |
|
| 1758 |
static void |
| 1759 |
gdk_directfb_window_set_background (GdkWindow *window, |
| 1760 |
const GdkColor *color) |
| 1761 |
{ |
| 1762 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1763 |
g_return_if_fail (color != NULL); |
| 1764 |
|
| 1765 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p, %d,%d,%d )\n", G_STRFUNC, |
| 1766 |
window, color->red, color->green, color->blue); |
| 1767 |
} |
| 1768 |
|
| 1769 |
static void |
| 1770 |
gdk_directfb_window_set_back_pixmap (GdkWindow *window, |
| 1771 |
GdkPixmap *pixmap) |
| 1772 |
{ |
| 1773 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1774 |
|
| 1775 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p, %p )\n", G_STRFUNC, window, pixmap); |
| 1776 |
} |
| 1777 |
|
| 1778 |
static void |
| 1779 |
gdk_directfb_window_set_cursor (GdkWindow *window, |
| 1780 |
GdkCursor *cursor) |
| 1781 |
{ |
| 1782 |
GdkWindowImplDirectFB *impl; |
| 1783 |
GdkCursor *old_cursor; |
| 1784 |
|
| 1785 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1786 |
|
| 1787 |
impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (window)->impl); |
| 1788 |
old_cursor = impl->cursor; |
| 1789 |
|
| 1790 |
impl->cursor = (cursor ? |
| 1791 |
gdk_cursor_ref (cursor) : gdk_cursor_new (GDK_LEFT_PTR)); |
| 1792 |
|
| 1793 |
if (gdk_window_at_pointer (NULL, NULL) == window) |
| 1794 |
{ |
| 1795 |
/* This is a bit evil but we want to keep all cursor changes in |
| 1796 |
one place, so let gdk_directfb_window_send_crossing_events |
| 1797 |
do the work for us. */ |
| 1798 |
|
| 1799 |
gdk_directfb_window_send_crossing_events (window, window, |
| 1800 |
GDK_CROSSING_NORMAL); |
| 1801 |
} |
| 1802 |
else if (impl->window) |
| 1803 |
{ |
| 1804 |
GdkCursorDirectFB *dfb_cursor = (GdkCursorDirectFB *) impl->cursor; |
| 1805 |
|
| 1806 |
/* this branch takes care of setting the cursor for unmapped windows */ |
| 1807 |
|
| 1808 |
impl->window->SetCursorShape (impl->window, |
| 1809 |
dfb_cursor->shape, |
| 1810 |
dfb_cursor->hot_x, dfb_cursor->hot_y); |
| 1811 |
} |
| 1812 |
|
| 1813 |
if (old_cursor) |
| 1814 |
gdk_cursor_unref (old_cursor); |
| 1815 |
} |
| 1816 |
|
| 1817 |
static void |
| 1818 |
gdk_directfb_window_get_geometry (GdkWindow *window, |
| 1819 |
gint *x, |
| 1820 |
gint *y, |
| 1821 |
gint *width, |
| 1822 |
gint *height, |
| 1823 |
gint *depth) |
| 1824 |
{ |
| 1825 |
GdkWindowObject *private; |
| 1826 |
GdkDrawableImplDirectFB *impl; |
| 1827 |
|
| 1828 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1829 |
|
| 1830 |
private = GDK_WINDOW_OBJECT (window); |
| 1831 |
impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl); |
| 1832 |
|
| 1833 |
if (!GDK_WINDOW_DESTROYED (window)) |
| 1834 |
{ |
| 1835 |
if (x) |
| 1836 |
*x = private->x; |
| 1837 |
|
| 1838 |
if (y) |
| 1839 |
*y = private->y; |
| 1840 |
|
| 1841 |
if (width) |
| 1842 |
*width = impl->width; |
| 1843 |
|
| 1844 |
if (height) |
| 1845 |
*height = impl->height; |
| 1846 |
|
| 1847 |
if (depth) |
| 1848 |
*depth = DFB_BITS_PER_PIXEL (impl->format); |
| 1849 |
} |
| 1850 |
} |
| 1851 |
|
| 1852 |
static gboolean |
| 1853 |
gdk_directfb_window_get_deskrelative_origin (GdkWindow *window, |
| 1854 |
gint *x, |
| 1855 |
gint *y) |
| 1856 |
{ |
| 1857 |
return gdk_window_get_origin (window, x, y); |
| 1858 |
} |
| 1859 |
|
| 1860 |
void |
| 1861 |
gdk_window_get_root_origin (GdkWindow *window, |
| 1862 |
gint *x, |
| 1863 |
gint *y) |
| 1864 |
{ |
| 1865 |
GdkWindowObject *rover; |
| 1866 |
|
| 1867 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 1868 |
|
| 1869 |
rover = (GdkWindowObject*) window; |
| 1870 |
if (x) |
| 1871 |
*x = 0; |
| 1872 |
if (y) |
| 1873 |
*y = 0; |
| 1874 |
|
| 1875 |
if (GDK_WINDOW_DESTROYED (window)) |
| 1876 |
return; |
| 1877 |
|
| 1878 |
while (rover->parent && ((GdkWindowObject*) rover->parent)->parent) |
| 1879 |
rover = (GdkWindowObject *) rover->parent; |
| 1880 |
if (rover->destroyed) |
| 1881 |
return; |
| 1882 |
|
| 1883 |
if (x) |
| 1884 |
*x = rover->x; |
| 1885 |
if (y) |
| 1886 |
*y = rover->y; |
| 1887 |
} |
| 1888 |
|
| 1889 |
GdkWindow * |
| 1890 |
gdk_directfb_window_get_pointer_helper (GdkWindow *window, |
| 1891 |
gint *x, |
| 1892 |
gint *y, |
| 1893 |
GdkModifierType *mask) |
| 1894 |
{ |
| 1895 |
GdkWindow *retval = NULL; |
| 1896 |
gint rx, ry, wx, wy; |
| 1897 |
GdkDrawableImplDirectFB *impl; |
| 1898 |
|
| 1899 |
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL); |
| 1900 |
|
| 1901 |
if (!window) |
| 1902 |
window = _gdk_parent_root; |
| 1903 |
|
| 1904 |
gdk_directfb_mouse_get_info (&rx, &ry, mask); |
| 1905 |
|
| 1906 |
wx = rx; |
| 1907 |
wy = ry; |
| 1908 |
retval = gdk_directfb_child_at (_gdk_parent_root, &wx, &wy); |
| 1909 |
|
| 1910 |
impl = GDK_DRAWABLE_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (window)->impl); |
| 1911 |
|
| 1912 |
if (x) |
| 1913 |
*x = rx - impl->abs_x; |
| 1914 |
if (y) |
| 1915 |
*y = ry - impl->abs_y; |
| 1916 |
|
| 1917 |
return retval; |
| 1918 |
} |
| 1919 |
|
| 1920 |
static gboolean |
| 1921 |
gdk_directfb_window_get_pointer (GdkWindow *window, |
| 1922 |
gint *x, |
| 1923 |
gint *y, |
| 1924 |
GdkModifierType *mask) |
| 1925 |
{ |
| 1926 |
return gdk_directfb_window_get_pointer_helper (window, x, y, mask) != NULL; |
| 1927 |
} |
| 1928 |
|
| 1929 |
GdkWindow * |
| 1930 |
_gdk_windowing_window_at_pointer (GdkDisplay *display, |
| 1931 |
gint *win_x, |
| 1932 |
gint *win_y, |
| 1933 |
GdkModifierType *mask, |
| 1934 |
gboolean get_toplevel) |
| 1935 |
{ |
| 1936 |
GdkWindow *retval; |
| 1937 |
gint wx, wy; |
| 1938 |
|
| 1939 |
gdk_directfb_mouse_get_info (&wx, &wy, NULL); |
| 1940 |
|
| 1941 |
retval = gdk_directfb_child_at (_gdk_parent_root, &wx, &wy); |
| 1942 |
|
| 1943 |
if (win_x) |
| 1944 |
*win_x = wx; |
| 1945 |
|
| 1946 |
if (win_y) |
| 1947 |
*win_y = wy; |
| 1948 |
|
| 1949 |
if (get_toplevel) |
| 1950 |
{ |
| 1951 |
GdkWindowObject *w = (GdkWindowObject *)retval; |
| 1952 |
/* Requested toplevel, find it. */ |
| 1953 |
/* TODO: This can be implemented more efficient by never |
| 1954 |
recursing into children in the first place */ |
| 1955 |
if (w) |
| 1956 |
{ |
| 1957 |
/* Convert to toplevel */ |
| 1958 |
while (w->parent != NULL && |
| 1959 |
w->parent->window_type != GDK_WINDOW_ROOT) |
| 1960 |
{ |
| 1961 |
*win_x += w->x; |
| 1962 |
*win_y += w->y; |
| 1963 |
w = w->parent; |
| 1964 |
} |
| 1965 |
retval = (GdkWindow *)w; |
| 1966 |
} |
| 1967 |
} |
| 1968 |
|
| 1969 |
return retval; |
| 1970 |
} |
| 1971 |
|
| 1972 |
void |
| 1973 |
_gdk_windowing_get_pointer (GdkDisplay *display, |
| 1974 |
GdkScreen **screen, |
| 1975 |
gint *x, |
| 1976 |
gint *y, |
| 1977 |
GdkModifierType *mask) |
| 1978 |
{ |
| 1979 |
if (screen) { |
| 1980 |
*screen = gdk_display_get_default_screen (display); |
| 1981 |
} |
| 1982 |
|
| 1983 |
gdk_directfb_window_get_pointer (_gdk_windowing_window_at_pointer (display, |
| 1984 |
NULL, |
| 1985 |
NULL, |
| 1986 |
NULL, |
| 1987 |
FALSE), |
| 1988 |
x, y, mask); |
| 1989 |
} |
| 1990 |
|
| 1991 |
static GdkEventMask |
| 1992 |
gdk_directfb_window_get_events (GdkWindow *window) |
| 1993 |
{ |
| 1994 |
g_return_val_if_fail (GDK_IS_WINDOW (window), 0); |
| 1995 |
|
| 1996 |
if (GDK_WINDOW_DESTROYED (window)) |
| 1997 |
return 0; |
| 1998 |
else |
| 1999 |
return GDK_WINDOW_OBJECT (window)->event_mask; |
| 2000 |
} |
| 2001 |
|
| 2002 |
static void |
| 2003 |
gdk_directfb_window_set_events (GdkWindow *window, |
| 2004 |
GdkEventMask event_mask) |
| 2005 |
{ |
| 2006 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2007 |
|
| 2008 |
if (event_mask & GDK_BUTTON_MOTION_MASK) |
| 2009 |
event_mask |= (GDK_BUTTON1_MOTION_MASK | |
| 2010 |
GDK_BUTTON2_MOTION_MASK | |
| 2011 |
GDK_BUTTON3_MOTION_MASK); |
| 2012 |
|
| 2013 |
GDK_WINDOW_OBJECT (window)->event_mask = event_mask; |
| 2014 |
} |
| 2015 |
|
| 2016 |
static void |
| 2017 |
gdk_directfb_window_shape_combine_region (GdkWindow *window, |
| 2018 |
const GdkRegion *shape_region, |
| 2019 |
gint offset_x, |
| 2020 |
gint offset_y) |
| 2021 |
{ |
| 2022 |
} |
| 2023 |
|
| 2024 |
void |
| 2025 |
gdk_directfb_window_input_shape_combine_region (GdkWindow *window, |
| 2026 |
const GdkRegion *shape_region, |
| 2027 |
gint offset_x, |
| 2028 |
gint offset_y) |
| 2029 |
{ |
| 2030 |
} |
| 2031 |
|
| 2032 |
static void |
| 2033 |
gdk_directfb_window_queue_translation (GdkWindow *window, |
| 2034 |
GdkGC *gc, |
| 2035 |
GdkRegion *region, |
| 2036 |
gint dx, |
| 2037 |
gint dy) |
| 2038 |
{ |
| 2039 |
GdkWindowObject *private = GDK_WINDOW_OBJECT (window); |
| 2040 |
GdkDrawableImplDirectFB *impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl); |
| 2041 |
|
| 2042 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p, %p, %4d,%4d-%4d,%4d (%ld boxes), %d, %d )\n", |
| 2043 |
G_STRFUNC, window, gc, |
| 2044 |
GDKDFB_RECTANGLE_VALS_FROM_BOX (®ion->extents), |
| 2045 |
region->numRects, dx, dy); |
| 2046 |
|
| 2047 |
gdk_region_offset (region, dx, dy); |
| 2048 |
gdk_region_offset (region, private->abs_x, private->abs_y); |
| 2049 |
|
| 2050 |
if (!impl->buffered) |
| 2051 |
temp_region_init_copy (&impl->paint_region, region); |
| 2052 |
else |
| 2053 |
gdk_region_union (&impl->paint_region, region); |
| 2054 |
impl->buffered = TRUE; |
| 2055 |
|
| 2056 |
gdk_region_offset (region, -dx, -dy); |
| 2057 |
gdk_region_offset (region, -private->abs_x, -private->abs_y); |
| 2058 |
} |
| 2059 |
|
| 2060 |
void |
| 2061 |
gdk_window_set_override_redirect (GdkWindow *window, |
| 2062 |
gboolean override_redirect) |
| 2063 |
{ |
| 2064 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2065 |
|
| 2066 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2067 |
return; |
| 2068 |
|
| 2069 |
/* N/A */ |
| 2070 |
} |
| 2071 |
|
| 2072 |
void |
| 2073 |
gdk_window_set_icon_list (GdkWindow *window, |
| 2074 |
GList *pixbufs) |
| 2075 |
{ |
| 2076 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2077 |
|
| 2078 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2079 |
return; |
| 2080 |
|
| 2081 |
/* N/A */ |
| 2082 |
} |
| 2083 |
|
| 2084 |
void |
| 2085 |
gdk_window_set_icon (GdkWindow *window, |
| 2086 |
GdkWindow *icon_window, |
| 2087 |
GdkPixmap *pixmap, |
| 2088 |
GdkBitmap *mask) |
| 2089 |
{ |
| 2090 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2091 |
|
| 2092 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2093 |
return; |
| 2094 |
|
| 2095 |
/* N/A */ |
| 2096 |
} |
| 2097 |
|
| 2098 |
void |
| 2099 |
gdk_window_set_icon_name (GdkWindow *window, |
| 2100 |
const gchar *name) |
| 2101 |
{ |
| 2102 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2103 |
|
| 2104 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2105 |
return; |
| 2106 |
|
| 2107 |
/* N/A */ |
| 2108 |
} |
| 2109 |
|
| 2110 |
void |
| 2111 |
gdk_window_iconify (GdkWindow *window) |
| 2112 |
{ |
| 2113 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2114 |
|
| 2115 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2116 |
return; |
| 2117 |
|
| 2118 |
gdk_window_hide (window); |
| 2119 |
} |
| 2120 |
|
| 2121 |
void |
| 2122 |
gdk_window_deiconify (GdkWindow *window) |
| 2123 |
{ |
| 2124 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2125 |
|
| 2126 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2127 |
return; |
| 2128 |
|
| 2129 |
gdk_window_show (window); |
| 2130 |
} |
| 2131 |
|
| 2132 |
void |
| 2133 |
gdk_window_stick (GdkWindow *window) |
| 2134 |
{ |
| 2135 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2136 |
|
| 2137 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2138 |
return; |
| 2139 |
|
| 2140 |
/* N/A */ |
| 2141 |
} |
| 2142 |
|
| 2143 |
void |
| 2144 |
gdk_window_unstick (GdkWindow *window) |
| 2145 |
{ |
| 2146 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2147 |
|
| 2148 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2149 |
return; |
| 2150 |
|
| 2151 |
/* N/A */ |
| 2152 |
} |
| 2153 |
|
| 2154 |
void |
| 2155 |
gdk_directfb_window_set_opacity (GdkWindow *window, |
| 2156 |
guchar opacity) |
| 2157 |
{ |
| 2158 |
GdkWindowImplDirectFB *impl; |
| 2159 |
|
| 2160 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2161 |
|
| 2162 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2163 |
return; |
| 2164 |
|
| 2165 |
impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (window)->impl); |
| 2166 |
|
| 2167 |
impl->opacity = opacity; |
| 2168 |
|
| 2169 |
if (impl->window && GDK_WINDOW_IS_MAPPED (window)) |
| 2170 |
{ |
| 2171 |
if (gdk_directfb_apply_focus_opacity && |
| 2172 |
window == gdk_directfb_focused_window) |
| 2173 |
impl->window->SetOpacity (impl->window, |
| 2174 |
(impl->opacity >> 1) + (impl->opacity >> 2)); |
| 2175 |
else |
| 2176 |
impl->window->SetOpacity (impl->window, impl->opacity); |
| 2177 |
} |
| 2178 |
} |
| 2179 |
|
| 2180 |
void |
| 2181 |
gdk_window_focus (GdkWindow *window, |
| 2182 |
guint32 timestamp) |
| 2183 |
{ |
| 2184 |
GdkWindow *toplevel; |
| 2185 |
|
| 2186 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2187 |
|
| 2188 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2189 |
return; |
| 2190 |
|
| 2191 |
toplevel = gdk_directfb_window_find_toplevel (window); |
| 2192 |
if (toplevel != _gdk_parent_root) |
| 2193 |
{ |
| 2194 |
GdkWindowImplDirectFB *impl; |
| 2195 |
|
| 2196 |
impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (toplevel)->impl); |
| 2197 |
|
| 2198 |
impl->window->RequestFocus (impl->window); |
| 2199 |
} |
| 2200 |
} |
| 2201 |
|
| 2202 |
void |
| 2203 |
gdk_window_maximize (GdkWindow *window) |
| 2204 |
{ |
| 2205 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2206 |
|
| 2207 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2208 |
return; |
| 2209 |
|
| 2210 |
/* N/A */ |
| 2211 |
} |
| 2212 |
|
| 2213 |
void |
| 2214 |
gdk_window_unmaximize (GdkWindow *window) |
| 2215 |
{ |
| 2216 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2217 |
|
| 2218 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2219 |
return; |
| 2220 |
|
| 2221 |
/* N/A */ |
| 2222 |
} |
| 2223 |
|
| 2224 |
void |
| 2225 |
gdk_window_set_type_hint (GdkWindow *window, |
| 2226 |
GdkWindowTypeHint hint) |
| 2227 |
{ |
| 2228 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2229 |
|
| 2230 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2231 |
return; |
| 2232 |
|
| 2233 |
GDK_NOTE (MISC, g_print ("gdk_window_set_type_hint: 0x%x: %d\n", |
| 2234 |
GDK_WINDOW_DFB_ID (window), hint)); |
| 2235 |
|
| 2236 |
((GdkWindowImplDirectFB *)((GdkWindowObject *)window)->impl)->type_hint = hint; |
| 2237 |
|
| 2238 |
|
| 2239 |
/* N/A */ |
| 2240 |
} |
| 2241 |
|
| 2242 |
GdkWindowTypeHint |
| 2243 |
gdk_window_get_type_hint (GdkWindow *window) |
| 2244 |
{ |
| 2245 |
g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_WINDOW_TYPE_HINT_NORMAL); |
| 2246 |
|
| 2247 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2248 |
return GDK_WINDOW_TYPE_HINT_NORMAL; |
| 2249 |
|
| 2250 |
return GDK_WINDOW_IMPL_DIRECTFB (((GdkWindowObject *) window)->impl)->type_hint; |
| 2251 |
} |
| 2252 |
|
| 2253 |
void |
| 2254 |
gdk_window_set_modal_hint (GdkWindow *window, |
| 2255 |
gboolean modal) |
| 2256 |
{ |
| 2257 |
GdkWindowImplDirectFB *impl; |
| 2258 |
|
| 2259 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2260 |
|
| 2261 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2262 |
return; |
| 2263 |
|
| 2264 |
impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (window)->impl); |
| 2265 |
|
| 2266 |
if (impl->window) |
| 2267 |
{ |
| 2268 |
impl->window->SetStackingClass (impl->window, |
| 2269 |
modal ? DWSC_UPPER : DWSC_MIDDLE); |
| 2270 |
} |
| 2271 |
} |
| 2272 |
|
| 2273 |
void |
| 2274 |
gdk_window_set_skip_taskbar_hint (GdkWindow *window, |
| 2275 |
gboolean skips_taskbar) |
| 2276 |
{ |
| 2277 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2278 |
} |
| 2279 |
|
| 2280 |
void |
| 2281 |
gdk_window_set_skip_pager_hint (GdkWindow *window, |
| 2282 |
gboolean skips_pager) |
| 2283 |
{ |
| 2284 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2285 |
} |
| 2286 |
|
| 2287 |
|
| 2288 |
void |
| 2289 |
gdk_window_set_group (GdkWindow *window, |
| 2290 |
GdkWindow *leader) |
| 2291 |
{ |
| 2292 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2293 |
g_return_if_fail (GDK_IS_WINDOW (leader)); |
| 2294 |
g_warning (" DirectFb set_group groups not supported \n"); |
| 2295 |
|
| 2296 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2297 |
return; |
| 2298 |
|
| 2299 |
/* N/A */ |
| 2300 |
} |
| 2301 |
|
| 2302 |
GdkWindow * |
| 2303 |
gdk_window_get_group (GdkWindow *window) |
| 2304 |
{ |
| 2305 |
g_warning (" DirectFb get_group groups not supported \n"); |
| 2306 |
return window; |
| 2307 |
} |
| 2308 |
|
| 2309 |
void |
| 2310 |
gdk_fb_window_set_child_handler (GdkWindow *window, |
| 2311 |
GdkWindowChildChanged changed, |
| 2312 |
GdkWindowChildGetPos get_pos, |
| 2313 |
gpointer user_data) |
| 2314 |
{ |
| 2315 |
GdkWindowChildHandlerData *data; |
| 2316 |
|
| 2317 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2318 |
|
| 2319 |
data = g_new (GdkWindowChildHandlerData, 1); |
| 2320 |
data->changed = changed; |
| 2321 |
data->get_pos = get_pos; |
| 2322 |
data->user_data = user_data; |
| 2323 |
|
| 2324 |
g_object_set_data_full (G_OBJECT (window), "gdk-window-child-handler", |
| 2325 |
data, (GDestroyNotify) g_free); |
| 2326 |
} |
| 2327 |
|
| 2328 |
void |
| 2329 |
gdk_window_set_decorations (GdkWindow *window, |
| 2330 |
GdkWMDecoration decorations) |
| 2331 |
{ |
| 2332 |
GdkWMDecoration *dec; |
| 2333 |
|
| 2334 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2335 |
|
| 2336 |
dec = g_new (GdkWMDecoration, 1); |
| 2337 |
*dec = decorations; |
| 2338 |
|
| 2339 |
g_object_set_data_full (G_OBJECT (window), "gdk-window-decorations", |
| 2340 |
dec, (GDestroyNotify) g_free); |
| 2341 |
} |
| 2342 |
|
| 2343 |
gboolean |
| 2344 |
gdk_window_get_decorations (GdkWindow *window, |
| 2345 |
GdkWMDecoration *decorations) |
| 2346 |
{ |
| 2347 |
GdkWMDecoration *dec; |
| 2348 |
|
| 2349 |
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE); |
| 2350 |
|
| 2351 |
dec = g_object_get_data (G_OBJECT (window), "gdk-window-decorations"); |
| 2352 |
if (dec) |
| 2353 |
{ |
| 2354 |
*decorations = *dec; |
| 2355 |
return TRUE; |
| 2356 |
} |
| 2357 |
return FALSE; |
| 2358 |
} |
| 2359 |
|
| 2360 |
void |
| 2361 |
gdk_window_set_functions (GdkWindow *window, |
| 2362 |
GdkWMFunction functions) |
| 2363 |
{ |
| 2364 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2365 |
|
| 2366 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2367 |
return; |
| 2368 |
|
| 2369 |
/* N/A */ |
| 2370 |
g_message ("unimplemented %s", G_STRFUNC); |
| 2371 |
} |
| 2372 |
|
| 2373 |
static gboolean |
| 2374 |
gdk_directfb_window_set_static_gravities (GdkWindow *window, |
| 2375 |
gboolean use_static) |
| 2376 |
{ |
| 2377 |
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE); |
| 2378 |
|
| 2379 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2380 |
return FALSE; |
| 2381 |
|
| 2382 |
/* N/A */ |
| 2383 |
g_message ("unimplemented %s", G_STRFUNC); |
| 2384 |
|
| 2385 |
return FALSE; |
| 2386 |
} |
| 2387 |
|
| 2388 |
void |
| 2389 |
gdk_window_begin_resize_drag (GdkWindow *window, |
| 2390 |
GdkWindowEdge edge, |
| 2391 |
gint button, |
| 2392 |
gint root_x, |
| 2393 |
gint root_y, |
| 2394 |
guint32 timestamp) |
| 2395 |
{ |
| 2396 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2397 |
|
| 2398 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2399 |
return; |
| 2400 |
|
| 2401 |
g_message ("unimplemented %s", G_STRFUNC); |
| 2402 |
} |
| 2403 |
|
| 2404 |
void |
| 2405 |
gdk_window_begin_move_drag (GdkWindow *window, |
| 2406 |
gint button, |
| 2407 |
gint root_x, |
| 2408 |
gint root_y, |
| 2409 |
guint32 timestamp) |
| 2410 |
{ |
| 2411 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2412 |
|
| 2413 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2414 |
return; |
| 2415 |
|
| 2416 |
g_message ("unimplemented %s", G_STRFUNC); |
| 2417 |
} |
| 2418 |
|
| 2419 |
/** |
| 2420 |
* gdk_window_get_frame_extents: |
| 2421 |
* @window: a #GdkWindow |
| 2422 |
* @rect: rectangle to fill with bounding box of the window frame |
| 2423 |
* |
| 2424 |
* Obtains the bounding box of the window, including window manager |
| 2425 |
* titlebar/borders if any. The frame position is given in root window |
| 2426 |
* coordinates. To get the position of the window itself (rather than |
| 2427 |
* the frame) in root window coordinates, use gdk_window_get_origin(). |
| 2428 |
* |
| 2429 |
**/ |
| 2430 |
void |
| 2431 |
gdk_window_get_frame_extents (GdkWindow *window, |
| 2432 |
GdkRectangle *rect) |
| 2433 |
{ |
| 2434 |
GdkWindowObject *private; |
| 2435 |
GdkDrawableImplDirectFB *impl; |
| 2436 |
|
| 2437 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2438 |
g_return_if_fail (rect != NULL); |
| 2439 |
|
| 2440 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2441 |
return; |
| 2442 |
|
| 2443 |
private = GDK_WINDOW_OBJECT (window); |
| 2444 |
|
| 2445 |
while (private->parent && ((GdkWindowObject*) private->parent)->parent) |
| 2446 |
private = (GdkWindowObject*) private->parent; |
| 2447 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2448 |
return; |
| 2449 |
|
| 2450 |
impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl); |
| 2451 |
|
| 2452 |
rect->x = impl->abs_x; |
| 2453 |
rect->y = impl->abs_y; |
| 2454 |
rect->width = impl->width; |
| 2455 |
rect->height = impl->height; |
| 2456 |
} |
| 2457 |
|
| 2458 |
/* |
| 2459 |
* Given a directfb window and a subsurface of that window |
| 2460 |
* create a gdkwindow child wrapper |
| 2461 |
*/ |
| 2462 |
GdkWindow * |
| 2463 |
gdk_directfb_create_child_window (GdkWindow *parent, |
| 2464 |
IDirectFBSurface *subsurface) |
| 2465 |
{ |
| 2466 |
GdkWindow *window; |
| 2467 |
GdkWindowObject *private; |
| 2468 |
GdkWindowObject *parent_private; |
| 2469 |
GdkWindowImplDirectFB *impl; |
| 2470 |
GdkWindowImplDirectFB *parent_impl; |
| 2471 |
gint x, y, w, h; |
| 2472 |
|
| 2473 |
g_return_val_if_fail (parent != NULL, NULL); |
| 2474 |
|
| 2475 |
window = g_object_new (GDK_TYPE_WINDOW, NULL); |
| 2476 |
private = GDK_WINDOW_OBJECT (window); |
| 2477 |
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL); |
| 2478 |
parent_private = GDK_WINDOW_OBJECT (parent); |
| 2479 |
parent_impl = GDK_WINDOW_IMPL_DIRECTFB (parent_private->impl); |
| 2480 |
private->parent = parent_private; |
| 2481 |
|
| 2482 |
subsurface->GetPosition (subsurface, &x, &y); |
| 2483 |
subsurface->GetSize (subsurface, &w, &h); |
| 2484 |
|
| 2485 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 2486 |
impl->drawable.wrapper = GDK_DRAWABLE (window); |
| 2487 |
|
| 2488 |
private->x = x; |
| 2489 |
private->y = y; |
| 2490 |
|
| 2491 |
private->abs_x = 0; |
| 2492 |
private->abs_y = 0; |
| 2493 |
|
| 2494 |
impl->drawable.width = w; |
| 2495 |
impl->drawable.height = h; |
| 2496 |
private->window_type = GDK_WINDOW_CHILD; |
| 2497 |
impl->drawable.surface = subsurface; |
| 2498 |
impl->drawable.format = parent_impl->drawable.format; |
| 2499 |
private->depth = parent_private->depth; |
| 2500 |
gdk_drawable_set_colormap (GDK_DRAWABLE (window), |
| 2501 |
gdk_drawable_get_colormap (parent)); |
| 2502 |
gdk_window_set_cursor (window, NULL); |
| 2503 |
parent_private->children = g_list_prepend (parent_private->children,window); |
| 2504 |
/*we hold a reference count on ourselves */ |
| 2505 |
g_object_ref (window); |
| 2506 |
|
| 2507 |
return window; |
| 2508 |
|
| 2509 |
} |
| 2510 |
|
| 2511 |
/* |
| 2512 |
* The wrapping is not perfect since directfb does not give full access |
| 2513 |
* to the current state of a window event mask etc need to fix dfb |
| 2514 |
*/ |
| 2515 |
GdkWindow * |
| 2516 |
gdk_window_foreign_new_for_display (GdkDisplay* display, GdkNativeWindow anid) |
| 2517 |
{ |
| 2518 |
GdkWindow *window = NULL; |
| 2519 |
GdkWindow *parent = NULL; |
| 2520 |
GdkWindowObject *private = NULL; |
| 2521 |
GdkWindowObject *parent_private = NULL; |
| 2522 |
GdkWindowImplDirectFB *parent_impl = NULL; |
| 2523 |
GdkWindowImplDirectFB *impl = NULL; |
| 2524 |
DFBWindowOptions options; |
| 2525 |
DFBResult ret; |
| 2526 |
GdkDisplayDFB * gdkdisplay = _gdk_display; |
| 2527 |
IDirectFBWindow *dfbwindow; |
| 2528 |
|
| 2529 |
window = gdk_window_lookup (anid); |
| 2530 |
|
| 2531 |
if (window) { |
| 2532 |
g_object_ref (window); |
| 2533 |
return window; |
| 2534 |
} |
| 2535 |
if (display != NULL) |
| 2536 |
gdkdisplay = GDK_DISPLAY_DFB (display); |
| 2537 |
|
| 2538 |
ret = gdkdisplay->layer->GetWindow (gdkdisplay->layer, |
| 2539 |
(DFBWindowID)anid, |
| 2540 |
&dfbwindow); |
| 2541 |
|
| 2542 |
if (ret != DFB_OK) { |
| 2543 |
DirectFBError ("gdk_window_new: Layer->GetWindow failed", ret); |
| 2544 |
return NULL; |
| 2545 |
} |
| 2546 |
|
| 2547 |
parent = _gdk_parent_root; |
| 2548 |
|
| 2549 |
if (parent) { |
| 2550 |
parent_private = GDK_WINDOW_OBJECT (parent); |
| 2551 |
parent_impl = GDK_WINDOW_IMPL_DIRECTFB (parent_private->impl); |
| 2552 |
} |
| 2553 |
|
| 2554 |
window = g_object_new (GDK_TYPE_WINDOW, NULL); |
| 2555 |
/* we hold a reference count on ourselves */ |
| 2556 |
g_object_ref (window); |
| 2557 |
private = GDK_WINDOW_OBJECT (window); |
| 2558 |
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL); |
| 2559 |
private->parent = parent_private; |
| 2560 |
private->window_type = GDK_WINDOW_TOPLEVEL; |
| 2561 |
private->viewable = TRUE; |
| 2562 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 2563 |
|
| 2564 |
impl->drawable.wrapper = GDK_DRAWABLE (window); |
| 2565 |
impl->window = dfbwindow; |
| 2566 |
dfbwindow->GetOptions (dfbwindow, &options); |
| 2567 |
dfbwindow->GetPosition (dfbwindow, &private->x, &private->y); |
| 2568 |
dfbwindow->GetSize (dfbwindow, &impl->drawable.width, &impl->drawable.height); |
| 2569 |
|
| 2570 |
|
| 2571 |
private->input_only = FALSE; |
| 2572 |
|
| 2573 |
if (dfbwindow->GetSurface (dfbwindow, |
| 2574 |
&impl->drawable.surface) == DFB_UNSUPPORTED) { |
| 2575 |
private->input_only = TRUE; |
| 2576 |
impl->drawable.surface = NULL; |
| 2577 |
} |
| 2578 |
|
| 2579 |
/* We default to all events least surprise to the user |
| 2580 |
* minus the poll for motion events |
| 2581 |
*/ |
| 2582 |
gdk_window_set_events (window, (GDK_ALL_EVENTS_MASK ^ GDK_POINTER_MOTION_HINT_MASK)); |
| 2583 |
|
| 2584 |
if (impl->drawable.surface) |
| 2585 |
{ |
| 2586 |
impl->drawable.surface->GetPixelFormat (impl->drawable.surface, |
| 2587 |
&impl->drawable.format); |
| 2588 |
|
| 2589 |
private->depth = DFB_BITS_PER_PIXEL(impl->drawable.format); |
| 2590 |
if (parent) |
| 2591 |
gdk_drawable_set_colormap (GDK_DRAWABLE (window), gdk_drawable_get_colormap (parent)); |
| 2592 |
else |
| 2593 |
gdk_drawable_set_colormap (GDK_DRAWABLE (window), gdk_colormap_get_system ()); |
| 2594 |
} |
| 2595 |
|
| 2596 |
//can be null for the soft cursor window itself when |
| 2597 |
//running a gtk directfb wm |
| 2598 |
if (gdk_display_get_default () != NULL) { |
| 2599 |
gdk_window_set_cursor (window, NULL); |
| 2600 |
} |
| 2601 |
|
| 2602 |
if (parent_private) |
| 2603 |
parent_private->children = g_list_prepend (parent_private->children, |
| 2604 |
window); |
| 2605 |
impl->dfb_id = (DFBWindowID)anid; |
| 2606 |
gdk_directfb_window_id_table_insert (impl->dfb_id, window); |
| 2607 |
gdk_directfb_event_windows_add (window); |
| 2608 |
|
| 2609 |
return window; |
| 2610 |
} |
| 2611 |
|
| 2612 |
GdkWindow * |
| 2613 |
gdk_window_lookup_for_display (GdkDisplay *display,GdkNativeWindow anid) |
| 2614 |
{ |
| 2615 |
return gdk_directfb_window_id_table_lookup ((DFBWindowID) anid); |
| 2616 |
} |
| 2617 |
|
| 2618 |
GdkWindow * |
| 2619 |
gdk_window_lookup (GdkNativeWindow anid) |
| 2620 |
{ |
| 2621 |
return gdk_directfb_window_id_table_lookup ((DFBWindowID) anid); |
| 2622 |
} |
| 2623 |
|
| 2624 |
IDirectFBWindow * |
| 2625 |
gdk_directfb_window_lookup (GdkWindow *window) |
| 2626 |
{ |
| 2627 |
GdkWindowObject *private; |
| 2628 |
GdkWindowImplDirectFB *impl; |
| 2629 |
|
| 2630 |
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); |
| 2631 |
|
| 2632 |
private = GDK_WINDOW_OBJECT (window); |
| 2633 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 2634 |
|
| 2635 |
return impl->window; |
| 2636 |
} |
| 2637 |
|
| 2638 |
IDirectFBSurface * |
| 2639 |
gdk_directfb_surface_lookup (GdkWindow *window) |
| 2640 |
{ |
| 2641 |
GdkWindowObject *private; |
| 2642 |
GdkWindowImplDirectFB *impl; |
| 2643 |
|
| 2644 |
g_return_val_if_fail (GDK_IS_WINDOW (window),NULL); |
| 2645 |
|
| 2646 |
private = GDK_WINDOW_OBJECT (window); |
| 2647 |
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl); |
| 2648 |
|
| 2649 |
return impl->drawable.surface; |
| 2650 |
} |
| 2651 |
|
| 2652 |
void |
| 2653 |
gdk_window_fullscreen (GdkWindow *window) |
| 2654 |
{ |
| 2655 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2656 |
g_warning ("gdk_window_fullscreen() not implemented.\n"); |
| 2657 |
} |
| 2658 |
|
| 2659 |
void |
| 2660 |
gdk_window_unfullscreen (GdkWindow *window) |
| 2661 |
{ |
| 2662 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2663 |
/* g_warning ("gdk_window_unfullscreen() not implemented.\n");*/ |
| 2664 |
} |
| 2665 |
|
| 2666 |
void |
| 2667 |
gdk_window_set_keep_above (GdkWindow *window, gboolean setting) |
| 2668 |
{ |
| 2669 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2670 |
static gboolean first_call = TRUE; |
| 2671 |
if (first_call) { |
| 2672 |
g_warning ("gdk_window_set_keep_above() not implemented.\n"); |
| 2673 |
first_call=FALSE; |
| 2674 |
} |
| 2675 |
|
| 2676 |
} |
| 2677 |
|
| 2678 |
void |
| 2679 |
gdk_window_set_keep_below (GdkWindow *window, gboolean setting) |
| 2680 |
{ |
| 2681 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2682 |
static gboolean first_call = TRUE; |
| 2683 |
if (first_call) { |
| 2684 |
g_warning ("gdk_window_set_keep_below() not implemented.\n"); |
| 2685 |
first_call=FALSE; |
| 2686 |
} |
| 2687 |
|
| 2688 |
} |
| 2689 |
|
| 2690 |
void |
| 2691 |
gdk_window_enable_synchronized_configure (GdkWindow *window) |
| 2692 |
{ |
| 2693 |
} |
| 2694 |
|
| 2695 |
void |
| 2696 |
gdk_window_configure_finished (GdkWindow *window) |
| 2697 |
{ |
| 2698 |
} |
| 2699 |
|
| 2700 |
void |
| 2701 |
gdk_display_warp_pointer (GdkDisplay *display, |
| 2702 |
GdkScreen *screen, |
| 2703 |
gint x, |
| 2704 |
gint y) |
| 2705 |
{ |
| 2706 |
g_warning ("gdk_display_warp_pointer() not implemented.\n"); |
| 2707 |
} |
| 2708 |
|
| 2709 |
void |
| 2710 |
gdk_window_set_urgency_hint (GdkWindow *window, |
| 2711 |
gboolean urgent) |
| 2712 |
{ |
| 2713 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2714 |
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD); |
| 2715 |
|
| 2716 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2717 |
return; |
| 2718 |
|
| 2719 |
g_warning ("gdk_window_set_urgency_hint() not implemented.\n"); |
| 2720 |
|
| 2721 |
} |
| 2722 |
|
| 2723 |
static void |
| 2724 |
gdk_window_impl_directfb_begin_paint_region (GdkPaintable *paintable, |
| 2725 |
GdkWindow *window, |
| 2726 |
const GdkRegion *region) |
| 2727 |
{ |
| 2728 |
GdkWindowObject *private = GDK_WINDOW_OBJECT (window); |
| 2729 |
/* GdkWindowImplDirectFB *wimpl = GDK_WINDOW_IMPL_DIRECTFB (paintable); */ |
| 2730 |
GdkDrawableImplDirectFB *impl = GDK_DRAWABLE_IMPL_DIRECTFB (paintable); |
| 2731 |
GdkRegion *native_region; |
| 2732 |
gint i; |
| 2733 |
|
| 2734 |
g_assert (region != NULL); |
| 2735 |
|
| 2736 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p, %p, %4d,%4d-%4d,%4d (%ld boxes) )\n", |
| 2737 |
G_STRFUNC, paintable, window, |
| 2738 |
GDKDFB_RECTANGLE_VALS_FROM_BOX (®ion->extents), |
| 2739 |
region->numRects); |
| 2740 |
D_DEBUG_AT (GDKDFB_Window, " -> window @ pos=%ix%i abs_pos=%ix%i\n", |
| 2741 |
private->x, private->y, private->abs_x, private->abs_y); |
| 2742 |
|
| 2743 |
native_region = gdk_region_copy (region); |
| 2744 |
gdk_region_offset (native_region, private->abs_x, private->abs_y); |
| 2745 |
|
| 2746 |
/* /\* When it's buffered... *\/ */ |
| 2747 |
if (impl->buffered) |
| 2748 |
{ |
| 2749 |
/* ...we're already painting on it! */ |
| 2750 |
D_DEBUG_AT (GDKDFB_Window, " -> painted %4d,%4d-%4dx%4d (%ld boxes)\n", |
| 2751 |
DFB_RECTANGLE_VALS_FROM_REGION (&impl->paint_region.extents), |
| 2752 |
impl->paint_region.numRects); |
| 2753 |
|
| 2754 |
if (impl->paint_depth < 1) |
| 2755 |
gdk_directfb_clip_region (GDK_DRAWABLE (paintable), |
| 2756 |
NULL, NULL, &impl->clip_region); |
| 2757 |
|
| 2758 |
gdk_region_union (&impl->paint_region, native_region); |
| 2759 |
} |
| 2760 |
else |
| 2761 |
{ |
| 2762 |
/* ...otherwise it's the first time! */ |
| 2763 |
g_assert (impl->paint_depth == 0); |
| 2764 |
|
| 2765 |
/* Generate the clip region for painting around child windows. */ |
| 2766 |
gdk_directfb_clip_region (GDK_DRAWABLE (paintable), |
| 2767 |
NULL, NULL, &impl->clip_region); |
| 2768 |
|
| 2769 |
/* Initialize the paint region with the new one... */ |
| 2770 |
temp_region_init_copy (&impl->paint_region, native_region); |
| 2771 |
|
| 2772 |
impl->buffered = TRUE; |
| 2773 |
} |
| 2774 |
|
| 2775 |
D_DEBUG_AT (GDKDFB_Window, " -> painting %4d,%4d-%4dx%4d (%ld boxes)\n", |
| 2776 |
DFB_RECTANGLE_VALS_FROM_REGION (&impl->paint_region.extents), |
| 2777 |
impl->paint_region.numRects); |
| 2778 |
|
| 2779 |
/* ...but clip the initial/compound result against the clip region. */ |
| 2780 |
/* gdk_region_intersect (&impl->paint_region, &impl->clip_region); */ |
| 2781 |
|
| 2782 |
D_DEBUG_AT (GDKDFB_Window, " -> clipped %4d,%4d-%4dx%4d (%ld boxes)\n", |
| 2783 |
DFB_RECTANGLE_VALS_FROM_REGION (&impl->paint_region.extents), |
| 2784 |
impl->paint_region.numRects); |
| 2785 |
|
| 2786 |
impl->paint_depth++; |
| 2787 |
|
| 2788 |
D_DEBUG_AT (GDKDFB_Window, " -> depth is now %d\n", impl->paint_depth); |
| 2789 |
|
| 2790 |
/* |
| 2791 |
* Redraw background on area which are going to be repainted. |
| 2792 |
* |
| 2793 |
* TODO: handle pixmap background |
| 2794 |
*/ |
| 2795 |
impl->surface->SetClip (impl->surface, NULL); |
| 2796 |
for (i = 0 ; i < native_region->numRects ; i++) |
| 2797 |
{ |
| 2798 |
GdkRegionBox *box = &native_region->rects[i]; |
| 2799 |
|
| 2800 |
D_DEBUG_AT (GDKDFB_Window, " -> clearing [%2d] %4d,%4d-%4dx%4d\n", |
| 2801 |
i, GDKDFB_RECTANGLE_VALS_FROM_BOX (box)); |
| 2802 |
|
| 2803 |
/* gdk_window_clear_area (window, */ |
| 2804 |
/* box->x1, */ |
| 2805 |
/* box->y1, */ |
| 2806 |
/* box->x2 - box->x1, */ |
| 2807 |
/* box->y2 - box->y1); */ |
| 2808 |
|
| 2809 |
impl->surface->SetColor (impl->surface, |
| 2810 |
private->bg_color.red, |
| 2811 |
private->bg_color.green, |
| 2812 |
private->bg_color.blue, |
| 2813 |
0xff); |
| 2814 |
impl->surface->FillRectangle (impl->surface, |
| 2815 |
box->x1, |
| 2816 |
box->y1, |
| 2817 |
box->x2 - box->x1, |
| 2818 |
box->y2 - box->y1); |
| 2819 |
} |
| 2820 |
|
| 2821 |
gdk_region_destroy (native_region); |
| 2822 |
} |
| 2823 |
|
| 2824 |
static void |
| 2825 |
gdk_window_impl_directfb_end_paint (GdkPaintable *paintable) |
| 2826 |
{ |
| 2827 |
GdkDrawableImplDirectFB *impl; |
| 2828 |
|
| 2829 |
impl = GDK_DRAWABLE_IMPL_DIRECTFB (paintable); |
| 2830 |
|
| 2831 |
D_DEBUG_AT (GDKDFB_Window, "%s( %p )\n", G_STRFUNC, paintable); |
| 2832 |
|
| 2833 |
g_return_if_fail (impl->paint_depth > 0); |
| 2834 |
|
| 2835 |
g_assert (impl->buffered); |
| 2836 |
|
| 2837 |
impl->paint_depth--; |
| 2838 |
|
| 2839 |
#ifdef GDK_DIRECTFB_NO_EXPERIMENTS |
| 2840 |
if (impl->paint_depth == 0) |
| 2841 |
{ |
| 2842 |
impl->buffered = FALSE; |
| 2843 |
|
| 2844 |
if (impl->paint_region.numRects) |
| 2845 |
{ |
| 2846 |
DFBRegion reg = { impl->paint_region.extents.x1, |
| 2847 |
impl->paint_region.extents.y1, |
| 2848 |
impl->paint_region.extents.x2 - 1, |
| 2849 |
impl->paint_region.extents.y2 - 1 }; |
| 2850 |
|
| 2851 |
D_DEBUG_AT (GDKDFB_Window, " -> flip %4d,%4d-%4dx%4d (%ld boxes)\n", |
| 2852 |
DFB_RECTANGLE_VALS_FROM_REGION (®), |
| 2853 |
impl->paint_region.numRects); |
| 2854 |
|
| 2855 |
impl->surface->Flip (impl->surface, ®, 0); |
| 2856 |
|
| 2857 |
temp_region_reset (&impl->paint_region); |
| 2858 |
} |
| 2859 |
} |
| 2860 |
#else |
| 2861 |
if (impl->paint_depth == 0) |
| 2862 |
{ |
| 2863 |
impl->buffered = FALSE; |
| 2864 |
|
| 2865 |
temp_region_deinit (&impl->clip_region); |
| 2866 |
|
| 2867 |
if (impl->paint_region.numRects) |
| 2868 |
{ |
| 2869 |
GdkWindow *window = GDK_WINDOW (impl->wrapper); |
| 2870 |
|
| 2871 |
if (GDK_IS_WINDOW (window)) |
| 2872 |
{ |
| 2873 |
GdkWindowObject *top = GDK_WINDOW_OBJECT (gdk_window_get_toplevel (window)); |
| 2874 |
|
| 2875 |
if (top) |
| 2876 |
{ |
| 2877 |
DFBRegion reg; |
| 2878 |
GdkWindowImplDirectFB *wimpl = GDK_WINDOW_IMPL_DIRECTFB (top->impl); |
| 2879 |
|
| 2880 |
reg.x1 = impl->abs_x - top->x + impl->paint_region.extents.x1; |
| 2881 |
reg.y1 = impl->abs_y - top->y + impl->paint_region.extents.y1; |
| 2882 |
reg.x2 = impl->abs_x - top->x + impl->paint_region.extents.x2 - 1; |
| 2883 |
reg.y2 = impl->abs_y - top->y + impl->paint_region.extents.y2 - 1; |
| 2884 |
|
| 2885 |
D_DEBUG_AT (GDKDFB_Window, " -> queue flip %4d,%4d-%4dx%4d (%ld boxes)\n", |
| 2886 |
DFB_RECTANGLE_VALS_FROM_REGION (®), |
| 2887 |
impl->paint_region.numRects); |
| 2888 |
|
| 2889 |
dfb_updates_add (&wimpl->flips, ®); |
| 2890 |
} |
| 2891 |
} |
| 2892 |
|
| 2893 |
temp_region_reset (&impl->paint_region); |
| 2894 |
} |
| 2895 |
} |
| 2896 |
#endif |
| 2897 |
else |
| 2898 |
D_DEBUG_AT (GDKDFB_Window, " -> depth is still %d\n", impl->paint_depth); |
| 2899 |
} |
| 2900 |
|
| 2901 |
GdkRegion * |
| 2902 |
_gdk_windowing_get_shape_for_mask (GdkBitmap *mask) |
| 2903 |
{ |
| 2904 |
return NULL; |
| 2905 |
} |
| 2906 |
|
| 2907 |
GdkRegion * |
| 2908 |
_gdk_windowing_window_get_shape (GdkWindow *window) |
| 2909 |
{ |
| 2910 |
return NULL; |
| 2911 |
} |
| 2912 |
|
| 2913 |
gulong |
| 2914 |
_gdk_windowing_window_get_next_serial (GdkDisplay *display) |
| 2915 |
{ |
| 2916 |
return 0; |
| 2917 |
} |
| 2918 |
|
| 2919 |
GdkRegion * |
| 2920 |
_gdk_windowing_window_get_input_shape (GdkWindow *window) |
| 2921 |
{ |
| 2922 |
return NULL; |
| 2923 |
} |
| 2924 |
|
| 2925 |
void |
| 2926 |
_gdk_windowing_before_process_all_updates (void) |
| 2927 |
{ |
| 2928 |
} |
| 2929 |
|
| 2930 |
void |
| 2931 |
_gdk_windowing_after_process_all_updates (void) |
| 2932 |
{ |
| 2933 |
} |
| 2934 |
|
| 2935 |
void |
| 2936 |
_gdk_windowing_window_process_updates_recurse (GdkWindow *window, |
| 2937 |
GdkRegion *region) |
| 2938 |
{ |
| 2939 |
_gdk_window_process_updates_recurse (window, region); |
| 2940 |
} |
| 2941 |
|
| 2942 |
static void |
| 2943 |
gdk_window_impl_directfb_paintable_init (GdkPaintableIface *iface) |
| 2944 |
{ |
| 2945 |
iface->begin_paint_region = gdk_window_impl_directfb_begin_paint_region; |
| 2946 |
iface->end_paint = gdk_window_impl_directfb_end_paint; |
| 2947 |
} |
| 2948 |
|
| 2949 |
void |
| 2950 |
_gdk_windowing_window_beep (GdkWindow *window) |
| 2951 |
{ |
| 2952 |
gdk_display_beep (gdk_display_get_default()); |
| 2953 |
} |
| 2954 |
|
| 2955 |
void |
| 2956 |
gdk_window_set_opacity (GdkWindow *window, |
| 2957 |
gdouble opacity) |
| 2958 |
{ |
| 2959 |
GdkDisplay *display; |
| 2960 |
guint8 cardinal; |
| 2961 |
|
| 2962 |
g_return_if_fail (GDK_IS_WINDOW (window)); |
| 2963 |
|
| 2964 |
if (GDK_WINDOW_DESTROYED (window)) |
| 2965 |
return; |
| 2966 |
|
| 2967 |
display = gdk_drawable_get_display (window); |
| 2968 |
|
| 2969 |
if (opacity < 0) |
| 2970 |
opacity = 0; |
| 2971 |
else if (opacity > 1) |
| 2972 |
opacity = 1; |
| 2973 |
cardinal = opacity * 0xff; |
| 2974 |
gdk_directfb_window_set_opacity (window, cardinal); |
| 2975 |
} |
| 2976 |
|
| 2977 |
void |
| 2978 |
_gdk_windowing_window_set_composited (GdkWindow *window, |
| 2979 |
gboolean composited) |
| 2980 |
{ |
| 2981 |
} |
| 2982 |
|
| 2983 |
static gint |
| 2984 |
gdk_directfb_window_get_root_coords (GdkWindow *window, |
| 2985 |
gint x, |
| 2986 |
gint y, |
| 2987 |
gint *root_x, |
| 2988 |
gint *root_y) |
| 2989 |
{ |
| 2990 |
/* TODO */ |
| 2991 |
return 1; |
| 2992 |
} |
| 2993 |
|
| 2994 |
static gboolean |
| 2995 |
gdk_directfb_window_queue_antiexpose (GdkWindow *window, |
| 2996 |
GdkRegion *area) |
| 2997 |
{ |
| 2998 |
return FALSE; |
| 2999 |
} |
| 3000 |
|
| 3001 |
static void |
| 3002 |
gdk_window_impl_iface_init (GdkWindowImplIface *iface) |
| 3003 |
{ |
| 3004 |
iface->show = gdk_directfb_window_show; |
| 3005 |
iface->hide = gdk_directfb_window_hide; |
| 3006 |
iface->withdraw = gdk_directfb_window_withdraw; |
| 3007 |
iface->set_events = gdk_directfb_window_set_events; |
| 3008 |
iface->get_events = gdk_directfb_window_get_events; |
| 3009 |
iface->raise = gdk_window_directfb_raise; |
| 3010 |
iface->lower = gdk_window_directfb_lower; |
| 3011 |
iface->move_resize = gdk_directfb_window_move_resize; |
| 3012 |
iface->set_background = gdk_directfb_window_set_background; |
| 3013 |
iface->set_back_pixmap = gdk_directfb_window_set_back_pixmap; |
| 3014 |
iface->reparent = gdk_directfb_window_reparent; |
| 3015 |
iface->set_cursor = gdk_directfb_window_set_cursor; |
| 3016 |
iface->get_geometry = gdk_directfb_window_get_geometry; |
| 3017 |
iface->get_root_coords = gdk_directfb_window_get_root_coords; |
| 3018 |
iface->get_pointer = gdk_directfb_window_get_pointer; |
| 3019 |
iface->get_deskrelative_origin = gdk_directfb_window_get_deskrelative_origin; |
| 3020 |
iface->shape_combine_region = gdk_directfb_window_shape_combine_region; |
| 3021 |
iface->input_shape_combine_region = gdk_directfb_window_input_shape_combine_region; |
| 3022 |
iface->set_static_gravities = gdk_directfb_window_set_static_gravities; |
| 3023 |
iface->queue_antiexpose = gdk_directfb_window_queue_antiexpose; |
| 3024 |
iface->queue_translation = gdk_directfb_window_queue_translation; |
| 3025 |
iface->destroy = gdk_directfb_window_destroy; |
| 3026 |
} |
| 3027 |
|
| 3028 |
#define __GDK_WINDOW_X11_C__ |
| 3029 |
#include "gdkaliasdef.c" |
| 3030 |
|