| 1 |
/* GDK - The GIMP Drawing Kit |
| 2 |
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
| 3 |
* Copyright (C) 1998-1999 Tor Lillqvist |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, write to the |
| 17 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 |
* Boston, MA 02111-1307, USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
/* |
| 22 |
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
| 23 |
* file for a list of people on the GTK+ Team. |
| 24 |
*/ |
| 25 |
|
| 26 |
/* |
| 27 |
* GTK+ DirectFB backend |
| 28 |
* Copyright (C) 2001-2002 convergence integrated media GmbH |
| 29 |
* Copyright (C) 2002-2004 convergence GmbH |
| 30 |
* Written by Denis Oliver Kropp <[email protected]> and |
| 31 |
* Sven Neumann <[email protected]> |
| 32 |
*/ |
| 33 |
|
| 34 |
#include "config.h" |
| 35 |
#include "gdk.h" |
| 36 |
#include "gdkscreen.h" |
| 37 |
#include "gdkdirectfb.h" |
| 38 |
#include "gdkprivate-directfb.h" |
| 39 |
|
| 40 |
#include "gdkinternals.h" |
| 41 |
#include "gdkalias.h" |
| 42 |
|
| 43 |
|
| 44 |
static GdkColormap *default_colormap = NULL; |
| 45 |
|
| 46 |
GdkDisplay * |
| 47 |
gdk_screen_get_display (GdkScreen *screen) |
| 48 |
{ |
| 49 |
return GDK_DISPLAY_OBJECT (_gdk_display); |
| 50 |
} |
| 51 |
|
| 52 |
GdkWindow * |
| 53 |
gdk_screen_get_root_window (GdkScreen *screen) |
| 54 |
{ |
| 55 |
return _gdk_parent_root; |
| 56 |
} |
| 57 |
|
| 58 |
GdkColormap* |
| 59 |
gdk_screen_get_default_colormap (GdkScreen *screen) |
| 60 |
{ |
| 61 |
return default_colormap; |
| 62 |
} |
| 63 |
|
| 64 |
void |
| 65 |
gdk_screen_set_default_colormap (GdkScreen *screen, |
| 66 |
GdkColormap *colormap) |
| 67 |
{ |
| 68 |
GdkColormap *old_colormap; |
| 69 |
|
| 70 |
g_return_if_fail (GDK_IS_SCREEN (screen)); |
| 71 |
g_return_if_fail (GDK_IS_COLORMAP (colormap)); |
| 72 |
|
| 73 |
old_colormap = default_colormap; |
| 74 |
|
| 75 |
default_colormap = g_object_ref (colormap); |
| 76 |
|
| 77 |
if (old_colormap) |
| 78 |
g_object_unref (old_colormap); |
| 79 |
} |
| 80 |
|
| 81 |
gint |
| 82 |
gdk_screen_get_n_monitors (GdkScreen *screen) |
| 83 |
{ |
| 84 |
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); |
| 85 |
|
| 86 |
return 1; |
| 87 |
} |
| 88 |
|
| 89 |
gint |
| 90 |
gdk_screen_get_primary_monitor (GdkScreen *screen) |
| 91 |
{ |
| 92 |
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); |
| 93 |
|
| 94 |
return 0; |
| 95 |
} |
| 96 |
|
| 97 |
void |
| 98 |
gdk_screen_get_monitor_geometry (GdkScreen *screen, |
| 99 |
gint num_monitor, |
| 100 |
GdkRectangle *dest) |
| 101 |
{ |
| 102 |
g_return_if_fail (GDK_IS_SCREEN (screen)); |
| 103 |
g_return_if_fail (dest != NULL); |
| 104 |
|
| 105 |
dest->x = 0; |
| 106 |
dest->y = 0; |
| 107 |
dest->width = gdk_screen_width (); |
| 108 |
dest->height = gdk_screen_height (); |
| 109 |
} |
| 110 |
|
| 111 |
gint |
| 112 |
gdk_screen_get_monitor_width_mm (GdkScreen *screen, |
| 113 |
gint monitor_num) |
| 114 |
{ |
| 115 |
return gdk_screen_get_width_mm (screen); |
| 116 |
} |
| 117 |
|
| 118 |
gint |
| 119 |
gdk_screen_get_monitor_height_mm (GdkScreen *screen, |
| 120 |
gint monitor_num) |
| 121 |
{ |
| 122 |
return gdk_screen_get_height_mm (screen); |
| 123 |
} |
| 124 |
|
| 125 |
gchar * |
| 126 |
gdk_screen_get_monitor_plug_name (GdkScreen *screen, |
| 127 |
gint monitor_num) |
| 128 |
{ |
| 129 |
return g_strdup ("DirectFB"); |
| 130 |
} |
| 131 |
|
| 132 |
gint |
| 133 |
gdk_screen_get_number (GdkScreen *screen) |
| 134 |
{ |
| 135 |
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); |
| 136 |
|
| 137 |
return 0; |
| 138 |
} |
| 139 |
|
| 140 |
|
| 141 |
gchar * |
| 142 |
_gdk_windowing_substitute_screen_number (const gchar *display_name, |
| 143 |
int screen_number) |
| 144 |
{ |
| 145 |
return g_strdup (display_name); |
| 146 |
} |
| 147 |
|
| 148 |
gchar * |
| 149 |
gdk_screen_make_display_name (GdkScreen *screen) |
| 150 |
{ |
| 151 |
return g_strdup ("DirectFB"); |
| 152 |
} |
| 153 |
|
| 154 |
gint |
| 155 |
gdk_screen_get_width (GdkScreen *screen) |
| 156 |
{ |
| 157 |
DFBDisplayLayerConfig dlc; |
| 158 |
|
| 159 |
_gdk_display->layer->GetConfiguration (_gdk_display->layer, &dlc); |
| 160 |
|
| 161 |
return dlc.width; |
| 162 |
} |
| 163 |
|
| 164 |
gint |
| 165 |
gdk_screen_get_height (GdkScreen *screen) |
| 166 |
{ |
| 167 |
DFBDisplayLayerConfig dlc; |
| 168 |
|
| 169 |
_gdk_display->layer->GetConfiguration (_gdk_display->layer, &dlc); |
| 170 |
|
| 171 |
return dlc.height; |
| 172 |
} |
| 173 |
|
| 174 |
gint |
| 175 |
gdk_screen_get_width_mm (GdkScreen *screen) |
| 176 |
{ |
| 177 |
static gboolean first_call = TRUE; |
| 178 |
DFBDisplayLayerConfig dlc; |
| 179 |
|
| 180 |
if (first_call) |
| 181 |
{ |
| 182 |
g_message ("gdk_screen_width_mm() assumes a screen resolution of 72 dpi"); |
| 183 |
first_call = FALSE; |
| 184 |
} |
| 185 |
|
| 186 |
_gdk_display->layer->GetConfiguration (_gdk_display->layer, &dlc); |
| 187 |
|
| 188 |
return (dlc.width * 254) / 720; |
| 189 |
} |
| 190 |
|
| 191 |
gint |
| 192 |
gdk_screen_get_height_mm (GdkScreen *screen) |
| 193 |
{ |
| 194 |
static gboolean first_call = TRUE; |
| 195 |
DFBDisplayLayerConfig dlc; |
| 196 |
|
| 197 |
if (first_call) |
| 198 |
{ |
| 199 |
g_message |
| 200 |
("gdk_screen_height_mm() assumes a screen resolution of 72 dpi"); |
| 201 |
first_call = FALSE; |
| 202 |
} |
| 203 |
|
| 204 |
_gdk_display->layer->GetConfiguration (_gdk_display->layer, &dlc); |
| 205 |
|
| 206 |
return (dlc.height * 254) / 720; |
| 207 |
} |
| 208 |
|
| 209 |
GdkVisual * |
| 210 |
gdk_screen_get_rgba_visual (GdkScreen *screen) |
| 211 |
{ |
| 212 |
static GdkVisual *rgba_visual; |
| 213 |
|
| 214 |
if (!rgba_visual) |
| 215 |
rgba_visual = gdk_directfb_visual_by_format (DSPF_ARGB); |
| 216 |
|
| 217 |
return rgba_visual; |
| 218 |
} |
| 219 |
|
| 220 |
GdkColormap * |
| 221 |
gdk_screen_get_rgba_colormap (GdkScreen *screen) |
| 222 |
{ |
| 223 |
static GdkColormap *rgba_colormap; |
| 224 |
if (!rgba_colormap && gdk_screen_get_rgba_visual (screen)) |
| 225 |
rgba_colormap = gdk_colormap_new (gdk_screen_get_rgba_visual (screen), FALSE); |
| 226 |
return rgba_colormap; |
| 227 |
} |
| 228 |
|
| 229 |
GdkWindow * |
| 230 |
gdk_screen_get_active_window (GdkScreen *screen) |
| 231 |
{ |
| 232 |
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); |
| 233 |
|
| 234 |
return NULL; |
| 235 |
} |
| 236 |
|
| 237 |
GList * |
| 238 |
gdk_screen_get_window_stack (GdkScreen *screen) |
| 239 |
{ |
| 240 |
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); |
| 241 |
|
| 242 |
return NULL; |
| 243 |
} |
| 244 |
|
| 245 |
gboolean |
| 246 |
gdk_screen_is_composited (GdkScreen *screen) |
| 247 |
{ |
| 248 |
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); |
| 249 |
|
| 250 |
return FALSE; |
| 251 |
} |
| 252 |
|
| 253 |
#define __GDK_SCREEN_X11_C__ |
| 254 |
#include "gdkaliasdef.c" |