]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/settings.cpp
corrected off by 1 error in cMB2WC() call (thanks valgrind)
[wxWidgets.git] / src / gtk / settings.cpp
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
e7c80f9e 2// Name: src/gtk/settings.cpp
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
9b0b5ba7 5// Modified by: Mart Raudsepp (GetMetric)
f96aa4d9
RR
6// Id: $Id$
7// Copyright: (c) 1998 Robert Roebling
65571936 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
14f355c2
VS
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
c801d85f 14#include "wx/settings.h"
e7c80f9e 15
ce5d92e1
WS
16#ifndef WX_PRECOMP
17 #include "wx/cmndata.h"
1832043f 18 #include "wx/toplevel.h"
ce5d92e1
WS
19#endif
20
2b5f62a0 21#include "wx/fontutil.h"
d06b34a7 22
b0ae510a
PC
23#include <gtk/gtkversion.h>
24#if GTK_CHECK_VERSION(2, 9, 0)
25 // gtk_object_sink
26 #undef GTK_DISABLE_DEPRECATED
1efb5db8 27#endif
aed8ac3f 28#include <gtk/gtk.h>
b0ae510a 29#include <gdk/gdkx.h>
83624f79 30
9b0b5ba7
RR
31#include <X11/Xatom.h>
32
0ab5e0e8 33// ----------------------------------------------------------------------------
94a09ea5 34// wxSystemObjects
0ab5e0e8
VS
35// ----------------------------------------------------------------------------
36
94a09ea5 37struct wxSystemObjects
1ecc4d80 38{
c1ef87c3
VZ
39 wxColour m_colBtnFace,
40 m_colBtnShadow,
41 m_colBtnHighlight,
42 m_colHighlight,
43 m_colHighlightText,
44 m_colListBox,
9d6a9fdd 45 m_colBtnText,
c05cc2c7
RR
46 m_colMenuItemHighlight,
47 m_colTooltip,
48 m_colTooltipText;
c1ef87c3
VZ
49
50 wxFont m_fontSystem;
0ab5e0e8
VS
51};
52
94a09ea5 53static wxSystemObjects gs_objects;
c1ef87c3 54
0ab5e0e8
VS
55// ----------------------------------------------------------------------------
56// wxSystemSettings implementation
57// ----------------------------------------------------------------------------
a3622daa 58
643ccf62 59// kind of widget to use in GetColourFromGTKWidget
dbcbe229 60enum wxGtkWidgetType
643ccf62 61{
dbcbe229 62 wxGTK_BUTTON,
9d6a9fdd
RR
63 wxGTK_LIST,
64 wxGTK_MENUITEM
dbcbe229
VZ
65};
66
67// the colour we need
68enum wxGtkColourType
69{
70 wxGTK_FG,
71 wxGTK_BG,
72 wxGTK_BASE
643ccf62
VZ
73};
74
984152a6 75// wxSystemSettings::GetColour() helper: get the colours from a GTK+
b0ae510a
PC
76// widget style, return true if we did get them
77static bool GetColourFromGTKWidget(GdkColor& gdkColor,
dbcbe229
VZ
78 wxGtkWidgetType type = wxGTK_BUTTON,
79 GtkStateType state = GTK_STATE_NORMAL,
80 wxGtkColourType colour = wxGTK_BG)
643ccf62 81{
dbcbe229
VZ
82 GtkWidget *widget;
83 switch ( type )
84 {
85 default:
86 wxFAIL_MSG( _T("unexpected GTK widget type") );
87 // fall through
88
89 case wxGTK_BUTTON:
90 widget = gtk_button_new();
91 break;
92
93 case wxGTK_LIST:
b0ae510a
PC
94 widget = gtk_tree_view_new_with_model(
95 (GtkTreeModel*)gtk_list_store_new(1, G_TYPE_INT));
e24b680c
VZ
96 break;
97
9d6a9fdd
RR
98 case wxGTK_MENUITEM:
99 widget = gtk_menu_item_new();
dbcbe229
VZ
100 }
101
643ccf62
VZ
102 GtkStyle *def = gtk_rc_get_style( widget );
103 if ( !def )
104 def = gtk_widget_get_default_style();
105
b0ae510a
PC
106 const bool ok = def != NULL;
107 if (ok)
643ccf62 108 {
dbcbe229
VZ
109 switch ( colour )
110 {
111 default:
112 wxFAIL_MSG( _T("unexpected GTK colour type") );
113 // fall through
114
115 case wxGTK_FG:
b0ae510a 116 gdkColor = def->fg[state];
dbcbe229
VZ
117 break;
118
119 case wxGTK_BG:
b0ae510a 120 gdkColor = def->bg[state];
dbcbe229
VZ
121 break;
122
123 case wxGTK_BASE:
b0ae510a 124 gdkColor = def->base[state];
dbcbe229
VZ
125 break;
126 }
643ccf62
VZ
127 }
128
dd2422b3 129 gtk_object_sink((GtkObject*)widget);
643ccf62
VZ
130
131 return ok;
132}
133
c05cc2c7
RR
134static void GetTooltipColors()
135{
136 GtkTooltips* tooltips = gtk_tooltips_new();
137 gtk_tooltips_force_window(tooltips);
138 gtk_widget_ensure_style(tooltips->tip_window);
139 GdkColor c = tooltips->tip_window->style->bg[GTK_STATE_NORMAL];
b0ae510a 140 gs_objects.m_colTooltip = wxColor(c);
c05cc2c7 141 c = tooltips->tip_window->style->fg[GTK_STATE_NORMAL];
b0ae510a 142 gs_objects.m_colTooltipText = wxColor(c);
dd2422b3 143 gtk_object_sink((GtkObject*)tooltips);
c05cc2c7
RR
144}
145
0ab5e0e8 146wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
c801d85f 147{
b0ae510a
PC
148 wxColor color;
149 GdkColor gdkColor;
db434467 150 switch (index)
c801d85f 151 {
db434467
RR
152 case wxSYS_COLOUR_SCROLLBAR:
153 case wxSYS_COLOUR_BACKGROUND:
db434467
RR
154 case wxSYS_COLOUR_INACTIVECAPTION:
155 case wxSYS_COLOUR_MENU:
156 case wxSYS_COLOUR_WINDOWFRAME:
157 case wxSYS_COLOUR_ACTIVEBORDER:
158 case wxSYS_COLOUR_INACTIVEBORDER:
159 case wxSYS_COLOUR_BTNFACE:
221ed576 160 case wxSYS_COLOUR_MENUBAR:
5b211fbf 161 case wxSYS_COLOUR_3DLIGHT:
94a09ea5 162 if (!gs_objects.m_colBtnFace.Ok())
37d403aa 163 {
b0ae510a
PC
164 gdkColor.red =
165 gdkColor.green = 0;
166 gdkColor.blue = 0x9c40;
167 GetColourFromGTKWidget(gdkColor);
168 gs_objects.m_colBtnFace = wxColor(gdkColor);
37d403aa 169 }
b0ae510a
PC
170 color = gs_objects.m_colBtnFace;
171 break;
643ccf62 172
db434467 173 case wxSYS_COLOUR_WINDOW:
b0ae510a
PC
174 color = *wxWHITE;
175 break;
643ccf62 176
37d403aa 177 case wxSYS_COLOUR_3DDKSHADOW:
b0ae510a
PC
178 color = *wxBLACK;
179 break;
643ccf62 180
db434467
RR
181 case wxSYS_COLOUR_GRAYTEXT:
182 case wxSYS_COLOUR_BTNSHADOW:
37d403aa 183 //case wxSYS_COLOUR_3DSHADOW:
94a09ea5 184 if (!gs_objects.m_colBtnShadow.Ok())
37d403aa 185 {
984152a6 186 wxColour faceColour(GetColour(wxSYS_COLOUR_3DFACE));
94a09ea5 187 gs_objects.m_colBtnShadow =
b0ae510a
PC
188 wxColour((unsigned char) (faceColour.Red() * 2 / 3),
189 (unsigned char) (faceColour.Green() * 2 / 3),
190 (unsigned char) (faceColour.Blue() * 2 / 3));
db434467 191 }
b0ae510a
PC
192 color = gs_objects.m_colBtnShadow;
193 break;
643ccf62 194
37d403aa
JS
195 case wxSYS_COLOUR_3DHIGHLIGHT:
196 //case wxSYS_COLOUR_BTNHIGHLIGHT:
b0ae510a
PC
197 color = *wxWHITE;
198 break;
643ccf62 199
db434467 200 case wxSYS_COLOUR_HIGHLIGHT:
94a09ea5 201 if (!gs_objects.m_colHighlight.Ok())
db434467 202 {
b0ae510a
PC
203 gdkColor.red =
204 gdkColor.green = 0;
205 gdkColor.blue = 0x9c40;
206 GetColourFromGTKWidget(
207 gdkColor, wxGTK_BUTTON, GTK_STATE_SELECTED);
208 gs_objects.m_colHighlight = wxColour(gdkColor);
db434467 209 }
b0ae510a
PC
210 color = gs_objects.m_colHighlight;
211 break;
643ccf62 212
74f55195 213 case wxSYS_COLOUR_LISTBOX:
94a09ea5 214 if (!gs_objects.m_colListBox.Ok())
74f55195 215 {
b0ae510a 216 if ( GetColourFromGTKWidget(gdkColor,
dbcbe229
VZ
217 wxGTK_LIST,
218 GTK_STATE_NORMAL,
219 wxGTK_BASE) )
74f55195 220 {
b0ae510a 221 gs_objects.m_colListBox = wxColour(gdkColor);
74f55195
VS
222 }
223 else
643ccf62 224 {
b0ae510a 225 gs_objects.m_colListBox = *wxWHITE;
643ccf62 226 }
74f55195 227 }
b0ae510a
PC
228 color = gs_objects.m_colListBox;
229 break;
643ccf62
VZ
230
231 case wxSYS_COLOUR_MENUTEXT:
232 case wxSYS_COLOUR_WINDOWTEXT:
233 case wxSYS_COLOUR_CAPTIONTEXT:
234 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
235 case wxSYS_COLOUR_BTNTEXT:
94a09ea5 236 if (!gs_objects.m_colBtnText.Ok())
37d403aa 237 {
b0ae510a
PC
238 gdkColor.red =
239 gdkColor.green =
240 gdkColor.blue = 0;
241 GetColourFromGTKWidget(
242 gdkColor, wxGTK_BUTTON, GTK_STATE_NORMAL, wxGTK_FG);
243 gs_objects.m_colBtnText = wxColour(gdkColor);
37d403aa 244 }
b0ae510a
PC
245 color = gs_objects.m_colBtnText;
246 break;
643ccf62 247
17d61cbf 248 case wxSYS_COLOUR_INFOBK:
c05cc2c7
RR
249 if (!gs_objects.m_colTooltip.Ok()) {
250 GetTooltipColors();
251 }
b0ae510a
PC
252 color = gs_objects.m_colTooltip;
253 break;
c05cc2c7
RR
254
255 case wxSYS_COLOUR_INFOTEXT:
256 if (!gs_objects.m_colTooltipText.Ok()) {
257 GetTooltipColors();
258 }
b0ae510a
PC
259 color = gs_objects.m_colTooltipText;
260 break;
17d61cbf 261
643ccf62 262 case wxSYS_COLOUR_HIGHLIGHTTEXT:
94a09ea5 263 if (!gs_objects.m_colHighlightText.Ok())
643ccf62 264 {
984152a6 265 wxColour hclr = GetColour(wxSYS_COLOUR_HIGHLIGHT);
643ccf62 266 if (hclr.Red() > 200 && hclr.Green() > 200 && hclr.Blue() > 200)
b0ae510a 267 gs_objects.m_colHighlightText = *wxBLACK;
643ccf62 268 else
b0ae510a 269 gs_objects.m_colHighlightText = *wxWHITE;
643ccf62 270 }
b0ae510a
PC
271 color = gs_objects.m_colHighlightText;
272 break;
643ccf62 273
643ccf62 274 case wxSYS_COLOUR_APPWORKSPACE:
b0ae510a
PC
275 color = *wxWHITE; // ?
276 break;
221ed576 277
9d6a9fdd
RR
278 case wxSYS_COLOUR_ACTIVECAPTION:
279 case wxSYS_COLOUR_MENUHILIGHT:
280 if (!gs_objects.m_colMenuItemHighlight.Ok())
281 {
b0ae510a
PC
282 gdkColor.red =
283 gdkColor.green =
284 gdkColor.blue = 0;
285 GetColourFromGTKWidget(
286 gdkColor, wxGTK_MENUITEM, GTK_STATE_SELECTED, wxGTK_BG);
287 gs_objects.m_colMenuItemHighlight = wxColour(gdkColor);
9d6a9fdd 288 }
b0ae510a
PC
289 color = gs_objects.m_colMenuItemHighlight;
290 break;
9d6a9fdd 291
221ed576
VZ
292 case wxSYS_COLOUR_HOTLIGHT:
293 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
294 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
221ed576 295 // TODO
b0ae510a
PC
296 color = *wxBLACK;
297 break;
221ed576
VZ
298
299 case wxSYS_COLOUR_MAX:
300 default:
301 wxFAIL_MSG( _T("unknown system colour index") );
b0ae510a
PC
302 color = *wxWHITE;
303 break;
e24b680c 304 }
643ccf62 305
b0ae510a 306 return color;
ff7b1510 307}
c801d85f 308
0ab5e0e8 309wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
c801d85f 310{
b0ae510a 311 wxFont font;
2d17d68f 312 switch (index)
c801d85f 313 {
2d17d68f
RR
314 case wxSYS_OEM_FIXED_FONT:
315 case wxSYS_ANSI_FIXED_FONT:
316 case wxSYS_SYSTEM_FIXED_FONT:
b0ae510a
PC
317 font = *wxNORMAL_FONT;
318 break;
319
2d17d68f
RR
320 case wxSYS_ANSI_VAR_FONT:
321 case wxSYS_SYSTEM_FONT:
322 case wxSYS_DEVICE_DEFAULT_FONT:
323 case wxSYS_DEFAULT_GUI_FONT:
94a09ea5 324 if (!gs_objects.m_fontSystem.Ok())
d06b34a7 325 {
e7370dac
VS
326 GtkWidget *widget = gtk_button_new();
327 GtkStyle *def = gtk_rc_get_style( widget );
2269ff56 328 if ( !def || !def->font_desc )
17a1ebd1 329 def = gtk_widget_get_default_style();
2269ff56 330 if ( def && def->font_desc )
17a1ebd1
VZ
331 {
332 wxNativeFontInfo info;
333 info.description =
fdf7514a 334 pango_font_description_copy(def->font_desc);
17a1ebd1
VZ
335 gs_objects.m_fontSystem = wxFont(info);
336 }
337 else
338 {
119cd341
RR
339 GtkSettings *settings = gtk_settings_get_default();
340 gchar *font_name = NULL;
341 g_object_get ( settings,
17a1ebd1 342 "gtk-font-name",
119cd341
RR
343 &font_name,
344 NULL);
345 if (!font_name)
346 gs_objects.m_fontSystem = wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
347 else
348 gs_objects.m_fontSystem = wxFont(wxString::FromAscii(font_name));
349 g_free (font_name);
17a1ebd1 350 }
dd2422b3 351 gtk_object_sink((GtkObject*)widget);
d06b34a7 352 }
b0ae510a
PC
353 font = gs_objects.m_fontSystem;
354 break;
c801d85f 355
0ab5e0e8 356 default:
b0ae510a 357 break;
0ab5e0e8 358 }
b0ae510a 359 return font;
c801d85f 360}
c801d85f 361
b0ae510a 362static bool wxXGetWindowProperty(GdkWindow* window, Atom& type, int& format, gulong& nitems, guchar*& data)
c801d85f 363{
5ac8ce9e 364 bool success = false;
b0ae510a
PC
365#if GTK_CHECK_VERSION(2, 2, 0)
366 if (gtk_check_version(2, 2, 0) == NULL)
367 {
368 gulong bytes_after;
369 success = XGetWindowProperty(
370 GDK_DISPLAY_XDISPLAY(gdk_drawable_get_display(window)),
371 GDK_WINDOW_XWINDOW(window),
372 gdk_x11_get_xatom_by_name_for_display(
373 gdk_drawable_get_display(window),
374 "_NET_FRAME_EXTENTS"),
375 0, // left, right, top, bottom, CARDINAL[4]/32
376 G_MAXLONG, // size of long
377 false, // do not delete property
378 XA_CARDINAL, // 32 bit
379 &type, &format, &nitems, &bytes_after, &data
380 ) == Success;
381 }
382#endif
383 return success;
384}
17a1ebd1 385
b0ae510a
PC
386int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
387{
9b0b5ba7 388 guchar *data = NULL;
b0ae510a
PC
389 Atom type;
390 int format;
391 gulong nitems;
9b0b5ba7
RR
392 GdkWindow *window = NULL;
393 if(win && GTK_WIDGET_REALIZED(win->GetHandle()))
394 window = win->GetHandle()->window;
9b0b5ba7 395
1ecc4d80
RR
396 switch (index)
397 {
9b0b5ba7
RR
398 case wxSYS_BORDER_X:
399 case wxSYS_BORDER_Y:
400 case wxSYS_EDGE_X:
401 case wxSYS_EDGE_Y:
402 case wxSYS_FRAMESIZE_X:
403 case wxSYS_FRAMESIZE_Y:
404 // If a window is specified/realized, and it is a toplevel window, we can query from wm.
405 // The returned border thickness is outside the client area in that case.
406 if (window)
407 {
408 wxTopLevelWindow *tlw = wxDynamicCast(win, wxTopLevelWindow);
409 if (!tlw)
410 return -1; // not a tlw, not sure how to approach
411 else
412 {
413 // Check if wm supports frame extents - we can't know
414 // the border widths if it does not.
415#if GTK_CHECK_VERSION(2,2,0)
416 if (!gtk_check_version(2,2,0))
417 {
418 if (!gdk_x11_screen_supports_net_wm_hint(
419 gdk_drawable_get_screen(window),
420 gdk_atom_intern("_NET_FRAME_EXTENTS", false) ) )
421 return -1;
422 }
423 else
424#endif
425 {
426 if (!gdk_net_wm_supports(gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
427 return -1;
428 }
17a1ebd1 429
9b0b5ba7
RR
430 // Get the frame extents from the windowmanager.
431 // In most cases the top extent is the titlebar, so we use the bottom extent
432 // for the heights.
b0ae510a 433 if (wxXGetWindowProperty(window, type, format, nitems, data))
9b0b5ba7
RR
434 {
435 int border_return = -1;
436
437 if ((type == XA_CARDINAL) && (format == 32) && (nitems >= 4) && (data))
438 {
9b0b5ba7
RR
439 switch(index)
440 {
441 case wxSYS_BORDER_X:
442 case wxSYS_EDGE_X:
443 case wxSYS_FRAMESIZE_X:
b0ae510a 444 border_return = int(data[1]); // width of right extent
9b0b5ba7
RR
445 break;
446 default:
b0ae510a 447 border_return = int(data[3]); // height of bottom extent
9b0b5ba7
RR
448 break;
449 }
450 }
451
452 if (data)
453 XFree(data);
454
455 return border_return;
456 }
457 }
458 }
459
460 return -1; // no window specified
461
462 case wxSYS_CURSOR_X:
463 case wxSYS_CURSOR_Y:
464#ifdef __WXGTK24__
465 if (!gtk_check_version(2,4,0))
466 {
467 if (window)
468 return gdk_display_get_default_cursor_size(gdk_drawable_get_display(window));
469 else
470 return gdk_display_get_default_cursor_size(gdk_display_get_default());
471 }
472 else
473#endif
474 return 16;
17d61cbf 475
44fd6f72
VS
476 case wxSYS_DCLICK_X:
477 case wxSYS_DCLICK_Y:
478 gint dclick_distance;
9b0b5ba7
RR
479#if GTK_CHECK_VERSION(2,2,0)
480 if (window && !gtk_check_version(2,2,0))
481 g_object_get(gtk_settings_get_for_screen(gdk_drawable_get_screen(window)),
482 "gtk-double-click-distance", &dclick_distance, NULL);
483 else
44fd6f72 484#endif
9b0b5ba7
RR
485 g_object_get(gtk_settings_get_default(),
486 "gtk-double-click-distance", &dclick_distance, NULL);
487
488 return dclick_distance * 2;
44fd6f72 489
44fd6f72
VS
490 case wxSYS_DRAG_X:
491 case wxSYS_DRAG_Y:
492 gint drag_threshold;
9b0b5ba7
RR
493#if GTK_CHECK_VERSION(2,2,0)
494 if (window && !gtk_check_version(2,2,0))
495 {
496 g_object_get(
497 gtk_settings_get_for_screen(gdk_drawable_get_screen(window)),
498 "gtk-dnd-drag-threshold",
499 &drag_threshold, NULL);
500 }
501 else
44fd6f72 502#endif
9b0b5ba7
RR
503 {
504 g_object_get(gtk_settings_get_default(),
505 "gtk-dnd-drag-threshold", &drag_threshold, NULL);
506 }
44fd6f72 507
9fcdfe05
RR
508 // The correct thing here would be to double the value
509 // since that is what the API wants. But the values
510 // are much bigger under GNOME than under Windows and
511 // just seem to much in many cases to be useful.
f4322df6 512 // drag_threshold *= 2;
9fcdfe05 513
1e7373d0 514 return drag_threshold;
9b0b5ba7 515
f618020a
MB
516 // MBN: ditto for icons
517 case wxSYS_ICON_X: return 32;
518 case wxSYS_ICON_Y: return 32;
9b0b5ba7
RR
519
520 case wxSYS_SCREEN_X:
afeb58f1 521#if GTK_CHECK_VERSION(2,2,0)
9b0b5ba7
RR
522 if (window && !gtk_check_version(2,2,0))
523 return gdk_screen_get_width(gdk_drawable_get_screen(window));
524 else
525#endif
526 return gdk_screen_width();
527
528 case wxSYS_SCREEN_Y:
afeb58f1 529#if GTK_CHECK_VERSION(2,2,0)
9b0b5ba7
RR
530 if (window && !gtk_check_version(2,2,0))
531 return gdk_screen_get_height(gdk_drawable_get_screen(window));
532 else
533#endif
534 return gdk_screen_height();
535
536 case wxSYS_HSCROLL_Y: return 15;
537 case wxSYS_VSCROLL_X: return 15;
538
9b0b5ba7
RR
539 case wxSYS_CAPTION_Y:
540 if (!window)
541 // No realized window specified, and no implementation for that case yet.
542 return -1;
543
544 // Check if wm supports frame extents - we can't know the caption height if it does not.
545#if GTK_CHECK_VERSION(2,2,0)
546 if (!gtk_check_version(2,2,0))
547 {
548 if (!gdk_x11_screen_supports_net_wm_hint(
549 gdk_drawable_get_screen(window),
550 gdk_atom_intern("_NET_FRAME_EXTENTS", false) ) )
551 return -1;
552 }
553 else
554#endif
555 {
556 if (!gdk_net_wm_supports(gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
557 return -1;
558 }
559
560 wxASSERT_MSG( wxDynamicCast(win, wxTopLevelWindow),
561 wxT("Asking for caption height of a non toplevel window") );
562
563 // Get the height of the top windowmanager border.
564 // This is the titlebar in most cases. The titlebar might be elsewhere, and
565 // we could check which is the thickest wm border to decide on which side the
566 // titlebar is, but this might lead to interesting behaviours in used code.
567 // Reconsider when we have a way to report to the user on which side it is.
b0ae510a 568 if (wxXGetWindowProperty(window, type, format, nitems, data))
9b0b5ba7
RR
569 {
570 int caption_height = -1;
571
572 if ((type == XA_CARDINAL) && (format == 32) && (nitems >= 3) && (data))
573 {
b0ae510a 574 caption_height = int(data[2]); // top frame extent
9b0b5ba7
RR
575 }
576
577 if (data)
578 XFree(data);
579
580 return caption_height;
581 }
582
583 // Try a default approach without a window pointer, if possible
584 // ...
585
586 return -1;
9b0b5ba7
RR
587
588 case wxSYS_PENWINDOWS_PRESENT:
589 // No MS Windows for Pen computing extension available in X11 based gtk+.
590 return 0;
591
592 default:
1d451c5b 593 return -1; // metric is unknown
1ecc4d80 594 }
c67daf87 595}
253293c1 596
0ab5e0e8 597bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
598{
599 switch (index)
600 {
17a1ebd1 601 case wxSYS_CAN_ICONIZE_FRAME:
e7c80f9e 602 return false;
17a1ebd1 603
253293c1 604 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
e7c80f9e 605 return true;
17a1ebd1 606
253293c1 607 default:
e7c80f9e 608 return false;
253293c1
VS
609 }
610}