mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
df51574116
This adds api to be able to request that the window system allows a given onscreen framebuffer to be resizable, and api to add and remove resize handlers to be called whenever the framebuffer does actually change size. The new functions are: cogl_onscreen_{get,set}_resizable() cogl_onscreen_{add,remove}_resize_handler() The examples cogl-hello and cogl-x11-foreign have been updated to use the new api. To smoke test how Cogl updates the viewport automatically in response to window resizes the cogl-hello test doesn't explicitly respond to resize events by setting the viewport and cogl-x11-foreign responds by setting a viewport that is offset by a quarter of the window's width/height and half the width and height of the window. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit a1a8cc00bfa2cecaf1007aec5f3dd95dc07b1786)
100 lines
2.3 KiB
C
100 lines
2.3 KiB
C
/*
|
|
* Cogl
|
|
*
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
*
|
|
* Copyright (C) 2011 Intel Corporation.
|
|
*
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*
|
|
*/
|
|
|
|
#ifndef __COGL_ONSCREEN_PRIVATE_H
|
|
#define __COGL_ONSCREEN_PRIVATE_H
|
|
|
|
#include "cogl-framebuffer-private.h"
|
|
#include "cogl-queue.h"
|
|
|
|
#include <glib.h>
|
|
|
|
#ifdef COGL_HAS_WIN32_SUPPORT
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
typedef struct _CoglSwapBuffersNotifyEntry CoglSwapBuffersNotifyEntry;
|
|
|
|
COGL_TAILQ_HEAD (CoglSwapBuffersNotifyList, CoglSwapBuffersNotifyEntry);
|
|
|
|
struct _CoglSwapBuffersNotifyEntry
|
|
{
|
|
COGL_TAILQ_ENTRY (CoglSwapBuffersNotifyEntry) list_node;
|
|
|
|
CoglSwapBuffersNotify callback;
|
|
void *user_data;
|
|
unsigned int id;
|
|
};
|
|
|
|
typedef struct _CoglResizeNotifyEntry CoglResizeNotifyEntry;
|
|
|
|
COGL_TAILQ_HEAD (CoglResizeNotifyList, CoglResizeNotifyEntry);
|
|
|
|
struct _CoglResizeNotifyEntry
|
|
{
|
|
COGL_TAILQ_ENTRY (CoglResizeNotifyEntry) list_node;
|
|
|
|
CoglOnscreenResizeCallback callback;
|
|
void *user_data;
|
|
unsigned int id;
|
|
};
|
|
|
|
struct _CoglOnscreen
|
|
{
|
|
CoglFramebuffer _parent;
|
|
|
|
#ifdef COGL_HAS_X11_SUPPORT
|
|
uint32_t foreign_xid;
|
|
CoglOnscreenX11MaskCallback foreign_update_mask_callback;
|
|
void *foreign_update_mask_data;
|
|
#endif
|
|
|
|
#ifdef COGL_HAS_WIN32_SUPPORT
|
|
HWND foreign_hwnd;
|
|
#endif
|
|
|
|
CoglBool swap_throttled;
|
|
|
|
CoglSwapBuffersNotifyList swap_callbacks;
|
|
|
|
CoglBool resizable;
|
|
CoglResizeNotifyList resize_callbacks;
|
|
|
|
void *winsys;
|
|
};
|
|
|
|
CoglOnscreen *
|
|
_cogl_onscreen_new (void);
|
|
|
|
void
|
|
_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
|
|
int width, int height);
|
|
|
|
void
|
|
_cogl_onscreen_notify_swap_buffers (CoglOnscreen *onscreen);
|
|
|
|
void
|
|
_cogl_onscreen_notify_resize (CoglOnscreen *onscreen);
|
|
|
|
#endif /* __COGL_ONSCREEN_PRIVATE_H */
|