Beispiel #1
0
void wxTopLevelWindowGTK::SetWindowStyleFlag( long style )
{
#if defined(__WXGTK24__) || GTK_CHECK_VERSION(2,2,0)
    // Store which styles were changed
    long styleChanges = style ^ m_windowStyle;
#endif

    // Process wxWindow styles. This also updates the internal variable
    // Therefore m_windowStyle bits carry now the _new_ style values
    wxWindow::SetWindowStyleFlag(style);

    // just return for now if widget does not exist yet
    if (!m_widget)
        return;

#ifdef __WXGTK24__
    if ( (styleChanges & wxSTAY_ON_TOP) && !gtk_check_version(2,4,0) )
        gtk_window_set_keep_above(GTK_WINDOW(m_widget), m_windowStyle & wxSTAY_ON_TOP);
#endif // GTK+ 2.4
#if GTK_CHECK_VERSION(2,2,0)
    if ( (styleChanges & wxFRAME_NO_TASKBAR) && !gtk_check_version(2,2,0) )
    {
        gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), m_windowStyle & wxFRAME_NO_TASKBAR);
    }
#endif // GTK+ 2.2
}
Beispiel #2
0
static GtkStyleContext* StyleContext(
    GtkStyleContext* parent,
    GtkWidgetPath* path,
    GType type,
    const char* objectName,
    const char* className1 = NULL,
    const char* className2 = NULL)
{
    gtk_widget_path_append_type(path, type);
#if GTK_CHECK_VERSION(3,20,0)
    if (gtk_check_version(3,20,0) == NULL)
        gtk_widget_path_iter_set_object_name(path, -1, objectName);
#endif
    if (className1)
        gtk_widget_path_iter_add_class(path, -1, className1);
    if (className2)
        gtk_widget_path_iter_add_class(path, -1, className2);
    GtkStyleContext* sc = gtk_style_context_new();
    gtk_style_context_set_path(sc, path);
    if (parent)
    {
#if GTK_CHECK_VERSION(3,4,0)
        if (gtk_check_version(3,4,0) == NULL)
            gtk_style_context_set_parent(sc, parent);
#endif
        g_object_unref(parent);
    }
    return sc;
}
Beispiel #3
0
bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
                                          bool fixedWidthOnly)
{
    if ( encoding != wxFONTENCODING_SYSTEM && encoding != wxFONTENCODING_UTF8 )
    {
        // Pango supports only UTF-8 encoding (and system means any, so we
        // accept it too)
        return false;
    }

#if defined(__WXGTK20__) || !defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
    if ( fixedWidthOnly
#if defined(__WXGTK24__)
        && (gtk_check_version(2,4,0) != NULL)
#endif
       )
    {
        OnFacename( wxT("monospace") );
    }
    else // !fixedWidthOnly
#endif // __WXGTK20__ || !HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
    {
        PangoFontFamily **families = NULL;
        gint n_families = 0;
        pango_context_list_families (
#ifdef __WXGTK20__
            gtk_widget_get_pango_context( wxGetRootWindow() ),
#else
            wxTheApp->GetPangoContext(),
#endif
            &families, &n_families );
        qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies);

        for (int i=0; i<n_families; i++)
        {
#if defined(__WXGTK24__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
            if (!fixedWidthOnly || (
#ifdef __WXGTK24__
                !gtk_check_version(2,4,0) &&
#endif
                pango_font_family_is_monospace(families[i])
                                   ) )
#endif
            {
                const gchar *name = pango_font_family_get_name(families[i]);
                OnFacename(wxString(name, wxConvUTF8));
            }
        }
        g_free(families);
    }

    return true;
}
Beispiel #4
0
bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
{
    if (m_widget == NULL)
        return false;
#if GTK_CHECK_VERSION(2,12,0)
#ifndef __WXGTK3__
    if (gtk_check_version(2,12,0) == NULL)
#endif
    {
#if GTK_CHECK_VERSION(3,8,0)
        if(gtk_check_version(3,8,0) == NULL)
        {
            gtk_widget_set_opacity(m_widget, alpha / 255.0);
        }
        else
#endif
        {
            // Can't avoid using this deprecated function with older GTK+.
            wxGCC_WARNING_SUPPRESS(deprecated-declarations);
            gtk_window_set_opacity(GTK_WINDOW(m_widget), alpha / 255.0);
            wxGCC_WARNING_RESTORE();
        }
        return true;
    }
#endif // GTK_CHECK_VERSION(2,12,0)
#ifndef __WXGTK3__
#ifdef GDK_WINDOWING_X11
    GdkWindow* window = gtk_widget_get_window(m_widget);
    if (window == NULL)
        return false;

    Display* dpy = GDK_WINDOW_XDISPLAY(window);
    Window win = GDK_WINDOW_XID(window);

    if (alpha == 0xff)
        XDeleteProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False));
    else
    {
        long opacity = alpha * 0x1010101L;
        XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False),
                        XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *) &opacity, 1L);
    }
    XSync(dpy, False);
    return true;
