~canonical-dx-team/ubuntu/maverick/gtk+2.0/menuproxy

« back to all changes in this revision

Viewing changes to gdk/linux-fb/gdkvisual-fb.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-05-04 12:24:25 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20070504122425-0m8midgzrp40y8w2
Tags: 2.10.12-1ubuntu1
* Sync with Debian
* New upstream version:
  Fixed bugs:
  - 379414 file chooser warnings when changing path in the entry
  - 418585 GtkFileChooserDefault sizing code is not DPI independent
  - 419568 Crash in search if start with special letter
  - 435062 build dies with icon cache validation
  - 379399 Segfault to call gtk_print_operation_run twice.
  - 387889 cups backend has problems when there are too many printers
  - 418531 invalid read to gtkicontheme.c gtk_icon_theme_lookup_icon...
  - 423916 crash in color scheme code
  - 424042 Segmentation fault while quickly pressing Alt+arrows
  - 415260 Protect against negative indices when setting values in G...
  - 419171 XGetVisualInfo() may not set nxvisuals
  - 128852 Gdk cursors don't look good on win32
  - 344657 Ctrl-H doesn't toggle "Show Hidden Files" setting
  - 345345 PrintOperation::paginate is not emitted for class handler
  - 347567 GtkPrintOperation::end-print is not emitted if it's cance...
  - 369112 gtk_ui_manager_add_ui should accept unnamed separator
  - 392015 Selected menu item invisible on Windows Vista
  - 399253 MS-Windows Theme Bottom Tab placement rendering glitches
  - 399425 gtk_input_dialog_fill_axes() adds child to gtkscrolledwin...
  - 403251 [patch] little memory leak in GtkPrintJob
  - 403267 [patch] memory leak in GtkPageSetupUnixDialog
  - 403470 MS-Windows Theme tab placement other than on top leaks a ...
  - 404506 Windows system fonts that have multi-byte font names cann...
  - 405089 Incorrect window placement for GtkEventBox private window
  - 405515 Minor leak in gtkfilesystemmodel.c
  - 405539 gdk_pixbuf_save() for PNG saver can return FALSE without ...
  - 415681 gdk_window_clear_area includes an extra line and column o...
  - 418219 GtkRecentChooser should apply filter before sorting and c...
  - 418403 Scroll to printer after selecting it from settings
  - 421985 _gtk_print_operation_platform_backend_launch_preview
  - 421990 gtk_print_job_get_surface
  - 421993 gtk_print_operation_init
  - 423064 Conditional jump or move depends on uninitialised value(s...
  - 423722 Fix printing header in gtk-demo
  - 424168 gtk_print_operation_run on async preview
  - 425655 Don't install gtk+-unix-print-2.0.pc on non-UNIX platforms
  - 425786 GDK segfaults if XineramaQueryScreens fails
  - 428665 Lpr Backend gets stuck in infinite loop during gtk_enumer...
  - 429902 GtkPrintOperation leaks cairo contextes
  - 431997 First delay of GdkPixbufAnimationIter is wrong
  - 433242 Inconsistent scroll arrow position calculations
  - 433972 Placing gtk.Expander inside a gtk.TextView() changes gtk....
  - 434261 _gtk_toolbar_elide_underscores incorrectly handles some s...
  - 383354 ctrl-L should make 'Location' entry disappear
  - 418673 gtk_recent_manager_add_item
  - 429732 gtk_accel_group_finalize accesses invalid memory
  - 435028 WM_CLIENT_LEADER is wrong on the leader_window
  - 431067 Background of the header window is not updated
  - 338843 add recent files support inside the ui manager
  - 148535 add drop shadow to menus, tooltips, etc. under Windows XP
* debian/control.in:
  - Conflicts on ubuntulooks (<= 0.9.11-1)
* debian/patches/15_default-fallback-icon-theme.patch:
  - patch from Debian, fallback on gnome icon theme

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GDK - The GIMP Drawing Kit
 
2
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with this library; if not, write to the
 
16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
/*
 
21
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
 
22
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 
23
 * files for a list of changes.  These files are distributed with
 
24
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
 
25
 */
 
26
 
 
27
#include <config.h>
 
28
#include "gdkvisual.h"
 
29
#include "gdkprivate-fb.h"
 
30
#include "gdkinternals.h"
 
31
#include <sys/ioctl.h>
 
32
 
 
33
static GdkVisual *system_visual = NULL;
 
34
 
 
35
static void
 
36
gdk_visual_finalize (GObject *object)
 
37
{
 
38
  g_error ("A GdkVisual object was finalized. This should not happen");
 
39
}
 
40
 
 
41
static void
 
42
gdk_visual_class_init (GObjectClass *class)
 
43
{
 
44
  class->finalize = gdk_visual_finalize;
 
45
}
 
46
 
 
47
 
 
48
GType
 
49
gdk_visual_get_type (void)
 
50
{
 
51
  static GType object_type = 0;
 
52
 
 
53
  if (!object_type)
 
54
    {
 
55
      static const GTypeInfo object_info =
 
56
      {
 
57
        sizeof (GdkVisualClass),
 
58
        (GBaseInitFunc) NULL,
 
59
        (GBaseFinalizeFunc) NULL,
 
60
        (GClassInitFunc) gdk_visual_class_init,
 
61
        NULL,           /* class_finalize */
 
62
        NULL,           /* class_data */
 
63
        sizeof (GdkVisual),
 
64
        0,              /* n_preallocs */
 
65
        (GInstanceInitFunc) NULL,
 
66
      };
 
67
      
 
68
      object_type = g_type_register_static (G_TYPE_OBJECT,
 
69
                                            "GdkVisual",
 
70
                                            &object_info, 0);
 
71
    }
 
72
  
 
73
  return object_type;
 
74
}
 
75
 
 
76
void
 
77
_gdk_visual_init (void)
 
78
{
 
79
  system_visual = g_object_new (GDK_TYPE_VISUAL, NULL);
 
80
 
 
81
  system_visual->depth = system_visual->bits_per_rgb = gdk_display->modeinfo.bits_per_pixel;
 
82
  system_visual->byte_order = GDK_LSB_FIRST;
 
83
  system_visual->colormap_size = 0;
 
84
 
 
85
  switch (gdk_display->sinfo.visual)
 
86
    {
 
87
    case FB_VISUAL_PSEUDOCOLOR:
 
88
      system_visual->colormap_size = 1 << gdk_display->modeinfo.bits_per_pixel;
 
89
      system_visual->type = GDK_VISUAL_PSEUDO_COLOR;
 
90
      break;
 
91
    case FB_VISUAL_DIRECTCOLOR:
 
92
    case FB_VISUAL_TRUECOLOR:
 
93
      system_visual->type = GDK_VISUAL_TRUE_COLOR;
 
94
 
 
95
      system_visual->red_prec = gdk_display->modeinfo.red.length;
 
96
      system_visual->red_shift = gdk_display->modeinfo.red.offset;
 
97
      system_visual->red_mask = ((1 << (system_visual->red_prec)) - 1) << system_visual->red_shift;
 
98
 
 
99
      system_visual->green_prec = gdk_display->modeinfo.green.length;
 
100
      system_visual->green_shift = gdk_display->modeinfo.green.offset;
 
101
      system_visual->green_mask = ((1 << (system_visual->green_prec)) - 1) << system_visual->green_shift;
 
102
 
 
103
      system_visual->blue_prec = gdk_display->modeinfo.blue.length;
 
104
      system_visual->blue_shift = gdk_display->modeinfo.blue.offset;
 
105
      system_visual->blue_mask = ((1 << (system_visual->blue_prec)) - 1) << system_visual->blue_shift;
 
106
 
 
107
      if (gdk_display->sinfo.visual == FB_VISUAL_DIRECTCOLOR) 
 
108
        {
 
109
          guint16 red[256], green[256], blue[256];
 
110
          struct fb_cmap fbc = {0,0};
 
111
          int size, i;
 
112
          /* Load the colormap to ramps here, as they might be initialized to
 
113
             some other garbage */
 
114
          
 
115
          g_warning ("Directcolor visual, not very well tested\n");
 
116
          fbc.red = red;
 
117
          fbc.green = green;
 
118
          fbc.blue = blue;
 
119
          
 
120
          size = 1 << system_visual->red_prec;
 
121
          for (i = 0; i < size; i++)
 
122
            red[i] = i * 65535 / (size - 1);
 
123
          
 
124
          size = 1 << system_visual->green_prec;
 
125
          fbc.len = size;
 
126
          for (i = 0; i < size; i++)
 
127
            green[i] = i * 65535 / (size - 1);
 
128
          
 
129
          size = 1 << system_visual->blue_prec;
 
130
          for (i = 0; i < size; i++)
 
131
            blue[i] = i * 65535 / (size - 1);
 
132
          
 
133
          ioctl (gdk_display->fb_fd, FBIOPUTCMAP, &fbc);
 
134
        }
 
135
      break;
 
136
    case FB_VISUAL_STATIC_PSEUDOCOLOR:
 
137
      system_visual->type = GDK_VISUAL_STATIC_COLOR;
 
138
      system_visual->colormap_size = 1 << gdk_display->modeinfo.bits_per_pixel;
 
139
      break;
 
140
    default:
 
141
      g_assert_not_reached ();
 
142
      break;
 
143
    }
 
144
}
 
145
 
 
146
gint
 
147
gdk_visual_get_best_depth (void)
 
148
{
 
149
  return system_visual->depth;
 
150
}
 
151
 
 
152
GdkVisualType
 
153
gdk_visual_get_best_type (void)
 
154
{
 
155
  return system_visual->type;
 
156
}
 
157
 
 
158
GdkVisual*
 
159
gdk_screen_get_system_visual (GdkScreen *screen)
 
160
{
 
161
  return system_visual;
 
162
}
 
163
 
 
164
GdkVisual*
 
165
gdk_visual_get_best (void)
 
166
{
 
167
  return system_visual;
 
168
}
 
169
 
 
170
GdkVisual*
 
171
gdk_visual_get_best_with_depth (gint depth)
 
172
{
 
173
  if (system_visual->depth != depth)
 
174
    return NULL;
 
175
 
 
176
  return system_visual;
 
177
}
 
178
 
 
179
GdkVisual*
 
180
gdk_visual_get_best_with_type (GdkVisualType visual_type)
 
181
{
 
182
  if (system_visual->type != visual_type)
 
183
    return NULL;
 
184
 
 
185
  return system_visual;
 
186
}
 
187
 
 
188
GdkVisual*
 
189
gdk_visual_get_best_with_both (gint          depth,
 
190
                               GdkVisualType visual_type)
 
191
{
 
192
  if (system_visual->depth != depth)
 
193
    return NULL;
 
194
 
 
195
  if (system_visual->type != visual_type)
 
196
    return NULL;
 
197
 
 
198
  return system_visual;
 
199
}
 
200
 
 
201
void
 
202
gdk_query_depths  (gint **depths,
 
203
                   gint  *count)
 
204
{
 
205
  *count = 1;
 
206
  *depths = &system_visual->depth;
 
207
}
 
208
 
 
209
void
 
210
gdk_query_visual_types (GdkVisualType **visual_types,
 
211
                        gint           *count)
 
212
{
 
213
  *count = 1;
 
214
  *visual_types = &system_visual->type;
 
215
}
 
216
 
 
217
GList*
 
218
gdk_screen_list_visuals (GdkScreen *screen)
 
219
{
 
220
  return g_list_append (NULL, gdk_visual_get_system ());
 
221
}
 
222
 
 
223
GdkScreen *
 
224
gdk_visual_get_screen (GdkVisual *visual)
 
225
{
 
226
  g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL);
 
227
 
 
228
  return gdk_screen_get_default ();
 
229
}