2012-12-21 01:02:28 +00:00
|
|
|
/*
|
|
|
|
* MACDRV Cocoa interface declarations
|
|
|
|
*
|
2013-01-07 20:44:36 +00:00
|
|
|
* Copyright 2011, 2012, 2013 Ken Thomases for CodeWeavers Inc.
|
2012-12-21 01:02:28 +00:00
|
|
|
*
|
|
|
|
* 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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This header serves as a C interface between the Wine parts of MACDRV
|
|
|
|
* and the Objective-C parts. It should restrict itself to C and the C-based
|
|
|
|
* Mac APIs, avoiding both Wine and Objective-C/Cocoa features, so that it can
|
|
|
|
* be included by both sides without contaminating either.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_MACDRV_COCOA_H
|
|
|
|
#define __WINE_MACDRV_COCOA_H
|
|
|
|
|
|
|
|
|
|
|
|
#define GetCurrentProcess MacGetCurrentProcess
|
|
|
|
#define GetCurrentThread MacGetCurrentThread
|
|
|
|
#define LoadResource MacLoadResource
|
|
|
|
#define AnimatePalette MacAnimatePalette
|
|
|
|
#define EqualRgn MacEqualRgn
|
|
|
|
#define FillRgn MacFillRgn
|
|
|
|
#define FrameRgn MacFrameRgn
|
|
|
|
#define GetPixel MacGetPixel
|
|
|
|
#define InvertRgn MacInvertRgn
|
|
|
|
#define LineTo MacLineTo
|
|
|
|
#define OffsetRgn MacOffsetRgn
|
|
|
|
#define PaintRgn MacPaintRgn
|
|
|
|
#define Polygon MacPolygon
|
|
|
|
#define ResizePalette MacResizePalette
|
|
|
|
#define SetRectRgn MacSetRectRgn
|
|
|
|
#define EqualRect MacEqualRect
|
|
|
|
#define FillRect MacFillRect
|
|
|
|
#define FrameRect MacFrameRect
|
|
|
|
#define GetCursor MacGetCursor
|
|
|
|
#define InvertRect MacInvertRect
|
|
|
|
#define OffsetRect MacOffsetRect
|
|
|
|
#define PtInRect MacPtInRect
|
|
|
|
#define SetCursor MacSetCursor
|
|
|
|
#define SetRect MacSetRect
|
|
|
|
#define ShowCursor MacShowCursor
|
|
|
|
#define UnionRect MacUnionRect
|
|
|
|
|
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
|
|
|
|
|
|
|
#undef GetCurrentProcess
|
|
|
|
#undef GetCurrentThread
|
|
|
|
#undef LoadResource
|
|
|
|
#undef AnimatePalette
|
|
|
|
#undef EqualRgn
|
|
|
|
#undef FillRgn
|
|
|
|
#undef FrameRgn
|
|
|
|
#undef GetPixel
|
|
|
|
#undef InvertRgn
|
|
|
|
#undef LineTo
|
|
|
|
#undef OffsetRgn
|
|
|
|
#undef PaintRgn
|
|
|
|
#undef Polygon
|
|
|
|
#undef ResizePalette
|
|
|
|
#undef SetRectRgn
|
|
|
|
#undef EqualRect
|
|
|
|
#undef FillRect
|
|
|
|
#undef FrameRect
|
|
|
|
#undef GetCursor
|
|
|
|
#undef InvertRect
|
|
|
|
#undef OffsetRect
|
|
|
|
#undef PtInRect
|
|
|
|
#undef SetCursor
|
|
|
|
#undef SetRect
|
|
|
|
#undef ShowCursor
|
|
|
|
#undef UnionRect
|
|
|
|
#undef DPRINTF
|
|
|
|
|
2013-01-15 02:23:55 +00:00
|
|
|
#include <pthread.h>
|
|
|
|
|
2012-12-21 01:02:28 +00:00
|
|
|
|
|
|
|
#ifndef DECLSPEC_HIDDEN
|
|
|
|
# if defined(__MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
|
|
|
|
# define DECLSPEC_HIDDEN
|
|
|
|
# elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
|
|
|
|
# define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
|
|
|
|
# else
|
|
|
|
# define DECLSPEC_HIDDEN
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2013-01-07 20:44:44 +00:00
|
|
|
typedef struct macdrv_opaque_window* macdrv_window;
|
2013-01-21 06:07:51 +00:00
|
|
|
typedef struct macdrv_opaque_event_queue* macdrv_event_queue;
|
2013-01-07 20:44:44 +00:00
|
|
|
|
2012-12-21 01:02:28 +00:00
|
|
|
struct macdrv_display {
|
|
|
|
CGDirectDisplayID displayID;
|
|
|
|
CGRect frame;
|
|
|
|
CGRect work_frame;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-01-07 20:44:36 +00:00
|
|
|
/* main */
|
2013-01-21 06:07:47 +00:00
|
|
|
extern int macdrv_err_on;
|
|
|
|
|
2013-01-07 20:44:36 +00:00
|
|
|
extern int macdrv_start_cocoa_app(void) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
|
2012-12-21 01:02:28 +00:00
|
|
|
/* display */
|
|
|
|
extern int macdrv_get_displays(struct macdrv_display** displays, int* count) DECLSPEC_HIDDEN;
|
|
|
|
extern void macdrv_free_displays(struct macdrv_display* displays) DECLSPEC_HIDDEN;
|
|
|
|
|
2013-01-07 20:44:44 +00:00
|
|
|
|
2013-01-21 06:07:51 +00:00
|
|
|
/* event */
|
|
|
|
typedef uint32_t macdrv_event_mask;
|
|
|
|
|
|
|
|
typedef struct macdrv_event {
|
|
|
|
int type;
|
|
|
|
macdrv_window window;
|
|
|
|
} macdrv_event;
|
|
|
|
|
|
|
|
static inline macdrv_event_mask event_mask_for_type(int type)
|
|
|
|
{
|
|
|
|
return ((macdrv_event_mask)1 << type);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern macdrv_event_queue macdrv_create_event_queue(void) DECLSPEC_HIDDEN;
|
|
|
|
extern void macdrv_destroy_event_queue(macdrv_event_queue queue) DECLSPEC_HIDDEN;
|
|
|
|
extern int macdrv_get_event_queue_fd(macdrv_event_queue queue) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
extern int macdrv_get_event_from_queue(macdrv_event_queue queue,
|
|
|
|
macdrv_event_mask mask, macdrv_event *event) DECLSPEC_HIDDEN;
|
|
|
|
extern void macdrv_cleanup_event(macdrv_event *event) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
|
2013-01-07 20:44:44 +00:00
|
|
|
/* window */
|
|
|
|
struct macdrv_window_features {
|
|
|
|
unsigned int title_bar:1;
|
|
|
|
unsigned int close_button:1;
|
|
|
|
unsigned int minimize_button:1;
|
|
|
|
unsigned int resizable:1;
|
|
|
|
unsigned int utility:1;
|
|
|
|
unsigned int shadow:1;
|
|
|
|
};
|
|
|
|
|
2013-01-11 12:18:05 +00:00
|
|
|
struct macdrv_window_state {
|
|
|
|
unsigned int disabled:1;
|
2013-01-11 12:18:36 +00:00
|
|
|
unsigned int no_activate:1;
|
2013-01-11 12:18:55 +00:00
|
|
|
unsigned int floating:1;
|
2013-01-11 12:20:40 +00:00
|
|
|
unsigned int excluded_by_expose:1;
|
|
|
|
unsigned int excluded_by_cycle:1;
|
2013-01-11 12:18:05 +00:00
|
|
|
};
|
|
|
|
|
2013-01-07 20:44:44 +00:00
|
|
|
extern macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf,
|
2013-01-21 06:08:03 +00:00
|
|
|
CGRect frame, void* hwnd, macdrv_event_queue queue) DECLSPEC_HIDDEN;
|
2013-01-07 20:44:44 +00:00
|
|
|
extern void macdrv_destroy_cocoa_window(macdrv_window w) DECLSPEC_HIDDEN;
|
2013-01-21 06:07:58 +00:00
|
|
|
extern void* macdrv_get_window_hwnd(macdrv_window w) DECLSPEC_HIDDEN;
|
2013-01-07 20:44:44 +00:00
|
|
|
extern void macdrv_set_cocoa_window_features(macdrv_window w,
|
|
|
|
const struct macdrv_window_features* wf) DECLSPEC_HIDDEN;
|
2013-01-11 12:18:05 +00:00
|
|
|
extern void macdrv_set_cocoa_window_state(macdrv_window w,
|
|
|
|
const struct macdrv_window_state* state) DECLSPEC_HIDDEN;
|
2013-01-07 20:44:44 +00:00
|
|
|
extern void macdrv_set_cocoa_window_title(macdrv_window w, const UniChar* title,
|
|
|
|
size_t length) DECLSPEC_HIDDEN;
|
|
|
|
extern int macdrv_order_cocoa_window(macdrv_window w, macdrv_window prev,
|
|
|
|
macdrv_window next) DECLSPEC_HIDDEN;
|
|
|
|
extern void macdrv_hide_cocoa_window(macdrv_window w) DECLSPEC_HIDDEN;
|
|
|
|
extern int macdrv_set_cocoa_window_frame(macdrv_window w, const CGRect* new_frame) DECLSPEC_HIDDEN;
|
2013-01-11 12:19:36 +00:00
|
|
|
extern void macdrv_set_cocoa_parent_window(macdrv_window w, macdrv_window parent) DECLSPEC_HIDDEN;
|
2013-01-15 02:23:55 +00:00
|
|
|
extern void macdrv_set_window_surface(macdrv_window w, void *surface, pthread_mutex_t *mutex) DECLSPEC_HIDDEN;
|
|
|
|
extern CGImageRef create_surface_image(void *window_surface, CGRect *rect, int copy_data) DECLSPEC_HIDDEN;
|
|
|
|
extern int get_surface_region_rects(void *window_surface, const CGRect **rects, int *count) DECLSPEC_HIDDEN;
|
|
|
|
extern void macdrv_window_needs_display(macdrv_window w, CGRect rect) DECLSPEC_HIDDEN;
|
2013-01-15 02:23:58 +00:00
|
|
|
extern void macdrv_set_window_shape(macdrv_window w, const CGRect *rects, int count) DECLSPEC_HIDDEN;
|
2013-01-15 02:24:02 +00:00
|
|
|
extern void macdrv_set_window_alpha(macdrv_window w, CGFloat alpha) DECLSPEC_HIDDEN;
|
|
|
|
extern void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat keyGreen,
|
|
|
|
CGFloat keyBlue) DECLSPEC_HIDDEN;
|
|
|
|
extern void macdrv_clear_window_color_key(macdrv_window w) DECLSPEC_HIDDEN;
|
|
|
|
extern void macdrv_window_use_per_pixel_alpha(macdrv_window w, int use_per_pixel_alpha) DECLSPEC_HIDDEN;
|
2013-01-07 20:44:44 +00:00
|
|
|
|
2012-12-21 01:02:28 +00:00
|
|
|
#endif /* __WINE_MACDRV_COCOA_H */
|