#else // !GDK_WINDOWING_X11
    return false;
#endif // GDK_WINDOWING_X11 / !GDK_WINDOWING_X11
#endif // !__WXGTK3__
}
Beispiel #5
0
bool wxTopLevelWindowGTK::CanSetTransparent()
{
    // allow to override automatic detection as it's far from perfect
    const wxString SYSOPT_TRANSPARENT = "gtk.tlw.can-set-transparent";
    if ( wxSystemOptions::HasOption(SYSOPT_TRANSPARENT) )
    {
        return wxSystemOptions::GetOptionInt(SYSOPT_TRANSPARENT) != 0;
    }

#ifdef __WXGTK3__
    return gtk_widget_is_composited(m_widget) != 0;
#else
#if GTK_CHECK_VERSION(2,10,0)
    if (!gtk_check_version(2,10,0))
    {
        return gtk_widget_is_composited(m_widget) != 0;
    }
    else
#endif // In case of lower versions than gtk+-2.10.0 we could look for _NET_WM_CM_Sn ourselves
    {
        return false;
    }
#endif // !__WXGTK3__

#if 0 // Don't be optimistic here for the sake of wxAUI
    int opcode, event, error;
    // Check for the existence of a RGBA visual instead?
    return XQueryExtension(gdk_x11_get_default_xdisplay (),
                           "Composite", &opcode, &event, &error);
#endif
}
Beispiel #6
0
void wxStaticText::SetLabel( const wxString& str )
{
    wxCHECK_RET( m_widget != NULL, wxT("invalid static text") );

    // save the label inside m_labelOrig in case user calls GetLabel() later
    m_labelOrig = str;

    InvalidateBestSize();

    wxString label(str);
    if (gtk_check_version(2,6,0) &&
        IsEllipsized())
    {
        // GTK+ < 2.6 does not support ellipsization:
        // since we need to use our generic code for ellipsization (which does not
        // behaves well in conjunction with markup; i.e. it may break the markup
        // validity erasing portions of the string), we also need to strip out
        // the markup (if present) from the label.

        label = GetEllipsizedLabelWithoutMarkup();
    }

    if ( HasFlag(wxST_MARKUP) )
        GTKSetLabelWithMarkupForLabel(GTK_LABEL(m_widget), label);
    else
        GTKSetLabelForLabel(GTK_LABEL(m_widget), label);

    // adjust the label size to the new label unless disabled
    if ( !HasFlag(wxST_NO_AUTORESIZE) &&
         !IsEllipsized() )  // if ellipsization is ON, then we don't want to get resized!
        SetSize( GetBestSize() );
}
Beispiel #7
0
static gboolean
parent_set_hook(GSignalInvocationHint*, guint, const GValue* param_values, void* data)
{
    wxGLCanvas* win = (wxGLCanvas*)data;
    if (g_value_peek_pointer(&param_values[0]) == win->m_wxwindow)
    {
        const XVisualInfo* xvi = (XVisualInfo*)win->m_vi;
        GdkVisual* visual = gtk_widget_get_visual(win->m_wxwindow);
        if (GDK_VISUAL_XVISUAL(visual)->visualid != xvi->visualid)
        {
#if GTK_CHECK_VERSION(2, 2, 0)
            if (gtk_check_version(2, 2, 0) == NULL)
            {
                GdkScreen* screen = gtk_widget_get_screen(win->m_wxwindow);
                visual = gdk_x11_screen_lookup_visual(screen, xvi->visualid);
            }
            else
#endif
            {
                visual = gdkx_visual_get(xvi->visualid);
            }
            GdkColormap* colormap = gdk_colormap_new(visual, false);
            gtk_widget_set_colormap(win->m_wxwindow, colormap);
            g_object_unref(colormap);
        }
        // remove hook
        return false;
    }
    return true;
}
Beispiel #8
0
bool wxCollapsiblePane::IsCollapsed() const
{
    if (!gtk_check_version(2,4,0))
        return !gtk_expander_get_expanded(GTK_EXPANDER(m_widget));

    return wxGenericCollapsiblePane::IsCollapsed();
}
Beispiel #9
0
bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
      const wxPoint &pos, const wxSize &size,
      long style, const wxValidator& validator, const wxString &name )
{
    m_needParent = true;
    m_acceptsFocus = true;

    if (!PreCreation( parent, pos, size ) ||
        !CreateBase( parent, id, pos, size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxButton creation failed") );
        return false;
    }

    m_widget = gtk_button_new_with_mnemonic("");

    float x_alignment = 0.5;
    if (HasFlag(wxBU_LEFT))
        x_alignment = 0.0;
    else if (HasFlag(wxBU_RIGHT))
        x_alignment = 1.0;

    float y_alignment = 0.5;
    if (HasFlag(wxBU_TOP))
        y_alignment = 0.0;
    else if (HasFlag(wxBU_BOTTOM))
        y_alignment = 1.0;

#ifdef __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, y_alignment);
    }
    else
#endif
    {
        if (GTK_IS_MISC(GTK_BIN(m_widget)->child))
            gtk_misc_set_alignment(GTK_MISC(GTK_BIN(m_widget)->child),
                                x_alignment, y_alignment);
    }

    SetLabel(label);

    if (style & wxNO_BORDER)
       gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );

    g_signal_connect_after (m_widget, "clicked",
                            G_CALLBACK (gtk_button_clicked_callback),
                            this);

    g_signal_connect_after (m_widget, "style_set",
                            G_CALLBACK (gtk_button_style_set_callback),
                            this);

    m_parent->DoAddChild( this );

    PostCreation(size);

    return true;
}
Beispiel #10
0
static VALUE
rg_s_check_version(G_GNUC_UNUSED VALUE self, VALUE major, VALUE minor, VALUE micro)
{
    const gchar *ret;
    ret = gtk_check_version(FIX2INT(major), FIX2INT(minor), FIX2INT(micro));
    return ret ? CSTR2RVAL(ret) : Qnil;
}
Beispiel #11
0
// Returns NULL if version is certainly greater or equal than major.minor.micro
// Returns string describing the error if version is lower than
// major.minor.micro OR it cannot be determined and one should not rely on the
// availability of pango version major.minor.micro, nor the non-availability
const gchar *wx_pango_version_check (int major, int minor, int micro)
{
    // NOTE: you don't need to use this macro to check for Pango features
    //       added in pango-1.4 or earlier since GTK 2.4 (our minimum requirement
    //       for GTK lib) required pango 1.4...

#ifdef __WXGTK3__
    return pango_version_check(major, minor, micro);
#elif defined(PANGO_VERSION_MAJOR)
    if (!gtk_check_version (2,11,0))
    {
        // GTK+ 2.11 requires Pango >= 1.15.3 and pango_version_check
        // was added in Pango 1.15.2 thus we know for sure the pango lib we're
        // using has the pango_version_check function:
        return pango_version_check (major, minor, micro);
    }

    return "can't check";
#else // !PANGO_VERSION_MAJOR
    wxUnusedVar(major);
    wxUnusedVar(minor);
    wxUnusedVar(micro);

    return "too old headers";
#endif
}
gchar *
empathy_add_link_markup (const gchar *text)
{
	EmpathyStringParser parsers[] = {
		{empathy_string_match_link, empathy_string_replace_link},
		{empathy_string_match_all, empathy_string_replace_escaped},
		{NULL, NULL}
	};
	GString *string;

	g_return_val_if_fail (text != NULL, NULL);

	/* GtkLabel with links could make infinite loop because of
	 * GNOME bug #612066. It is fixed in GTK >= 2.18.8 and GTK >= 2.19.7.
	 * FIXME: Remove this check once we have an hard dep on GTK 2.20 */
	if (gtk_check_version (2, 18, 8) != NULL ||
	    (gtk_minor_version == 19 && gtk_micro_version < 7)) {
		return g_markup_escape_text (text, -1);
	}

	string = g_string_sized_new (strlen (text));
	empathy_string_parser_substr (text, -1, parsers, string);

	return g_string_free (string, FALSE);
}
Beispiel #13
0
static gchar *
gui_sanity_check (void)
{
#define GTK_REQUIRED_MAJOR 2
#define GTK_REQUIRED_MINOR 24
#define GTK_REQUIRED_MICRO 10

  const gchar *mismatch = gtk_check_version (GTK_REQUIRED_MAJOR,
                                             GTK_REQUIRED_MINOR,
                                             GTK_REQUIRED_MICRO);

  if (mismatch)
    {
      return g_strdup_printf
        ("%s\n\n"
         "GIMP requires GTK+ version %d.%d.%d or later.\n"
         "Installed GTK+ version is %d.%d.%d.\n\n"
         "Somehow you or your software packager managed\n"
         "to install GIMP with an older GTK+ version.\n\n"
         "Please upgrade to GTK+ version %d.%d.%d or later.",
         mismatch,
         GTK_REQUIRED_MAJOR, GTK_REQUIRED_MINOR, GTK_REQUIRED_MICRO,
         gtk_major_version, gtk_minor_version, gtk_micro_version,
         GTK_REQUIRED_MAJOR, GTK_REQUIRED_MINOR, GTK_REQUIRED_MICRO);
    }

#undef GTK_REQUIRED_MAJOR
#undef GTK_REQUIRED_MINOR
#undef GTK_REQUIRED_MICRO

  return NULL;
}
Beispiel #14
0
bool wxDirDialog::Show( bool show )
{
    if (!gtk_check_version(2,4,0))
        return wxDialog::Show( show );
    else
        return wxGenericDirDialog::Show( show );
}
Beispiel #15
0
int wxDirDialog::ShowModal()
{
    if (!gtk_check_version(2,4,0))
        return wxDialog::ShowModal();
    else
        return wxGenericDirDialog::ShowModal();
}
Beispiel #16
0
void wxDirDialog::OnFakeOk( wxCommandEvent &event )
{
    if (!gtk_check_version(2,4,0))
        EndDialog(wxID_OK);
    else
        wxGenericDirDialog::OnOK( event );
}
Beispiel #17
0
static void wxgtk_window_set_urgency_hint (GtkWindow *win,
                                           gboolean setting)
{
#if GTK_CHECK_VERSION(2,7,0)
    if (gtk_check_version(2,7,0) == NULL)
        gtk_window_set_urgency_hint(win, setting);
    else
#endif
    {
#ifdef GDK_WINDOWING_X11
        GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(win));
        wxCHECK_RET(window, "wxgtk_window_set_urgency_hint: GdkWindow not realized");

        Display* dpy = GDK_WINDOW_XDISPLAY(window);
        Window xid = GDK_WINDOW_XID(window);
        XWMHints* wm_hints = XGetWMHints(dpy, xid);

        if (!wm_hints)
            wm_hints = XAllocWMHints();

        if (setting)
            wm_hints->flags |= XUrgencyHint;
        else
            wm_hints->flags &= ~XUrgencyHint;

        XSetWMHints(dpy, xid, wm_hints);
        XFree(wm_hints);
#endif // GDK_WINDOWING_X11
    }
}
Beispiel #18
0
static VALUE
rg_s_check_version_p(G_GNUC_UNUSED VALUE self, VALUE major, VALUE minor, VALUE micro)
{
    const gchar *ret;
    ret = gtk_check_version(FIX2INT(major), FIX2INT(minor), FIX2INT(micro));
    return CBOOL2RVAL(ret == NULL);
}
Beispiel #19
0
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{
    if ( !wxMenuBase::DoRemove(item) )
        return NULL;

    GtkWidget * const mitem = item->GetMenuItem();
    if (!gtk_check_version(2,12,0))
    {
        // gtk_menu_item_remove_submenu() is deprecated since 2.12, but
        // gtk_menu_item_set_submenu() can now be used with NULL submenu now so
        // just do use it.
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL);
    }
    else // GTK+ < 2.12
    {
        // In 2.10 calling gtk_menu_item_set_submenu() with NULL submenu
        // results in critical GTK+ error messages so use the old function
        // instead.
        gtk_menu_item_remove_submenu(GTK_MENU_ITEM(mitem));
    }

    gtk_widget_destroy(mitem);
    item->SetMenuItem(NULL);

    return item;
}
Beispiel #20
0
wxPoint wxControl::GTKGetEntryMargins(GtkEntry* entry) const
{
    wxPoint marg(0, 0);

#ifndef __WXGTK3__
#if GTK_CHECK_VERSION(2,10,0)
    // The margins we have previously set
    const GtkBorder* border = NULL;
    if (gtk_check_version(2,10,0) == NULL)
        border = gtk_entry_get_inner_border(entry);

    if ( border )
    {
        marg.x = border->left + border->right;
        marg.y = border->top + border->bottom;
    }
#endif // GTK+ 2.10+
#else // GTK+ 3
    // Gtk3 does not use inner border, but StyleContext and CSS
    // TODO: implement it, starting with wxTextEntry::DoSetMargins()
#endif // GTK+ 2/3

    int x, y;
    gtk_entry_get_layout_offsets(entry, &x, &y);
    // inner borders are included. Substract them so we can get other margins
    x -= marg.x;
    y -= marg.y;
    marg.x += 2 * x + 2;
    marg.y += 2 * y + 2;

    return marg;
}
Beispiel #21
0
void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
{
    wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));

    if ( tool )
    {
        (void)tool->SetShortHelp(helpString);
        if (tool->m_item)
        {
#if GTK_CHECK_VERSION(2, 12, 0)
            if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
            {
                gtk_tool_item_set_tooltip_text(tool->m_item,
                    wxGTK_CONV(helpString));
            }
            else
#endif
            {
#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
                gtk_tool_item_set_tooltip(tool->m_item,
                    m_tooltips, wxGTK_CONV(helpString), "");
#endif
            }
        }
    }
}
Beispiel #22
0
void wxAnyButton::DoSetBitmapPosition(wxDirection dir)
{
#ifdef __WXGTK210__
    if ( !gtk_check_version(2,10,0) )
    {
        GtkPositionType gtkpos;
        switch ( dir )
        {
            default:
                wxFAIL_MSG( "invalid position" );
                // fall through

            case wxLEFT:
                gtkpos = GTK_POS_LEFT;
                break;

            case wxRIGHT:
                gtkpos = GTK_POS_RIGHT;
                break;

            case wxTOP:
                gtkpos = GTK_POS_TOP;
                break;

            case wxBOTTOM:
                gtkpos = GTK_POS_BOTTOM;
                break;
        }

        gtk_button_set_image_position(GTK_BUTTON(m_widget), gtkpos);
        InvalidateBestSize();
    }
#endif // GTK+ 2.10+
}
Beispiel #23
0
static inline void
wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* dest)
{
#if GTK_CHECK_VERSION(3,4,0)
    if (gtk_check_version(3,4,0) == NULL)
        gdk_screen_get_monitor_workarea(screen, monitor, dest);
    else
#endif
    {
        gdk_screen_get_monitor_geometry(screen, monitor, dest);
#ifdef GDK_WINDOWING_X11
#ifdef __WXGTK3__
        if (GDK_IS_X11_SCREEN(screen))
#endif
        {
            GdkRectangle rect = { 0 };
            wxGetWorkAreaX11(GDK_SCREEN_XSCREEN(screen),
                             rect.x, rect.y, rect.width, rect.height);
            // in case _NET_WORKAREA result is too large
            if (rect.width && rect.height)
                gdk_rectangle_intersect(dest, &rect, dest);
        }
#endif // GDK_WINDOWING_X11
    }
}
Beispiel #24
0
unsigned int wxComboBox::GetCount() const
{
    wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );

