gdkprivate-quartz.h 5.6 KB
Newer Older
Anders Carlsson's avatar
Anders Carlsson committed
1 2
/* gdkwindow-quartz.c
 *
3
 * Copyright (C) 2005-2006 Imendio AB
Anders Carlsson's avatar
Anders Carlsson committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
 *
 * 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 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., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GDK_PRIVATE_QUARTZ_H__
#define __GDK_PRIVATE_QUARTZ_H__

#define GDK_QUARTZ_ALLOC_POOL NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]
#define GDK_QUARTZ_RELEASE_POOL [pool release]

#include <gdk/gdkprivate.h>
#include <gdk/quartz/gdkpixmap-quartz.h>
#include <gdk/quartz/gdkwindow-quartz.h>

#include <gdk/gdk.h>

#include "gdkinternals.h"

35 36
#include <config.h>

Anders Carlsson's avatar
Anders Carlsson committed
37 38 39 40 41 42 43
#define GDK_TYPE_GC_QUARTZ              (_gdk_gc_quartz_get_type ())
#define GDK_GC_QUARTZ(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_QUARTZ, GdkGCQuartz))
#define GDK_GC_QUARTZ_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_QUARTZ, GdkGCQuartzClass))
#define GDK_IS_GC_QUARTZ(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_QUARTZ))
#define GDK_IS_GC_QUARTZ_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_QUARTZ))
#define GDK_GC_QUARTZ_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_QUARTZ, GdkGCQuartzClass))

44 45
#define GDK_DRAG_CONTEXT_PRIVATE(context) ((GdkDragContextPrivate *) GDK_DRAG_CONTEXT (context)->windowing_data)

Anders Carlsson's avatar
Anders Carlsson committed
46 47 48
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkGCQuartz       GdkGCQuartz;
typedef struct _GdkGCQuartzClass  GdkGCQuartzClass;
49
typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
Anders Carlsson's avatar
Anders Carlsson committed
50 51 52

struct _GdkGCQuartz
{
53
  GdkGC             parent_instance;
Anders Carlsson's avatar
Anders Carlsson committed
54

55 56 57 58
  GdkFont          *font;
  GdkFunction       function;
  GdkSubwindowMode  subwindow_mode;
  gboolean          graphics_exposures;
Anders Carlsson's avatar
Anders Carlsson committed
59

60 61 62 63 64 65 66 67 68 69 70 71 72 73
  gboolean          have_clip_region;
  gboolean          have_clip_mask;
  CGImageRef        clip_mask;

  gint              line_width;
  GdkLineStyle      line_style;
  GdkCapStyle       cap_style;
  GdkJoinStyle      join_style;

  gfloat           *dash_lengths;
  gint              dash_count;
  gfloat            dash_phase;

  CGPatternRef      ts_pattern;
74 75

  guint             is_window : 1;
Anders Carlsson's avatar
Anders Carlsson committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
};

struct _GdkGCQuartzClass
{
  GdkGCClass parent_class;
};

struct _GdkVisualClass
{
  GObjectClass parent_class;
};

struct _GdkCursorPrivate
{
  GdkCursor cursor;
  NSCursor *nscursor;
};

94 95 96 97 98
struct _GdkDragContextPrivate
{
  id <NSDraggingInfo> dragging_info;
};

Anders Carlsson's avatar
Anders Carlsson committed
99 100 101 102
extern GdkDisplay *_gdk_display;
extern GdkScreen *_gdk_screen;
extern GdkWindow *_gdk_root;

103 104
extern GdkDragContext *_gdk_quartz_drag_source_context;

Anders Carlsson's avatar
Anders Carlsson committed
105
/* Initialization */
106 107 108 109 110
void _gdk_windowing_window_init  (void);
void _gdk_events_init            (void);
void _gdk_visual_init            (void);
void _gdk_input_init             (void);
void _gdk_quartz_event_loop_init (void);
Anders Carlsson's avatar
Anders Carlsson committed
111

112
/* GC */
113 114 115 116 117 118
typedef enum {
  GDK_QUARTZ_CONTEXT_STROKE = 1 << 0,
  GDK_QUARTZ_CONTEXT_FILL   = 1 << 1,
  GDK_QUARTZ_CONTEXT_TEXT   = 1 << 2
} GdkQuartzContextValuesMask;

119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
GType  _gdk_gc_quartz_get_type          (void);
GdkGC *_gdk_quartz_gc_new               (GdkDrawable                *drawable,
					 GdkGCValues                *values,
					 GdkGCValuesMask             values_mask);
void   _gdk_quartz_gc_update_cg_context (GdkGC                      *gc,
					 GdkDrawable                *drawable,
					 CGContextRef                context,
					 GdkQuartzContextValuesMask  mask);

/* Colormap */
void _gdk_quartz_colormap_get_rgba_from_pixel (GdkColormap *colormap,
					       guint32      pixel,
					       gfloat      *red,
					       gfloat      *green,
					       gfloat      *blue,
					       gfloat      *alpha);

/* Window */
GdkWindow *_gdk_quartz_window_find_child_by_point   (GdkWindow *toplevel,
						     gint       x,
						     gint       y,
						     gint      *x_ret,
						     gint      *y_ret);
gint       _gdk_quartz_window_get_inverted_screen_y (gint       y);

/* Events */
void         _gdk_quartz_events_update_focus_window   (GdkWindow *new_window,
						       gboolean   got_focus);
GdkWindow *  _gdk_quartz_events_get_mouse_window       (void);
void         _gdk_quartz_events_update_mouse_window    (GdkWindow *window);
void         _gdk_quartz_events_update_cursor          (GdkWindow *window);
void         _gdk_quartz_events_send_map_events        (GdkWindow *window);
GdkEventMask _gdk_quartz_events_get_current_event_mask (void);
152

Anders Carlsson's avatar
Anders Carlsson committed
153 154 155
extern GdkWindow *_gdk_quartz_keyboard_grab_window;
extern GdkWindow *_gdk_quartz_pointer_grab_window;

156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
/* Event loop */
NSEvent *  _gdk_quartz_event_loop_get_current     (void);
void       _gdk_quartz_event_loop_release_current (void);

/* FIXME: image */
GdkImage *_gdk_quartz_image_copy_to_image (GdkDrawable *drawable,
					    GdkImage    *image,
					    gint         src_x,
					    gint         src_y,
					    gint         dest_x,
					    gint         dest_y,
					    gint         width,
					    gint         height);

/* Keys */
GdkEventType _gdk_quartz_keys_event_type  (NSEvent   *event);
gboolean     _gdk_quartz_keys_is_modifier (guint      keycode);

/* Drawable */
void        _gdk_quartz_drawable_finish (GdkDrawable *drawable);
176

Anders Carlsson's avatar
Anders Carlsson committed
177
#endif /* __GDK_PRIVATE_QUARTZ_H__ */