Blender V4.3
WindowData.c
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <stdlib.h>
6
7#include "MEM_guardedalloc.h"
8
9#include "GHOST_C-api.h"
10
11#include "WindowData.h"
12
17
19{
20 WindowData *wb = MEM_mallocN(sizeof(*wb), "windowdata_new");
21 wb->data = data;
22 wb->handler = handler;
23
24 return wb;
25}
26
27void windowdata_handle(WindowData *wb, GHOST_EventHandle evt)
28{
29 wb->handler(wb->data, evt);
30}
31
33{
34 MEM_freeN(wb);
35}
GHOST C-API function and type declarations.
Read Guarded memory(de)allocation.
void windowdata_free(WindowData *wb)
Definition WindowData.c:32
WindowData * windowdata_new(void *data, WindowDataHandler handler)
Definition WindowData.c:18
void windowdata_handle(WindowData *wb, GHOST_EventHandle evt)
Definition WindowData.c:27
void(* WindowDataHandler)(void *priv, GHOST_EventHandle evt)
Definition WindowData.h:5
void *(* MEM_mallocN)(size_t len, const char *str)
Definition mallocn.cc:44
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
WindowDataHandler handler
Definition WindowData.c:15
void * data
Definition WindowData.c:14