#ifdef __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
        GtkTreeModel* model = gtk_combo_box_get_model( combobox );
        GtkTreeIter iter;
        gtk_tree_model_get_iter_first( model, &iter );
        if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
            return 0;
        unsigned int ret = 1;
        while (gtk_tree_model_iter_next( model, &iter ))
            ret++;
        return ret;
    }
    else
#endif
    {
        GtkWidget *list = GTK_COMBO(m_widget)->list;

        GList *child = GTK_LIST(list)->children;
        unsigned int count = 0;
        while (child)
        {
            count++;
            child = child->next;
        }
        return count;
    }

    return 0;
}
Beispiel #25
0
void wxAnyButton::GTKDoShowBitmap(const wxBitmap& bitmap)
{
    wxASSERT_MSG( bitmap.IsOk(), "invalid bitmap" );

    GtkWidget *image;
    if ( DontShowLabel() )
    {
        image = gtk_bin_get_child(GTK_BIN(m_widget));
    }
    else // have both label and bitmap
    {
#ifdef __WXGTK26__
        if ( !gtk_check_version(2,6,0) )
        {
            image = gtk_button_get_image(GTK_BUTTON(m_widget));
        }
        else
#endif // __WXGTK26__
        {
            // buttons with both label and bitmap are only supported with GTK+
            // 2.6 so far
            //
            // it shouldn't be difficult to implement them ourselves for the
            // previous GTK+ versions by stuffing a container with a label and
            // an image inside GtkButton but there doesn't seem to be much
            // point in doing this for ancient GTK+ versions
            return;
        }
    }

    wxCHECK_RET( image && GTK_IS_IMAGE(image), "must have image widget" );

    gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf());
}
Beispiel #26
0
/**
 * Change event handling between XInput and Core
 */
