]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/settings.cpp
document CreateConfig() (extended patch 1739374)
[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
129 gtk_widget_destroy( widget );
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
PC
142 gs_objects.m_colTooltipText = wxColor(c);
143#if GTK_CHECK_VERSION(2, 9, 0)
144 if (gtk_check_version(2, 9, 0) == NULL)
145 g_object_ref_sink(tooltips);
146 else
147#endif
148 {
149 gtk_object_sink((GtkObject*)tooltips);
150 }
c05cc2c7
RR
151}
152
0ab5e0e8 153wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
c801d85f 154{
b0ae510a
PC
155 wxColor color;
156 GdkColor gdkColor;
db434467 157 switch (index)
c801d85f 158 {
db434467
RR
159 case wxSYS_COLOUR_SCROLLBAR:
160 case wxSYS_COLOUR_BACKGROUND:
db434467
RR
161 case wxSYS_COLOUR_INACTIVECAPTION:
162 case wxSYS_COLOUR_MENU:
163 case wxSYS_COLOUR_WINDOWFRAME:
164 case wxSYS_COLOUR_ACTIVEBORDER:
165 case wxSYS_COLOUR_INACTIVEBORDER:
166 case wxSYS_COLOUR_BTNFACE:
221ed576 167 case wxSYS_COLOUR_MENUBAR:
5b211fbf 168 case wxSYS_COLOUR_3DLIGHT:
94a09ea5 169 if (!gs_objects.m_colBtnFace.Ok())
37d403aa 170 {
b0ae510a
PC
171 gdkColor.red =
172 gdkColor.green = 0;
173 gdkColor.blue = 0x9c40;
174 GetColourFromGTKWidget(gdkColor);
175 gs_objects.m_colBtnFace = wxColor(gdkColor);
37d403aa 176 }
b0ae510a
PC
177 color = gs_objects.m_colBtnFace;
178 break;
643ccf62 179
db434467 180 case wxSYS_COLOUR_WINDOW:
b0ae510a
PC
181 color = *wxWHITE;
182 break;
643ccf62 183
37d403aa 184 case wxSYS_COLOUR_3DDKSHADOW:
b0ae510a
PC
185 color = *wxBLACK;
186 break;
643ccf62 187
db434467
RR
188 case wxSYS_COLOUR_GRAYTEXT:
189 case wxSYS_COLOUR_BTNSHADOW:
37d403aa 190 //case wxSYS_COLOUR_3DSHADOW:
94a09ea5 191 if (!gs_objects.m_colBtnShadow.Ok())
37d403aa 192 {
984152a6 193 wxColour faceColour(GetColour(wxSYS_COLOUR_3DFACE));
94a09ea5 194 gs_objects.m_colBtnShadow =
b0ae510a
PC
195 wxColour((unsigned char) (faceColour.Red() * 2 / 3),
196 (unsigned char) (faceColour.Green() * 2 / 3),
197 (unsigned char) (faceColour.Blue() * 2 / 3));
db434467 198 }
b0ae510a
PC
199 color = gs_objects.m_colBtnShadow;
200 break;
643ccf62 201
37d403aa
JS
202 case wxSYS_COLOUR_3DHIGHLIGHT:
203 //case wxSYS_COLOUR_BTNHIGHLIGHT:
b0ae510a
PC
204 color = *wxWHITE;
205 break;
643ccf62 206
db434467 207 case wxSYS_COLOUR_HIGHLIGHT:
94a09ea5 208 if (!gs_objects.m_colHighlight.Ok())
db434467 209 {
b0ae510a
PC
210 gdkColor.red =
211 gdkColor.green = 0;
212 gdkColor.blue = 0x9c40;
213 GetColourFromGTKWidget(
214 gdkColor, wxGTK_BUTTON, GTK_STATE_SELECTED);
215 gs_objects.m_colHighlight = wxColour(gdkColor);
db434467 216 }
b0ae510a
PC
217 color = gs_objects.m_colHighlight;
218 break;
643ccf62 219
74f55195 220 case wxSYS_COLOUR_LISTBOX:
94a09ea5 221 if (!gs_objects.m_colListBox.Ok())
74f55195 222 {
b0ae510a 223 if ( GetColourFromGTKWidget(gdkColor,
dbcbe229
VZ
224 wxGTK_LIST,
225 GTK_STATE_NORMAL,
226 wxGTK_BASE) )
74f55195 227 {
b0ae510a 228 gs_objects.m_colListBox = wxColour(gdkColor);
74f55195
VS
229 }
230 else
643ccf62 231 {
b0ae510a 232 gs_objects.m_colListBox = *wxWHITE;
643ccf62 233 }
74f55195 234 }
b0ae510a
PC
235 color = gs_objects.m_colListBox;
236 break;
643ccf62
VZ
237
238 case wxSYS_COLOUR_MENUTEXT:
239 case wxSYS_COLOUR_WINDOWTEXT:
240 case wxSYS_COLOUR_CAPTIONTEXT:
241 case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
242 case wxSYS_COLOUR_BTNTEXT:
94a09ea5 243 if (!gs_objects.m_colBtnText.Ok())
37d403aa 244 {
b0ae510a
PC
245 gdkColor.red =
246 gdkColor.green =
247 gdkColor.blue = 0;
248 GetColourFromGTKWidget(
249 gdkColor, wxGTK_BUTTON, GTK_STATE_NORMAL, wxGTK_FG);
250 gs_objects.m_colBtnText = wxColour(gdkColor);
37d403aa 251 }
b0ae510a
PC
252 color = gs_objects.m_colBtnText;
253 break;
643ccf62 254
17d61cbf 255 case wxSYS_COLOUR_INFOBK:
c05cc2c7
RR
256 if (!gs_objects.m_colTooltip.Ok()) {
257 GetTooltipColors();
258 }
b0ae510a
PC
259 color = gs_objects.m_colTooltip;
260 break;
c05cc2c7
RR
261
262 case wxSYS_COLOUR_INFOTEXT:
263 if (!gs_objects.m_colTooltipText.Ok()) {
264 GetTooltipColors();
265 }
b0ae510a
PC
266 color = gs_objects.m_colTooltipText;
267 break;
17d61cbf 268
643ccf62 269 case wxSYS_COLOUR_HIGHLIGHTTEXT:
94a09ea5 270 if (!gs_objects.m_colHighlightText.Ok())
643ccf62 271 {
984152a6 272 wxColour hclr = GetColour(wxSYS_COLOUR_HIGHLIGHT);
643ccf62 273 if (hclr.Red() > 200 && hclr.Green() > 200 && hclr.Blue() > 200)
b0ae510a 274 gs_objects.m_colHighlightText = *wxBLACK;
643ccf62 275 else
b0ae510a 276 gs_objects.m_colHighlightText = *wxWHITE;
643ccf62 277 }
b0ae510a
PC
278 color = gs_objects.m_colHighlightText;
279 break;
643ccf62 280
643ccf62 281 case wxSYS_COLOUR_APPWORKSPACE:
b0ae510a
PC
282 color = *wxWHITE; // ?
283 break;
221ed576 284
9d6a9fdd
RR
285 case wxSYS_COLOUR_ACTIVECAPTION:
286 case wxSYS_COLOUR_MENUHILIGHT:
287 if (!gs_objects.m_colMenuItemHighlight.Ok())
288 {
b0ae510a
PC
289 gdkColor.red =
290 gdkColor.green =
291 gdkColor.blue = 0;
292 GetColourFromGTKWidget(
293 gdkColor, wxGTK_MENUITEM, GTK_STATE_SELECTED, wxGTK_BG);
294 gs_objects.m_colMenuItemHighlight = wxColour(gdkColor);
9d6a9fdd 295 }
b0ae510a
PC
296 color = gs_objects.m_colMenuItemHighlight;
297 break;
9d6a9fdd 298
221ed576
VZ
299 case wxSYS_COLOUR_HOTLIGHT:
300 case wxSYS_COLOUR_GRADIENTACTIVECAPTION:
301 case wxSYS_COLOUR_GRADIENTINACTIVECAPTION:
221ed576 302 // TODO
b0ae510a
PC
303 color = *wxBLACK;
304 break;
221ed576
VZ
305
306 case wxSYS_COLOUR_MAX:
307 default:
308 wxFAIL_MSG( _T("unknown system colour index") );
b0ae510a
PC
309 color = *wxWHITE;
310 break;
e24b680c 311 }
643ccf62 312
b0ae510a 313 return color;
ff7b1510 314}
c801d85f 315
0ab5e0e8 316wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
c801d85f 317{
b0ae510a 318 wxFont font;
2d17d68f 319 switch (index)
c801d85f 320 {
2d17d68f
RR
321 case wxSYS_OEM_FIXED_FONT:
322 case wxSYS_ANSI_FIXED_FONT:
323 case wxSYS_SYSTEM_FIXED_FONT:
b0ae510a
PC
324 font = *wxNORMAL_FONT;
325 break;
326
2d17d68f
RR
327 case wxSYS_ANSI_VAR_FONT:
328 case wxSYS_SYSTEM_FONT:
329 case wxSYS_DEVICE_DEFAULT_FONT:
330 case wxSYS_DEFAULT_GUI_FONT:
94a09ea5 331 if (!gs_objects.m_fontSystem.Ok())
d06b34a7 332 {
e7370dac
VS
333 GtkWidget *widget = gtk_button_new();
334 GtkStyle *def = gtk_rc_get_style( widget );
2269ff56 335 if ( !def || !def->font_desc )
17a1ebd1 336 def = gtk_widget_get_default_style();
2269ff56 337 if ( def && def->font_desc )
17a1ebd1
VZ
338 {
339 wxNativeFontInfo info;
340 info.description =
fdf7514a 341 pango_font_description_copy(def->font_desc);
17a1ebd1
VZ
342 gs_objects.m_fontSystem = wxFont(info);
343 }
344 else
345 {
119cd341
RR
346 GtkSettings *settings = gtk_settings_get_default();
347 gchar *font_name = NULL;
348 g_object_get ( settings,
17a1ebd1 349 "gtk-font-name",
119cd341
RR
350 &font_name,
351 NULL);
352 if (!font_name)
353 gs_objects.m_fontSystem = wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
354 else
355 gs_objects.m_fontSystem = wxFont(wxString::FromAscii(font_name));
356 g_free (font_name);
17a1ebd1 357 }
e7370dac 358 gtk_widget_destroy( widget );
d06b34a7 359 }
b0ae510a
PC
360 font = gs_objects.m_fontSystem;
361 break;
c801d85f 362
0ab5e0e8 363 default:
b0ae510a 364 break;
0ab5e0e8 365 }
b0ae510a 366 return font;
c801d85f 367}
c801d85f 368
b0ae510a 369static bool wxXGetWindowProperty(GdkWindow* window, Atom& type, int& format, gulong& nitems, guchar*& data)
c801d85f 370{
5ac8ce9e 371 bool success = false;
b0ae510a
PC
372#if GTK_CHECK_VERSION(2, 2, 0)
373 if (gtk_check_version(2, 2, 0) == NULL)
374 {
375 gulong bytes_after;
376 success = XGetWindowProperty(
377 GDK_DISPLAY_XDISPLAY(gdk_drawable_get_display(window)),
378 GDK_WINDOW_XWINDOW(window),
379 gdk_x11_get_xatom_by_name_for_display(
380 gdk_drawable_get_display(window),
381 "_NET_FRAME_EXTENTS"),
382 0, // left, right, top, bottom, CARDINAL[4]/32
383 G_MAXLONG, // size of long
384 false, // do not delete property
385 XA_CARDINAL, // 32 bit
386 &type, &format, &nitems, &bytes_after, &data
387 ) == Success;
388 }
389#endif
390 return success;
391}
17a1ebd1 392
b0ae510a
PC
393int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
394{
9b0b5ba7 395 guchar *data = NULL;
b0ae510a
PC
396 Atom type;
397 int format;
398 gulong nitems;
9b0b5ba7
RR
399 GdkWindow *window = NULL;
400 if(win && GTK_WIDGET_REALIZED(win->GetHandle()))
401 window = win->GetHandle()->window;
9b0b5ba7 402
1ecc4d80
RR
403 switch (index)
404 {
9b0b5ba7
RR
405 case wxSYS_BORDER_X:
406 case wxSYS_BORDER_Y:
407 case wxSYS_EDGE_X:
408 case wxSYS_EDGE_Y:
409 case wxSYS_FRAMESIZE_X:
410 case wxSYS_FRAMESIZE_Y:
411 // If a window is specified/realized, and it is a toplevel window, we can query from wm.
412 // The returned border thickness is outside the client area in that case.
413 if (window)
414 {
415 wxTopLevelWindow *tlw = wxDynamicCast(win, wxTopLevelWindow);
416 if (!tlw)
417 return -1; // not a tlw, not sure how to approach
418 else
419 {
420 // Check if wm supports frame extents - we can't know
421 // the border widths if it does not.
422#if GTK_CHECK_VERSION(2,2,0)
423 if (!gtk_check_version(2,2,0))
424 {
425 if (!gdk_x11_screen_supports_net_wm_hint(
426 gdk_drawable_get_screen(window),
427 gdk_atom_intern("_NET_FRAME_EXTENTS", false) ) )
428 return -1;
429 }
430 else
431#endif
432 {
433 if (!gdk_net_wm_supports(gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
434 return -1;
435 }
17a1ebd1 436
9b0b5ba7
RR
437 // Get the frame extents from the windowmanager.
438 // In most cases the top extent is the titlebar, so we use the bottom extent
439 // for the heights.
b0ae510a 440 if (wxXGetWindowProperty(window, type, format, nitems, data))
9b0b5ba7
RR
441 {
442 int border_return = -1;
443
444 if ((type == XA_CARDINAL) && (format == 32) && (nitems >= 4) && (data))
445 {
9b0b5ba7
RR
446 switch(index)
447 {
448 case wxSYS_BORDER_X:
449 case wxSYS_EDGE_X:
450 case wxSYS_FRAMESIZE_X:
b0ae510a 451 border_return = int(data[1]); // width of right extent
9b0b5ba7
RR
452 break;
453 default:
b0ae510a 454 border_return = int(data[3]); // height of bottom extent
9b0b5ba7
RR
455 break;
456 }
457 }
458
459 if (data)
460 XFree(data);
461
462 return border_return;
463 }
464 }
465 }
466
467 return -1; // no window specified
468
469 case wxSYS_CURSOR_X:
470 case wxSYS_CURSOR_Y:
471#ifdef __WXGTK24__
472 if (!gtk_check_version(2,4,0))
473 {
474 if (window)
475 return gdk_display_get_default_cursor_size(gdk_drawable_get_display(window));
476 else
477 return gdk_display_get_default_cursor_size(gdk_display_get_default());
478 }
479 else
480#endif
481 return 16;
17d61cbf 482
44fd6f72
VS
483 case wxSYS_DCLICK_X:
484 case wxSYS_DCLICK_Y:
485 gint dclick_distance;
9b0b5ba7
RR
486#if GTK_CHECK_VERSION(2,2,0)
487 if (window && !gtk_check_version(2,2,0))
488 g_object_get(gtk_settings_get_for_screen(gdk_drawable_get_screen(window)),
489 "gtk-double-click-distance", &dclick_distance, NULL);
490 else
44fd6f72 491#endif
9b0b5ba7
RR
492 g_object_get(gtk_settings_get_default(),
493 "gtk-double-click-distance", &dclick_distance, NULL);
494
495 return dclick_distance * 2;
44fd6f72 496
44fd6f72
VS
497 case wxSYS_DRAG_X:
498 case wxSYS_DRAG_Y:
499 gint drag_threshold;
9b0b5ba7
RR
500#if GTK_CHECK_VERSION(2,2,0)
501 if (window && !gtk_check_version(2,2,0))
502 {
503 g_object_get(
504 gtk_settings_get_for_screen(gdk_drawable_get_screen(window)),
505 "gtk-dnd-drag-threshold",
506 &drag_threshold, NULL);
507 }
508 else
44fd6f72 509#endif
9b0b5ba7
RR
510 {
511 g_object_get(gtk_settings_get_default(),
512 "gtk-dnd-drag-threshold", &drag_threshold, NULL);
513 }
44fd6f72 514
9fcdfe05
RR
515 // The correct thing here would be to double the value
516 // since that is what the API wants. But the values
517 // are much bigger under GNOME than under Windows and
518 // just seem to much in many cases to be useful.
f4322df6 519 // drag_threshold *= 2;
9fcdfe05 520
1e7373d0 521 return drag_threshold;
9b0b5ba7 522
f618020a
MB
523 // MBN: ditto for icons
524 case wxSYS_ICON_X: return 32;
525 case wxSYS_ICON_Y: return 32;
9b0b5ba7
RR
526
527 case wxSYS_SCREEN_X:
afeb58f1 528#if GTK_CHECK_VERSION(2,2,0)
9b0b5ba7
RR
529 if (window && !gtk_check_version(2,2,0))
530 return gdk_screen_get_width(gdk_drawable_get_screen(window));
531 else
532#endif
533 return gdk_screen_width();
534
535 case wxSYS_SCREEN_Y:
afeb58f1 536#if GTK_CHECK_VERSION(2,2,0)
9b0b5ba7
RR
537 if (window && !gtk_check_version(2,2,0))
538 return gdk_screen_get_height(gdk_drawable_get_screen(window));
539 else
540#endif
541 return gdk_screen_height();
542
543 case wxSYS_HSCROLL_Y: return 15;
544 case wxSYS_VSCROLL_X: return 15;
545
9b0b5ba7
RR
546 case wxSYS_CAPTION_Y:
547 if (!window)
548 // No realized window specified, and no implementation for that case yet.
549 return -1;
550
551 // Check if wm supports frame extents - we can't know the caption height if it does not.
552#if GTK_CHECK_VERSION(2,2,0)
553 if (!gtk_check_version(2,2,0))
554 {
555 if (!gdk_x11_screen_supports_net_wm_hint(
556 gdk_drawable_get_screen(window),
557 gdk_atom_intern("_NET_FRAME_EXTENTS", false) ) )
558 return -1;
559 }
560 else
561#endif
562 {
563 if (!gdk_net_wm_supports(gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
564 return -1;
565 }
566
567 wxASSERT_MSG( wxDynamicCast(win, wxTopLevelWindow),
568 wxT("Asking for caption height of a non toplevel window") );
569
570 // Get the height of the top windowmanager border.
571 // This is the titlebar in most cases. The titlebar might be elsewhere, and
572 // we could check which is the thickest wm border to decide on which side the
573 // titlebar is, but this might lead to interesting behaviours in used code.
574 // Reconsider when we have a way to report to the user on which side it is.
b0ae510a 575 if (wxXGetWindowProperty(window, type, format, nitems, data))
9b0b5ba7
RR
576 {
577 int caption_height = -1;
578
579 if ((type == XA_CARDINAL) && (format == 32) && (nitems >= 3) && (data))
580 {
b0ae510a 581 caption_height = int(data[2]); // top frame extent
9b0b5ba7
RR
582 }
583
584 if (data)
585 XFree(data);
586
587 return caption_height;
588 }
589
590 // Try a default approach without a window pointer, if possible
591 // ...
592
593 return -1;
9b0b5ba7
RR
594
595 case wxSYS_PENWINDOWS_PRESENT:
596 // No MS Windows for Pen computing extension available in X11 based gtk+.
597 return 0;
598
599 default:
1d451c5b 600 return -1; // metric is unknown
1ecc4d80 601 }
c67daf87 602}
253293c1 603
0ab5e0e8 604bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
253293c1
VS
605{
606 switch (index)
607 {
17a1ebd1 608 case wxSYS_CAN_ICONIZE_FRAME:
e7c80f9e 609 return false;
17a1ebd1 610
253293c1 611 case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
e7c80f9e 612 return true;
17a1ebd1 613
253293c1 614 default:
e7c80f9e 615 return false;
253293c1
VS
616 }
617}