/*
 * Copyright © 2016 Quentin "Sardem FF7" Glidic
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */
/*
 * (C) Copyright 2014, Fuji Xerox Co.,Ltd.  All rights reserved.
 * File name : fx-surface.h
 * Title : shell surface
 */

#ifndef _FX_SURFACE_H_
#define _FX_SURFACE_H_

#include "compositor.h"
#include "weston-fx-shell.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Typedefs */
struct fx_shell_surface;
struct fx_shell_client;
struct fx_shell_seat;
struct fx_shell_surface_implementation {
/*
    void (*set_activated)(
            struct fx_shell_surface *shell_surface,
            void *user_data,
            bool activated );
*/
    void (*set_fullscreen)(
            struct fx_shell_surface *shell_surface,
            void *user_data,
            bool fullscreen );
/*
    void (*set_maximized)(
            struct fx_shell_surface *shell_surface,
            void *user_data,
            bool maximized );
    void (*set_resizing)(
            struct fx_shell_surface *shell_surface,
            void *user_data,
            bool resizing );
*/
    void (*set_size)(
            struct fx_shell_surface *shell_surface,
            void *user_data,
            int32_t width,
            int32_t height );
    void (*committed)(
            struct fx_shell_surface *shell_surface,
            void *user_data,
            int32_t sx,
            int32_t sy );
/*
    void (*update_position)(
            struct fx_shell_surface *shell_surface,
            void *user_data );
    void (*ping)(
            struct fx_shell_surface *shell_surface,
            uint32_t serial,
            void *user_data );
*/
    void (*close)(
            struct fx_shell_surface *shell_surface,
            void *user_data );

/*
    bool (*get_activated)(
            struct fx_shell_surface *shell_surface,
            void *user_data );
*/
    bool (*get_fullscreen)(
            struct fx_shell_surface *shell_surface,
            void *user_data );
/*
    bool (*get_maximized)(
            struct fx_shell_surface *shell_surface,
            void *user_data );
    bool (*get_resizing)(
            struct fx_shell_surface *shell_surface,
            void *user_data );
    struct weston_size (*get_max_size)(
           struct fx_shell_surface *shell_surface,
           void *user_data );
    struct weston_size (*get_min_size)(
            struct fx_shell_surface *shell_surface,
            void *user_data );
*/

    void (*destroy) (
            struct fx_shell_surface *shell_surface,
            void *user_data );
};

/* Procedures */
void
fx_shell_surface_destroy(
        struct fx_shell_surface *shell_surface );
struct wl_resource *
fx_shell_surface_add_resource(
        struct fx_shell_surface *shell_surface,
        const struct wl_interface *interface,
        const void *implementation,
        uint32_t id,
        wl_resource_destroy_func_t destroy );
WL_EXPORT bool
fx_shell_surface_is_shell_surface(
        struct weston_surface *surface );
WL_EXPORT struct fx_shell_surface *
fx_shell_surface_get_shell_surface(
        struct weston_surface *surface );
struct fx_shell_surface *
fx_shell_surface_from_grab_link(
        struct wl_list *grab_link );
WL_EXPORT void
fx_shell_surface_set_user_data(
        struct fx_shell_surface* shell_surface,
        void *user_data );
struct fx_shell_view *
fx_shell_surface_create_shell_view(
        struct fx_shell_surface *shell_surface );

struct fx_shell_surface *
fx_shell_surface_create(
        struct weston_fx_shell *weston_fx_shell,
        struct fx_shell_client *shell_client,
        struct weston_surface *surface,
        const struct fx_shell_surface_implementation *implementation,
        void *implementation_data );
WL_EXPORT struct weston_view *
fx_shell_surface_create_view(
        struct fx_shell_surface* shell_surface );
WL_EXPORT void
fx_shell_surface_unlink_view(
        struct weston_view *view );
WL_EXPORT void
fx_shell_view_propagate_layer(
        struct fx_shell_view* shell_view );
WL_EXPORT void
fx_shell_surface_propagate_layer(
        struct fx_shell_surface *shell_surface );
void
fx_shell_surface_set_relative_to(
        struct fx_shell_surface *shell_surface,
        struct fx_shell_surface *parent_shell_surface,
        int32_t x,
        int32_t y,
        bool use_geometry );
void
fx_shell_surface_unset_relative_to(
        struct fx_shell_surface *shell_surface );
void
fx_shell_surface_set_transient(
        struct fx_shell_surface *shell_surface,
        struct fx_shell_surface *transient_parent_shell_surface,
        int32_t x,
        int32_t y );
void
fx_shell_surface_popup_grab(
        struct fx_shell_surface *shell_surface,
        struct fx_shell_seat *shell_seat,
        uint32_t serial );
void
fx_shell_surface_popup_ungrab(
        struct fx_shell_surface *shell_surface,
        struct fx_shell_seat *shell_seat );
void
fx_shell_surface_popup_dismiss(
        struct fx_shell_surface *shell_surface );
WL_EXPORT void
fx_shell_surface_set_fullscreen(
        struct fx_shell_surface *shell_surface,
        bool fullscreen );
WL_EXPORT void
fx_shell_surface_set_size(
        struct fx_shell_surface *shell_surface,
        int32_t width,
        int32_t height );
WL_EXPORT void
fx_shell_surface_close(
        struct fx_shell_surface *shell_surface );
struct fx_shell_surface *
fx_shell_surface_get_parent(
        struct fx_shell_surface *shell_surface );
bool
fx_shell_surface_get_grab( struct fx_shell_surface *shell_surface );
struct wl_list *
fx_shell_surface_get_client_link(struct fx_shell_surface *shell_surface );
const struct fx_shell_surface_implementation *
fx_shell_surface_get_implementation(
        struct fx_shell_surface *shell_surface );
void *
fx_shell_surface_get_implementation_data(
        struct fx_shell_surface *shell_surface );
WL_EXPORT struct fx_shell_client *
fx_shell_surface_get_client(
        struct fx_shell_surface *shell_surface );
WL_EXPORT void *
fx_shell_surface_get_user_data(
        struct fx_shell_surface *shell_surface );
WL_EXPORT struct weston_surface *
fx_shell_surface_get_surface(
        struct fx_shell_surface *shell_surface );

WL_EXPORT bool
fx_shell_surface_get_fullscreen(
        struct fx_shell_surface *shell_surface );
WL_EXPORT struct weston_geometry
fx_shell_surface_get_geometry(
        struct fx_shell_surface *shell_surface );
int
fx_shell_surafce_get_flags(
        struct fx_shell_surface *shell_surface );
void
fx_shell_surafce_set_flags(
        struct fx_shell_surface *shell_surface,
        int flags );
bool
fx_shell_surafce_get_shadow_focus(
        struct fx_shell_surface *shell_surface );
void
fx_shell_surafce_set_shadow_focus(
        struct fx_shell_surface *shell_surface,
        bool shadow_focus );
bool
fx_shell_surafce_get_anim_enabled(
        struct fx_shell_surface *shell_surface );
void
fx_shell_surafce_set_anim_enabled(
        struct fx_shell_surface *shell_surface,
        bool anim );
int
fx_shell_surafce_get_layer_index(
        struct fx_shell_surface *shell_surface );
void
fx_shell_surafce_set_layer_index(
        struct fx_shell_surface *shell_surface,
        int layer_index );

#ifdef __cplusplus
}
#endif

#endif /* _FX_SURFACE_H_ */

