#include "wx/settings.h"
#include "wx/log.h"
+#ifdef __WXDEBUG__
+ #include "wx/thread.h"
+#endif
+
#include <math.h>
-#include "gdk/gdk.h"
-#include "gtk/gtk.h"
-#include "gdk/gdkprivate.h"
-#include "gdk/gdkkeysyms.h"
-#include "wx/gtk/win_gtk.h"
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkkeysyms.h>
+#include <wx/gtk/win_gtk.h>
-#include "gdk/gdkx.h"
+#include <gdk/gdkx.h>
//-----------------------------------------------------------------------------
// documentation on internals
the last click here */
static guint32 gs_timeLastClick = 0;
+extern bool g_mainThreadLocked;
+
//-----------------------------------------------------------------------------
// debug
//-----------------------------------------------------------------------------
#ifdef __WXDEBUG__
+#if wxUSE_THREADS
+# define DEBUG_MAIN_THREAD if (wxThread::IsMain() && g_mainThreadLocked) printf("gui reentrance");
+#else
+# define DEBUG_MAIN_THREAD
+#endif
+
static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
GdkEvent *WXUNUSED(event),
const wxChar *WXUNUSED(name) )
}
}
+#else
+#define DEBUG_MAIN_THREAD
#endif // Debug
//-----------------------------------------------------------------------------
if (win->HasScrolling())
{
- GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
- GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
-
-/*
- GtkWidget *hscrollbar = scroll_window->hscrollbar;
- GtkWidget *vscrollbar = scroll_window->vscrollbar;
+ GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
+
+ GtkRequisition vscroll_req;
+ vscroll_req.width = 2;
+ vscroll_req.height = 2;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT(scroll_window->vscrollbar)->klass )->size_request )
+ (scroll_window->vscrollbar, &vscroll_req );
+
+ GtkRequisition hscroll_req;
+ hscroll_req.width = 2;
+ hscroll_req.height = 2;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT(scroll_window->hscrollbar)->klass )->size_request )
+ (scroll_window->hscrollbar, &hscroll_req );
+
+ GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
- we use this instead: range.slider_width = 11 + 2*2pts edge
-*/
-
- if (scroll_window->vscrollbar_visible)
- {
- dw += 15; /* dw += vscrollbar->allocation.width; */
- dw += scroll_class->scrollbar_spacing;
- }
+ if (scroll_window->vscrollbar_visible)
+ {
+ dw += vscroll_req.width;
+ dw += scroll_class->scrollbar_spacing;
+ }
- if (scroll_window->hscrollbar_visible)
- {
- dh += 15; /* dh += hscrollbar->allocation.height; */
- dh += scroll_class->scrollbar_spacing;
- }
+ if (scroll_window->hscrollbar_visible)
+ {
+ dh += hscroll_req.height;
+ dh += scroll_class->scrollbar_spacing;
+ }
}
int dx = 0;
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (!win->m_hasVMT)
return;
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
GdkRectangle *rect, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static void gtk_window_vscroll_callback( GtkAdjustment *adjust, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static void gtk_window_hscroll_callback( GtkAdjustment *adjust, wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
// don't test here as we can release the mouse while being over
// a different window than the slider
static gint
gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win )
{
+ DEBUG_MAIN_THREAD
+
if (g_isIdle)
wxapp_install_idle_handler();
int dw = 0;
int dh = 0;
-#if (GTK_MINOR_VERSION == 0)
- if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
- {
- if (HasScrolling())
- {
- GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
-#if 0 // unused - if this is ok, just remove this line (VZ)
- GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
-#endif // 0
-
- GtkWidget *viewport = scroll_window->viewport;
- GtkStyleClass *viewport_class = viewport->style->klass;
-
- dw += 2 * viewport_class->xthickness;
- dh += 2 * viewport_class->ythickness;
- }
- }
-#else
if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
{
/* when using GTK 1.2 we set the shadow border size to 2 */
dw += 1 * 2;
dh += 1 * 2;
}
-#endif
if (HasScrolling())
{
-/*
- GtkWidget *hscrollbar = scroll_window->hscrollbar;
- GtkWidget *vscrollbar = scroll_window->vscrollbar;
-
- we use this instead: range.slider_width = 11 + 2*2pts edge
-*/
-
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
+
+ GtkRequisition vscroll_req;
+ vscroll_req.width = 2;
+ vscroll_req.height = 2;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT(scroll_window->vscrollbar)->klass )->size_request )
+ (scroll_window->vscrollbar, &vscroll_req );
+
+ GtkRequisition hscroll_req;
+ hscroll_req.width = 2;
+ hscroll_req.height = 2;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT(scroll_window->hscrollbar)->klass )->size_request )
+ (scroll_window->hscrollbar, &hscroll_req );
+
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
if (scroll_window->vscrollbar_visible)
{
- dw += 15; /* dw += vscrollbar->allocation.width; */
+ dw += vscroll_req.width;
dw += scroll_class->scrollbar_spacing;
}
if (scroll_window->hscrollbar_visible)
{
- dh += 15; /* dh += hscrollbar->allocation.height; */
+ dh += hscroll_req.height;
dh += scroll_class->scrollbar_spacing;
}
- }
+ }
SetSize( width+dw, height+dh );
}
int dw = 0;
int dh = 0;
-#if (GTK_MINOR_VERSION == 0)
- if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
- {
- if (HasScrolling())
- {
- GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
-#if 0 // unused - if this is ok, just remove this line (VZ)
- GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
-#endif // 0
-
- GtkWidget *viewport = scroll_window->viewport;
- GtkStyleClass *viewport_class = viewport->style->klass;
-
- dw += 2 * viewport_class->xthickness;
- dh += 2 * viewport_class->ythickness;
- }
- }
-#else
if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
{
/* when using GTK 1.2 we set the shadow border size to 2 */
dw += 1 * 2;
dh += 1 * 2;
}
-#endif
+
if (HasScrolling())
{
-/*
- GtkWidget *hscrollbar = scroll_window->hscrollbar;
- GtkWidget *vscrollbar = scroll_window->vscrollbar;
-
- we use this instead: range.slider_width = 11 + 2*2pts edge
-*/
-
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
+
+ GtkRequisition vscroll_req;
+ vscroll_req.width = 2;
+ vscroll_req.height = 2;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT(scroll_window->vscrollbar)->klass )->size_request )
+ (scroll_window->vscrollbar, &vscroll_req );
+
+ GtkRequisition hscroll_req;
+ hscroll_req.width = 2;
+ hscroll_req.height = 2;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT(scroll_window->hscrollbar)->klass )->size_request )
+ (scroll_window->hscrollbar, &hscroll_req );
+
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
if (scroll_window->vscrollbar_visible)
{
- dw += 15; /* dw += vscrollbar->allocation.width; */
+ dw += vscroll_req.width;
dw += scroll_class->scrollbar_spacing;
}
if (scroll_window->hscrollbar_visible)
{
- dh += 15; /* dh += hscrollbar->allocation.height; */
+ dh += hscroll_req.height;
dh += scroll_class->scrollbar_spacing;
}
}
GtkStyle *wxWindow::GetWidgetStyle()
{
- if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
+ if (m_widgetStyle) return m_widgetStyle;
GtkStyle *def = gtk_rc_get_style( m_widget );
def = gtk_widget_get_default_style();
m_widgetStyle = gtk_style_copy( def );
- m_widgetStyle->engine_data = def->engine_data;
m_widgetStyle->klass = def->klass;
return m_widgetStyle;