void gtk_xournal_update_xevent(GtkWidget* widget)
{
	g_return_if_fail(widget != NULL);
	g_return_if_fail(GTK_IS_XOURNAL(widget));

	GtkXournal* xournal = GTK_XOURNAL(widget);

	Settings* settings = xournal->view->getControl()->getSettings();

	if (!gtk_check_version(2, 17, 0))
	{
		/* GTK+ 2.17 and later: everybody shares a single native window,
		 so we'll never get any core events, and we might as well set
		 extension events the way we're supposed to. Doing so helps solve
		 crasher bugs in 2.17, and prevents us from losing two-button
		 events in 2.18 */
		gtk_widget_set_extension_events(widget,
		                                settings->isUseXInput() ? GDK_EXTENSION_EVENTS_ALL : GDK_EXTENSION_EVENTS_NONE);
	}
	else
	{
		/* GTK+ 2.16 and earlier: we only activate extension events on the
		 PageViews's parent GdkWindow. This allows us to keep receiving core
		 events. */
		gdk_input_set_extension_events(widget->window,
		                               GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK |
		                               GDK_BUTTON_RELEASE_MASK,
		                               settings->isUseXInput() ? GDK_EXTENSION_EVENTS_ALL : GDK_EXTENSION_EVENTS_NONE);
	}

}
Beispiel #27
0
const gchar*
g_module_check_init (GModule *module)
{
	return gtk_check_version (GTK_MAJOR_VERSION,
	                          GTK_MINOR_VERSION,
	                          GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
}
Beispiel #28
0
void wxFileDialog::GetPaths(wxArrayString& paths) const
{
#ifdef __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        paths.Empty();
        if (gtk_file_chooser_get_select_multiple(GTK_FILE_CHOOSER(m_widget)))
        {
            GSList *gpathsi = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(m_widget));
            GSList *gpaths = gpathsi;
            while (gpathsi)
            {
                wxString file(wxConvFileName->cMB2WX((gchar*) gpathsi->data));
                paths.Add(file);
                g_free(gpathsi->data);
                gpathsi = gpathsi->next;
            }

            g_slist_free(gpaths);
        }
        else
            paths.Add(GetPath());
    }
    else
