wbemprox: Return an empty object if the path is NULL or empty.
[wine] / dlls / winemac.drv / macdrv_cocoa.h
1 /*
2  * MACDRV Cocoa interface declarations
3  *
4  * Copyright 2011, 2012, 2013 Ken Thomases for CodeWeavers Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 /* This header serves as a C interface between the Wine parts of MACDRV
22  * and the Objective-C parts.  It should restrict itself to C and the C-based
23  * Mac APIs, avoiding both Wine and Objective-C/Cocoa features, so that it can
24  * be included by both sides without contaminating either.
25  */
26
27 #ifndef __WINE_MACDRV_COCOA_H
28 #define __WINE_MACDRV_COCOA_H
29
30
31 #define GetCurrentProcess MacGetCurrentProcess
32 #define GetCurrentThread MacGetCurrentThread
33 #define LoadResource MacLoadResource
34 #define AnimatePalette MacAnimatePalette
35 #define EqualRgn MacEqualRgn
36 #define FillRgn MacFillRgn
37 #define FrameRgn MacFrameRgn
38 #define GetPixel MacGetPixel
39 #define InvertRgn MacInvertRgn
40 #define LineTo MacLineTo
41 #define OffsetRgn MacOffsetRgn
42 #define PaintRgn MacPaintRgn
43 #define Polygon MacPolygon
44 #define ResizePalette MacResizePalette
45 #define SetRectRgn MacSetRectRgn
46 #define EqualRect MacEqualRect
47 #define FillRect MacFillRect
48 #define FrameRect MacFrameRect
49 #define GetCursor MacGetCursor
50 #define InvertRect MacInvertRect
51 #define OffsetRect MacOffsetRect
52 #define PtInRect MacPtInRect
53 #define SetCursor MacSetCursor
54 #define SetRect MacSetRect
55 #define ShowCursor MacShowCursor
56 #define UnionRect MacUnionRect
57
58 #include <ApplicationServices/ApplicationServices.h>
59
60 #undef GetCurrentProcess
61 #undef GetCurrentThread
62 #undef LoadResource
63 #undef AnimatePalette
64 #undef EqualRgn
65 #undef FillRgn
66 #undef FrameRgn
67 #undef GetPixel
68 #undef InvertRgn
69 #undef LineTo
70 #undef OffsetRgn
71 #undef PaintRgn
72 #undef Polygon
73 #undef ResizePalette
74 #undef SetRectRgn
75 #undef EqualRect
76 #undef FillRect
77 #undef FrameRect
78 #undef GetCursor
79 #undef InvertRect
80 #undef OffsetRect
81 #undef PtInRect
82 #undef SetCursor
83 #undef SetRect
84 #undef ShowCursor
85 #undef UnionRect
86 #undef DPRINTF
87
88 #include <pthread.h>
89
90
91 #ifndef DECLSPEC_HIDDEN
92 # if defined(__MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
93 #  define DECLSPEC_HIDDEN
94 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
95 #  define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
96 # else
97 #  define DECLSPEC_HIDDEN
98 # endif
99 #endif
100
101
102 typedef struct macdrv_opaque_window* macdrv_window;
103 typedef struct macdrv_opaque_event_queue* macdrv_event_queue;
104 struct macdrv_event;
105
106 struct macdrv_display {
107     CGDirectDisplayID displayID;
108     CGRect frame;
109     CGRect work_frame;
110 };
111
112
113 /* main */
114 extern int macdrv_err_on;
115
116 extern int macdrv_start_cocoa_app(unsigned long long tickcount) DECLSPEC_HIDDEN;
117 extern void macdrv_window_rejected_focus(const struct macdrv_event *event) DECLSPEC_HIDDEN;
118
119
120 /* display */
121 extern int macdrv_get_displays(struct macdrv_display** displays, int* count) DECLSPEC_HIDDEN;
122 extern void macdrv_free_displays(struct macdrv_display* displays) DECLSPEC_HIDDEN;
123
124
125 /* event */
126 enum {
127     APP_DEACTIVATED,
128     MOUSE_BUTTON,
129     WINDOW_CLOSE_REQUESTED,
130     WINDOW_FRAME_CHANGED,
131     WINDOW_GOT_FOCUS,
132     WINDOW_LOST_FOCUS,
133     NUM_EVENT_TYPES
134 };
135
136 typedef uint32_t macdrv_event_mask;
137
138 typedef struct macdrv_event {
139     int                 type;
140     macdrv_window       window;
141     union {
142         struct {
143             int             button;
144             int             pressed;
145             int             x;
146             int             y;
147             unsigned long   time_ms;
148         }                                           mouse_button;
149         struct {
150             CGRect frame;
151         }                                           window_frame_changed;
152         struct {
153             unsigned long   serial;
154             void           *tried_windows;
155         }                                           window_got_focus;
156     };
157 } macdrv_event;
158
159 static inline macdrv_event_mask event_mask_for_type(int type)
160 {
161     return ((macdrv_event_mask)1 << type);
162 }
163
164 extern macdrv_event_queue macdrv_create_event_queue(void) DECLSPEC_HIDDEN;
165 extern void macdrv_destroy_event_queue(macdrv_event_queue queue) DECLSPEC_HIDDEN;
166 extern int macdrv_get_event_queue_fd(macdrv_event_queue queue) DECLSPEC_HIDDEN;
167
168 extern int macdrv_get_event_from_queue(macdrv_event_queue queue,
169         macdrv_event_mask mask, macdrv_event *event) DECLSPEC_HIDDEN;
170 extern void macdrv_cleanup_event(macdrv_event *event) DECLSPEC_HIDDEN;
171
172
173 /* window */
174 struct macdrv_window_features {
175     unsigned int    title_bar:1;
176     unsigned int    close_button:1;
177     unsigned int    minimize_button:1;
178     unsigned int    resizable:1;
179     unsigned int    utility:1;
180     unsigned int    shadow:1;
181 };
182
183 struct macdrv_window_state {
184     unsigned int    disabled:1;
185     unsigned int    no_activate:1;
186     unsigned int    floating:1;
187     unsigned int    excluded_by_expose:1;
188     unsigned int    excluded_by_cycle:1;
189 };
190
191 extern macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf,
192         CGRect frame, void* hwnd, macdrv_event_queue queue) DECLSPEC_HIDDEN;
193 extern void macdrv_destroy_cocoa_window(macdrv_window w) DECLSPEC_HIDDEN;
194 extern void* macdrv_get_window_hwnd(macdrv_window w) DECLSPEC_HIDDEN;
195 extern void macdrv_set_cocoa_window_features(macdrv_window w,
196         const struct macdrv_window_features* wf) DECLSPEC_HIDDEN;
197 extern void macdrv_set_cocoa_window_state(macdrv_window w,
198         const struct macdrv_window_state* state) DECLSPEC_HIDDEN;
199 extern void macdrv_set_cocoa_window_title(macdrv_window w, const UniChar* title,
200         size_t length) DECLSPEC_HIDDEN;
201 extern int macdrv_order_cocoa_window(macdrv_window w, macdrv_window prev,
202         macdrv_window next) DECLSPEC_HIDDEN;
203 extern void macdrv_hide_cocoa_window(macdrv_window w) DECLSPEC_HIDDEN;
204 extern int macdrv_set_cocoa_window_frame(macdrv_window w, const CGRect* new_frame) DECLSPEC_HIDDEN;
205 extern void macdrv_get_cocoa_window_frame(macdrv_window w, CGRect* out_frame) DECLSPEC_HIDDEN;
206 extern void macdrv_set_cocoa_parent_window(macdrv_window w, macdrv_window parent) DECLSPEC_HIDDEN;
207 extern void macdrv_set_window_surface(macdrv_window w, void *surface, pthread_mutex_t *mutex) DECLSPEC_HIDDEN;
208 extern CGImageRef create_surface_image(void *window_surface, CGRect *rect, int copy_data) DECLSPEC_HIDDEN;
209 extern int get_surface_region_rects(void *window_surface, const CGRect **rects, int *count) DECLSPEC_HIDDEN;
210 extern void macdrv_window_needs_display(macdrv_window w, CGRect rect) DECLSPEC_HIDDEN;
211 extern void macdrv_set_window_shape(macdrv_window w, const CGRect *rects, int count) DECLSPEC_HIDDEN;
212 extern void macdrv_set_window_alpha(macdrv_window w, CGFloat alpha) DECLSPEC_HIDDEN;
213 extern void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat keyGreen,
214                                         CGFloat keyBlue) DECLSPEC_HIDDEN;
215 extern void macdrv_clear_window_color_key(macdrv_window w) DECLSPEC_HIDDEN;
216 extern void macdrv_window_use_per_pixel_alpha(macdrv_window w, int use_per_pixel_alpha) DECLSPEC_HIDDEN;
217 extern void macdrv_give_cocoa_window_focus(macdrv_window w) DECLSPEC_HIDDEN;
218
219 #endif  /* __WINE_MACDRV_COCOA_H */