From 7fe60435bce6595a9c58a9bfd8244d74b5320e96 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 15 Jan 2013 08:46:13 +0100 Subject: Import DirectFB141_2k11R3_beta5 --- Source/DirectFB/wm/unique/decoration.c | 190 +++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100755 Source/DirectFB/wm/unique/decoration.c (limited to 'Source/DirectFB/wm/unique/decoration.c') diff --git a/Source/DirectFB/wm/unique/decoration.c b/Source/DirectFB/wm/unique/decoration.c new file mode 100755 index 0000000..5b98dcd --- /dev/null +++ b/Source/DirectFB/wm/unique/decoration.c @@ -0,0 +1,190 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include + +#include + +#include +#include /* FIXME */ +#include /* FIXME */ + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Decoration, "UniQuE/Decoration", "UniQuE's Decoration Object" ); + + +static const ReactionFunc unique_decoration_globals[] = { +/* _unique_foo_decoration_listener,*/ + NULL +}; + +/**************************************************************************************************/ + +static void +decoration_destructor( FusionObject *object, bool zombie, void *ctx ) +{ + UniqueDecoration *decoration = (UniqueDecoration*) object; + + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + D_DEBUG_AT( UniQuE_Decoration, "destroying %p%s\n", decoration, zombie ? " (ZOMBIE)" : ""); + + unique_window_unlink( &decoration->window ); + unique_context_unlink( &decoration->context ); + + D_MAGIC_CLEAR( decoration ); + + fusion_object_destroy( object ); +} + +FusionObjectPool * +unique_decoration_pool_create( const FusionWorld *world ) +{ + return fusion_object_pool_create( "UniQuE Decoration Pool", + sizeof(UniqueDecoration), + sizeof(UniqueDecorationNotification), + decoration_destructor, NULL, world ); +} + +/**************************************************************************************************/ + +DFBResult +unique_decoration_create( UniqueWindow *window, + UniqueDecorationFlags flags, + UniqueDecoration **ret_decoration ) +{ + DFBResult ret; + UniqueDecoration *decoration; + UniqueContext *context; + + D_ASSERT( window != NULL ); + D_ASSERT( D_FLAGS_ARE_IN( flags, UDF_ALL ) ); + D_ASSERT( ret_decoration != NULL ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + + /* Create a decoration object. */ + decoration = unique_wm_create_decoration(); + if (!decoration) + return DFB_FUSION; + + /* Initialize deocration data. */ + decoration->flags = flags; + + ret = unique_window_link( &decoration->window, window ); + if (ret) + goto error; + + ret = unique_context_link( &decoration->context, window->context ); + if (ret) + goto error; + + + D_MAGIC_SET( decoration, UniqueDecoration ); + + + /* Change global reaction lock. */ + fusion_object_set_lock( &decoration->object, &context->stack->context->lock ); + + /* activate object */ + fusion_object_activate( &decoration->object ); + + /* return the new decoration */ + *ret_decoration = decoration; + + return DFB_OK; + +error: + if (decoration->context) + unique_context_unlink( &decoration->context ); + + if (decoration->window) + unique_window_unlink( &decoration->window ); + + fusion_object_destroy( &decoration->object ); + + return ret; +} + +DFBResult +unique_decoration_destroy( UniqueDecoration *decoration ) +{ + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + D_FLAGS_SET( decoration->flags, UDF_DESTROYED ); + + unique_decoration_notify( decoration, UDNF_DESTROYED ); + + return DFB_OK; +} + +DFBResult +unique_decoration_notify( UniqueDecoration *decoration, + UniqueDecorationNotificationFlags flags ) +{ + UniqueDecorationNotification notification; + + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + D_ASSERT( flags != UDNF_NONE ); + + D_ASSERT( ! (flags & ~UDNF_ALL) ); + + notification.flags = flags; + notification.decoration = decoration; + + return unique_decoration_dispatch( decoration, ¬ification, unique_decoration_globals ); +} + +DFBResult +unique_decoration_update( UniqueDecoration *decoration, + const DFBRegion *region ) +{ + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + DFB_REGION_ASSERT_IF( region ); + + D_UNIMPLEMENTED(); + + return DFB_UNIMPLEMENTED; +} + -- cgit