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