1 /*
2  * gdkdisplay-quartz.h
3  *
4  * Copyright 2017 Tom Schoonjans
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 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  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __GDK_QUARTZ_DISPLAY__
21 #define __GDK_QUARTZ_DISPLAY__
22 
23 #include <AppKit/AppKit.h>
24 
25 #include "gdkdisplayprivate.h"
26 #include "gdkkeys.h"
27 #include "gdkwindow.h"
28 #include "gdkinternals.h"
29 #include "gdkmain.h"
30 
31 G_BEGIN_DECLS
32 
33 
34 struct _GdkQuartzDisplay
35 {
36   GdkDisplay parent_instance;
37   NSRect geometry; /* In AppKit coordinates. */
38   NSSize size; /* Aggregate size of displays in millimeters. */
39   GPtrArray *monitors;
40 };
41 
42 struct _GdkQuartzDisplayClass
43 {
44   GdkDisplayClass parent_class;
45 };
46 
47 /* Display methods - events */
48 void     _gdk_quartz_display_queue_events (GdkDisplay *display);
49 gboolean _gdk_quartz_display_has_pending  (GdkDisplay *display);
50 
51 void       _gdk_quartz_display_event_data_copy (GdkDisplay     *display,
52                                                 const GdkEvent *src,
53                                                 GdkEvent       *dst);
54 void       _gdk_quartz_display_event_data_free (GdkDisplay     *display,
55                                                 GdkEvent       *event);
56 
57 /* Display methods - cursor */
58 GdkCursor *_gdk_quartz_display_get_cursor_for_type     (GdkDisplay      *display,
59                                                         GdkCursorType    type);
60 GdkCursor *_gdk_quartz_display_get_cursor_for_name     (GdkDisplay      *display,
61                                                         const gchar     *name);
62 GdkCursor *_gdk_quartz_display_get_cursor_for_surface  (GdkDisplay      *display,
63                                                         cairo_surface_t *surface,
64                                                         gdouble          x,
65                                                         gdouble          y);
66 gboolean   _gdk_quartz_display_supports_cursor_alpha   (GdkDisplay    *display);
67 gboolean   _gdk_quartz_display_supports_cursor_color   (GdkDisplay    *display);
68 void       _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,
69                                                         guint      *width,
70                                                         guint      *height);
71 void       _gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display,
72                                                         guint      *width,
73                                                         guint      *height);
74 
75 /* Display methods - window */
76 void       _gdk_quartz_display_before_process_all_updates (GdkDisplay *display);
77 void       _gdk_quartz_display_after_process_all_updates  (GdkDisplay *display);
78 void       _gdk_quartz_display_create_window_impl (GdkDisplay    *display,
79                                                    GdkWindow     *window,
80                                                    GdkWindow     *real_parent,
81                                                    GdkScreen     *screen,
82                                                    GdkEventMask   event_mask,
83                                                    GdkWindowAttr *attributes,
84                                                    gint           attributes_mask);
85 
86 /* Display methods - keymap */
87 GdkKeymap * _gdk_quartz_display_get_keymap (GdkDisplay *display);
88 
89 /* Display methods - selection */
90 gboolean    _gdk_quartz_display_set_selection_owner (GdkDisplay *display,
91                                                      GdkWindow  *owner,
92                                                      GdkAtom     selection,
93                                                      guint32     time,
94                                                      gboolean    send_event);
95 GdkWindow * _gdk_quartz_display_get_selection_owner (GdkDisplay *display,
96                                                      GdkAtom     selection);
97 gint        _gdk_quartz_display_get_selection_property (GdkDisplay     *display,
98                                                         GdkWindow      *requestor,
99                                                         guchar        **data,
100                                                         GdkAtom        *ret_type,
101                                                         gint           *ret_format);
102 void        _gdk_quartz_display_convert_selection      (GdkDisplay     *display,
103                                                         GdkWindow      *requestor,
104                                                         GdkAtom         selection,
105                                                         GdkAtom         target,
106                                                         guint32         time);
107 gint        _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay     *display,
108                                                             GdkAtom         encoding,
109                                                             gint            format,
110                                                             const guchar   *text,
111                                                             gint            length,
112                                                             gchar        ***list);
113 gchar *     _gdk_quartz_display_utf8_to_string_target      (GdkDisplay     *displayt,
114                                                             const gchar    *str);
115 G_END_DECLS
116 
117 #endif  /* __GDK_QUARTZ_DISPLAY__ */
118