mirror of
https://github.com/brl/mutter.git
synced 2025-08-03 07:04:41 +00:00
onscreen: Adds support for resizable windows
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)
This commit is contained in:
@@ -46,6 +46,19 @@ struct _CoglSwapBuffersNotifyEntry
|
||||
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;
|
||||
@@ -64,6 +77,9 @@ struct _CoglOnscreen
|
||||
|
||||
CoglSwapBuffersNotifyList swap_callbacks;
|
||||
|
||||
CoglBool resizable;
|
||||
CoglResizeNotifyList resize_callbacks;
|
||||
|
||||
void *winsys;
|
||||
};
|
||||
|
||||
@@ -77,4 +93,7 @@ _cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
|
||||
void
|
||||
_cogl_onscreen_notify_swap_buffers (CoglOnscreen *onscreen);
|
||||
|
||||
void
|
||||
_cogl_onscreen_notify_resize (CoglOnscreen *onscreen);
|
||||
|
||||
#endif /* __COGL_ONSCREEN_PRIVATE_H */
|
||||
|
Reference in New Issue
Block a user