#endif
        wxGenericFileDialog::GetPaths( paths );
}
Beispiel #29
0
void wxTextEntry::SetSelection(long from, long to)
{
    // in wx convention, (-1, -1) means the entire range but GTK+ translates -1
    // (or any negative number for that matter) into last position so we need
    // to translate manually
    if ( from == -1 && to == -1 )
        from = 0;

    // for compatibility with MSW, exchange from and to parameters so that the
    // insertion point is set to the start of the selection and not its end as
    // GTK+ does by default
    gtk_editable_select_region(GetEditable(), to, from);

#ifndef __WXGTK3__
    // avoid reported problem with RHEL 5 GTK+ 2.10 where selection is reset by
    // a clipboard callback, see #13277
    if (gtk_check_version(2,12,0))
    {
        GtkEntry* entry = GTK_ENTRY(GetEditable());
        if (to < 0)
            to = entry->text_length;
        entry->selection_bound = to;
    }
#endif
}
Beispiel #30
0
void wxFileDialog::SetFilterIndex(int filterIndex)
{
#ifdef __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        gpointer filter;
        GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
        GSList *filters = gtk_file_chooser_list_filters(chooser);

        filter = g_slist_nth_data(filters, filterIndex);

        if (filter != NULL)
        {
            gtk_file_chooser_set_filter(chooser, GTK_FILE_FILTER(filter));
        }
        else
        {
            wxFAIL_MSG( wxT("wxFileDialog::SetFilterIndex - bad filter index") );
        }

        g_slist_free(filters);
    }
    else
#endif
        wxGenericFileDialog::SetFilterIndex( filterIndex );
}