Commit Graph

73 Commits

Author SHA1 Message Date
Carlos Garnacho
f2ded6a685 gtk: Change gtk_propagate_event() to propagate both ways.
This change is made for consistency, it doesn't make sense to expose
one-way propagation, as it can only break expectations from GTK+. This
function might be made entirely private in the future, but it still
makes sense to do this in one go for our internal usecases.
2017-09-19 18:39:03 +02:00
Carlos Garnacho
53c297436d gtk: Add private _gtk_toplevel_pick() method
This function returns both the widget at the given toplevel coordinates,
and the translated x/y in widget relative coordinates.
2017-05-25 16:25:58 +02:00
Emmanuele Bassi
db6f9a8e45 gtk: Add missing function declarations 2016-10-17 11:44:11 +01:00
Emmanuele Bassi
5e388fc3e4 Fix _gtk_get_slowdown()
We need to pass void as the argument type.
2016-10-17 11:10:14 +01:00
Matthias Clasen
96d8afbccb Add a portal helper
Instead of open-coding checks for sandboxing in multiple
places, add a helper function that caches the information.

https://bugzilla.gnome.org/show_bug.cgi?id=768499
2016-07-08 00:06:14 -04:00
Matt Watson
f2979323bf progresstracker: add GTK_SLOWDOWN environment variable
As we consolidate widgets to use progress tracker, this will allow
us to control the speed of all animations in a centralized place
2016-04-08 16:09:29 -07:00
Matthias Clasen
02742d5332 Make debug flags per-display
Tihs lets us toggle debug flags in the inspector without affecting
the inspector itself.
2016-03-11 00:22:36 -05:00
Matthias Clasen
98121aa302 Add a private function to determine if we simulate
These same two or three tests are currently duplicated
in several places, with separate static variables. Lets
do this in one place.
2015-07-31 13:46:34 -04:00
Руслан Ижбулатов
0d02cc8203 Make sure native W32 print dialog uses visual styles
For that to happen the libgtk3 is embedded with a manifest that requests
common controls library 6.x, and GTK lazily calls InitCommonControlsEx()
to initialize those. Then this manifest is used to temporarily override
the process activation contest when loading comdlg32 (which contains the
code for the print dialog), ensuring that it too depends on common
controls 6.x, even if the application that uses GTK does not.

https://bugzilla.gnome.org/show_bug.cgi?id=733773
2014-08-05 06:41:31 +00:00
Benjamin Otte
6146bf7a32 gtkprivate: #define OPPOSITE_ORIENTATION
and use it
2013-05-01 16:41:11 +02:00
Tristan Van Berkom
4ec6d6006e Work around access to global resources without calling gtk_init()
Some utilities such as GIR and gtk-doc, initialize class vtables without
initializing GTK+, with composite templates accessing resources this
causes a hand full of unneeded warnings.

The workaround for now is the use a private function _gtk_ensure_resources()
which is both called while initializing GTK+, and at the beginning of
gtk_widget_class_set_template_from_resource() (the private function
ensures that the resource will only ever be registered GOnce).
2013-04-08 21:19:27 +09:00
Alexander Larsson
5833b8495e Add internal versions of g_return_[val_]_if_fail
These are only enabled on debug=yes, so not by default
in released tarballs.
2012-12-04 20:16:44 +01:00
Carlos Garnacho
1f7e375c33 Add GtkTextHandle
This is a helper object to allow text widgets to implement
text selection on touch devices. It allows for both cursor
placement and text selection, displaying draggable handles
on/around the cursor and selection bound positions.

Currently, this is private to GTK+, and only available to
GtkEntry and GtkTextView.
2012-09-03 00:19:03 -04:00
Carlos Garcia Campos
9f4bfff1b0 gtk: Add a way to do event capture
This patch adds a capture phase to GTK+'s event propagation
model. Events are first propagated from the toplevel (or the
grab widget, if a grab is in place) down to the target widget
 and then back up. The second phase is using the existing
::event signal, the new capture phase is using a private
API instead of a public signal for now.

This mechanism can be used in many places where we currently
have to prevent child widgets from getting events by putting
an input-only window over them. It will also be used to implement
kinetic scrolling in subsequent patches.

http://bugzilla.gnome.org/show_bug.cgi?id=641836

We automatically request more motion events in behalf of
the original widget if it listens to motion hints. So
the capturing widget doesn't need to handle such
implementation details.

We are not making event capture part of the public API for 3.4,
which is why there is no ::captured-event signal.
2012-03-01 16:25:21 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Alexander Larsson
c9a3332ede Add generation of private g-types for private headers
This starts with just the gtkcsstypesprivate.h header
2011-11-25 15:36:08 +01:00
Michael Natterer
9c79f9f868 Turn the private #define for the group-shifting modifier into API
Add GDK_MODIFIER_INTENT_SHIFT_GROUP to enum GdkModifierIntent
and handle it in gdk_keymap_get_modifier_mask(). Add an X11
impl of the method and return keymap_x11->group_switch_mask.
Return 0 from the default impl because we don't know.
2011-11-18 15:14:31 +01:00
Michael Natterer
1c8481a6ea Bug 663856 - Make option-foo accelerators use the right symbol
If the keyboard group shifting modifier is *also* a normal
accelerator modifier, we need to special case it when calling
gdk_keymap_translate_keyboard_state(), so we get the right
key symbol for accelerators (for example we want Option-O,
not Option-Ø displayed in menu items). This patch should only
affect quartz where the Alt key both shifts the group and can
be used as accel modifier, and not X11 or Win32 where AltGr
is not used for accelerators.

- fix quartz' gdk_keymap_translate_keyboard_state() to return
  the right consumed_modifiers
- add _gtk_translate_keyboard_accel_state() which does the
  special casing
- use it everywhere instead of gdk_keymap_translate_keyboard_state()
2011-11-18 13:06:27 +01:00
Matthias Clasen
feece3c0bb Move gtkstyle and gtkrc to deprecated/
This required a somewhat more substantial include reshuffling.
Some typedefs have been moved to gtkiconfactory.h and to
gtksettings.h.
2011-11-02 01:15:21 -04:00
Michael Natterer
2688ccdbc4 gtk: clean up the private horror
- add gtkmodulesprivate.h and move stuff there from gtkprivate.h
- add gtkprivate.c and move stuff there from gtkmain.c
- add gtkwin32.c and move stuff there from gtkmain.c
- don't redefine GTK_DATADIR and friends in gtkprivate.h
- have _gtk_get_datadir() and friends on all platforms
- remove the horrid hacks where gtkprivate.h can't be included,
  or must be included later due to redefinition of the compile-time
  directories
2011-10-22 23:53:55 +02:00
John Ralls
6dc34c1f5e Bug 658772: Directory paths for resource directories are hard coded.
Provide dynamic path discovery functions as are provided for win32.
2011-10-08 15:02:38 -07:00
Michael Natterer
5327034c31 gtk: remove the private GTK_DEFAULT_ACCEL_MOD_MASK define
and finish the port to using the new modifier abstraction API.
This commit has some evilness, it uses the default display for
the lack of a widget context, and the change to gtkstock.c
is very ugly, but I can't think of anything better given
GtkStockItem needs an accel mask instead of a proper accel
string.
2011-10-07 20:58:58 +02:00
Michael Natterer
2d3db3421f Bug 659406 - Abstract what triggers a context menu
Add gdk_event_triggers_context_menu(), using the new modifier
abstraction API. Remove _gtk_button_event_triggers_context_menu()
and port all callers.
2011-09-27 15:45:18 +02:00
Michael Natterer
11f8c1ba6f gtk: remove the private GTK_EXTEND/MODIFY_SELECTION_MOD_MASK
and use the new public modifier abstraction API instead.
2011-09-27 12:06:10 +02:00
Michael Natterer
0abe8ce27b gtk: remove the private GTK_NO_TEXT_INPUT_MOD_MASK
and use the new public modifier abstraction API.
2011-09-27 11:34:19 +02:00
Michael Natterer
b663f3a00b Bug 659406 - Abstract what triggers a context menu
Add _gtk_button_event_triggers_context_menu() and use it instead
of checking for event->button == 3, so context menus are invoked
correctly on the Mac.
2011-09-26 16:01:50 +02:00
Michael Natterer
0955a59563 app: abstract which modifiers are used for extending and modifying selections
which are SHIFT and MOD2 on the Mac, and SHIFT and CONTROL otherwise.
Use the new define all over the place and rename variables and
members to not say "shift" or "control".
2011-09-26 16:01:50 +02:00
Michael Natterer
2a8be23d17 gtk: fix entering of Option-foo symbols on the Mac
define GTK_NO_TEXT_INPUT_MOD_MASK in gtkprivate.h
and use it in the IM contexts, so Option-foo is no longer
filtered away.
2011-09-26 16:01:50 +02:00
Matthias Clasen
b123bc41fd Move docs for gtkmain inline
At the same time, introduce a gtkmainprivate.h header
and various other cleanups.

Based on a patch by Tadej Borovšak.
https://bugzilla.gnome.org/show_bug.cgi?id=617471
2011-01-04 17:32:12 -05:00
Emmanuele Bassi
ef9a6f205c Re-add copyright notice
https://bugzilla.gnome.org/show_bug.cgi?id=632677
2010-10-20 12:05:23 +01:00
Emmanuele Bassi
2cc059a0e7 Split off gtkprivate.h
The gtkprivate.h header contains GtkWidget-specific private symbols that
are not useful except in a handful of cases. Basically everything
includes gtkprivate.h for the GTK_PARAM_* macros.

https://bugzilla.gnome.org/show_bug.cgi?id=632539
2010-10-20 10:34:26 +01:00
Owen W. Taylor
88cf547029 Fix handling of the geometry widget
The geometry widget feature of gtk_window_set_geometry_hints() has
never really worked right because the calculation that GTK+ did to
compute the base size of the window only worked when the geometry
widget had a larger minimum size than anything else in the window.

Setup:
* Move the GtkSizeGroup private functions to a new private header
  gtksizegroup-private.h
* Add the possibilty to pass flags to _gtk_size_group_queue_resize(),
  with the flag GTK_QUEUE_RESIZE_INVALIDATE_ONLY to suppress adding
  the widget's toplevel to the resize queue.
* _gtk_container_resize_invalidate() is added to implement that feature
* _gtk_widget_override_size_request()/_gtk_widget_restore_size_request()
  allow temporarily forcing a large minimum size on the geometry
  widget without creating resize loops.

GtkWindow:
* Compute the extra width/height around the geometry widget
  correctly; print a warning if the computation fails.
* Always make the minimum size at least the natural minimum
  size of the toplevel; GTK+ now fails badly with underallocation.
* Always set the base size hint; we were failing to set it
  properly when the specified minimum size was overriden, but
  it's harmless to always set it.

Tests:
* New test 'testgeometry' that replaces the 'gridded geometry' test
  from testgtk. The new test is roughly similar but creates a bunch
  of windows showing different possibilities.
* The testgtk test is removed. No need to have both.

https://bugzilla.gnome.org/show_bug.cgi?id=68668
2010-10-11 14:05:29 -04:00
Matthias Clasen
f53ad33994 Remove GtkObject completely 2010-09-26 22:18:19 -04:00
Benjamin Otte
d9c9259861 Move GtkSizeRequest into GtkWidget
It doesn't make sense to keep them separate as GtkSizeRequest requires a
GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have
one without the other.
It also makes the code a lot easier because no casts are required when
calling functions.

Also, the names would translate to gtk_widget_get_width() and people
agreed that this would be a too generic name, so a "preferred" was added
to the names.

So this patch moves the functions:
gtk_size_request_get_request_mode() => gtk_widget_get_request_mode()
gtk_size_request_get_width() => gtk_widget_get_preferred_width()
gtk_size_request_get_height() => gtk_widget_get_preferred_height()
gtk_size_request_get_size() => gtk_widget_get_preferred_size()
gtk_size_request_get_width_for_height() =>
  gtk_widget_get_preferred_width_for_height()
gtk_size_request_get_height_for_width() =>
  gtk_widget_get_preferred_height_for_width()
... and moves the corresponding vfuncs to the GtkWidgetClass.

The patch also renames the implementations of the vfuncs in widgets to
include the word "preferrred".
2010-09-26 15:11:45 +02:00
Tristan Van Berkom
ca251cf1d4 Reduced overall SizeRequestCache size
This patch changes the 'age' counting previous approach taken
verbatim from clutter and changes it for a counter of validated
caches and an index to the last cached value which we use to
round-robin through the cache if ever a widget is requested
for more than 3 contextual sizes (cache is reduced by 3 * sizeof (int)
per widget private data).
2010-09-21 12:57:27 +09:00
Tristan Van Berkom
843be48572 Moved GtkSizeRequest cache to GtkWidget->priv
Now that we have a private data installed directly on
the GtkWidget instance it makes no sense to cache the size
requests on widget qdata. This change will generally make
GTK+ memory less fragmented as well as significantly speed
up the size request process.
2010-09-09 17:19:18 +09:00
Tristan Van Berkom
9934007420 Completely removed requisition cache from GtkWidget instance structure.
Since we have a new mechanism for requesting sizes: GtkSizeRequestIface;
it makes no sense to maintain this cache on the GtkWidget structure...
removing the requisition cache however does not break the old "size-request"
signal which is there for backwards compatability reasons.

In any case widget->requisition should not have been accessed,
gtk_widget_get_child_requisition() would have been the correct way
to consult the cache.

This commit also deprecates the newly added gtk_widget_get_requisition()
API and makes it fallback on gtk_size_request_get_size().
2010-09-08 18:50:24 +02:00
Matthias Clasen
bd4609b140 Merge the xi2-for-master branch 2010-05-25 18:38:44 -04:00
Tristan Van Berkom
d2c35ec62a Mega commit to change ->get_desired_size() for ->get_desired_width/height().
This commit changes gtk_extended_layout_get_desired_size() for
per dimension variants. Furthermore this commit reverts the actions
done in size-groups for now as it needs a different approach.

The natural width/height parameters added to aux_info have been changed
for a per width cache for heights and a per height cache for widths.

gtk-demo is still working, currently sizegroups are not taken
into account as mentioned above - size groups need to be alerted both
when the widths and heights are updated independantly and then that
information needs to repropagate also to other extended layout implementors.
2010-04-12 22:21:46 -04:00
Yevgen Muntyan
3c510f028f Use standard mac shortcuts
This changes Ctrl-X, Ctrl-C, etc. to Cmd-X, Cmd-C, etc. Also,
Alt-Left and Alt-Right in text widgets bound to Ctrl-Left and
Ctrl-Right actions

https://bugzilla.gnome.org/show_bug.cgi?id=530351
2009-10-26 00:03:05 +01:00
Cody Russell
4e3c97b3f2 Bug 56070 – Can't click button after setting it sensitive.
2008-07-31  Cody Russell  <bratsche@gnome.org>

        Bug 56070 – Can't click button after setting it sensitive.

        * gtk/gtkwidget.[ch] 
        * gtk/gtkwindow.c
        * gtk/gtkmain.c
        * gtk/gtkbutton.c
        * gtk/gtkprivate.h
        * gdk/gdkevents.h: Synthesize crossing events events where necessary.

        * gtk/tests/crossingevents.c: Add unit tests for crossing events.

        Big thanks to Ed Catmur, Matthias Clasen, and everyone else who
        has worked on and helped out with this.


svn path=/trunk/; revision=20924
2008-08-01 03:30:50 +00:00
Cody Russell
57223c9a05 Revert name change
svn path=/trunk/; revision=20724
2008-07-01 22:57:50 +00:00
Cody Russell
fce9c8b7d4 Practically everything changed.
2008-06-30  Cody Russell  <bratsche@gnome.org>

        * Practically everything changed.

        Change	all references	of GIMP	Toolkit	(and variations	of it)
        to GTK+	Toolkit, showing no mercy at all to our	beloved
	ancestry. (#540529)


svn path=/trunk/; revision=20709
2008-06-30 23:01:56 +00:00
Michael Natterer
a13f698b3a gtk/gtkassistant.h gtk/gtkcellrenderer.h gtk/gtkfilechooserentry.h
2008-06-24  Michael Natterer  <mitch@imendio.com>

	* gtk/gtkassistant.h
	* gtk/gtkcellrenderer.h
	* gtk/gtkfilechooserentry.h
	* gtk/gtkprivate.h
	* gtk/gtktooltip.h
	* gtk/gtktreeview.h
	* gtk/gtkwindow.h: no need to include gtkwidget.h or gtkobject.h
	if there is any other widget included, they all have to include
	their respective parent classes (the is-a relation works for
	includes too).


svn path=/trunk/; revision=20679
2008-06-24 10:16:01 +00:00
Matthias Clasen
269d89c79c Define macros GTK_PARAM_READABLE, GTK_PARAM_WRITABLE, GTK_PARAM_READWRITE
2005-03-21  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkprivate.h: Define macros GTK_PARAM_READABLE,
	GTK_PARAM_WRITABLE, GTK_PARAM_READWRITE which are like
	their G_ counterparts, but also mark the name, nick
	and blurb as static.

	* gtk/*.c: Mark param spec strings as static, using
	the new macros.
2005-03-22 02:14:55 +00:00
Federico Mena Quintero
3127f29ef6 Fix #138807.
2004-06-02  Federico Mena Quintero  <federico@ximian.com>

	Fix #138807.

	* gtk/fnmatch.c (_gtk_fnmatch): Take a no_leading_period argument.
	(gtk_fnmatch_intern): Likewise; also implement this option.

	* gtk/gtkprivate.h (_gtk_fnmatch): Updated prototype.

	* gtk/gtkfilesel.c (find_completion_dir): Pass TRUE for the
	no_leading_period argument of _gtk_fnmatch().
	(attempt_file_completion): Likewise.

	* gtk/gtkfilefilter.c (gtk_file_filter_filter): Pass FALSE for the
	no_leading_period argument of _gtk_fnmatch().
2004-06-02 17:46:21 +00:00
Hans Breuer
4acd98a836 handle GTK_DATADIR similar as the other filesystem placement 'constants'
2003-12-14  Hans Breuer  <hans@breuer.org>

	* gtk/gtkprivate.h gtk/gtkmain.c : handle GTK_DATADIR
	similar as the other filesystem placement 'constants' (dynamic
	resolving on win32)

	* gtk/gtkfilechooserwidget.c : handle file system to win32
	renaming here as will
	* gtk/gtkfilesystemwin32.c : implement render_icon

	* gtk/gtk.def gdk/gdk.def : updated externals

	* gdk/win32/gdkdisplay-win32.c : make it compile without
	<multimon.h> - i.e. even older sdk

	* gdk/win32/gdkevents-win32.c : match resize_timer_proc
	with TIMERPROC prototype

	* gdk/win32/gdkwindow-win32.c : older msvc does not know
	BITMAPV5HEADER (from win xp) either

	* gtk/gtkimmodule.c : make it compile even if GTK_LOCALEDIR is
	not defined

	* tests/testfilechooser.c : recent GLib crashes on
	g_print ("%s", NULL) so avoid this
2003-12-14 19:03:02 +00:00
Owen Taylor
73b15ba391 System fnmatch wasn't going to be UTF-8 clean, neither was our version.
Fri Dec 13 17:45:40 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/fnmatch.c gtk/gtkprivate.h gtk/gtkfilesel.c:
        System fnmatch wasn't going to be UTF-8 clean, neither
        was our version. Redo our fnmatch.c to be UTF-8, add
        test cases, fix all sorts of bugs inherited
        from the antique GNU fnmatch code. Change interface
        to get rid of fnmatch.h constants. Fixes basic
        non-workingness of filesel with non-ASCII filenames.

        * gtk/fnmatch.h: No longer needed.
2002-12-13 23:18:03 +00:00
Owen Taylor
21457ced17 Add a function gdk_window_invalidate_maybe_recurse() for use in "shallow
Sun Nov  4 16:02:08 2001  Owen Taylor  <otaylor@redhat.com>

        * gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse()
        for use in "shallow invalidation" of a widget. (Windows belonging
        to the widget, but not to the widget's children)

        * gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private
        flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED.  These flags are set
        up on ancestors up to the resize container on queue_resize. Size
        requests only actually take place if GTK_REQUEST_NEEDED, size
        allocations only take place if GTK_ALLOC_NEEDED or the size
        changed.

        * gtk/gtkcontainer.c gtk/gtkwidget.c: Remove
        container->resize_widgets and the RESIZE_NEEDED flag since the
        above flags are sufficient to figure out what needs to be
        resized/reallocated. Remove code manipulating
        container->resize_widget.

        * gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this
        allows widgets to turn off being automatically invalidated is when
        they are resized.

        * gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when
        a widget is resized or moved is "shallow" as described above -
        only the windows that need to be invalidated are invalidated.

        * gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt:
        Make these widget's init functions call
        gtk_widget_set_redraw_on_allocate(widget,FALSE).

        * gtk/gtkwindow.c (gtk_window_configure_event): Call
        _gtk_container_queue_resize(), since we don't want
        redrawing. (Probably could be done for other
        calls to gtk_widget_queue_resize() in gtkwindow.c,
        but this is the most important one.)

        * gtk/gtkwindow.c (gtk_window_move_resize): Don't call
        gtk_widget_queue_draw() - size_allocate() handles
        that as appropriate.

        * gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead
        of queue_clear() to avoid invalidating children.
2001-11-04 22:57:03 +00:00
Tor Lillqvist
06b4ef6517 Updates.
2001-10-29  Tor Lillqvist  <tml@iki.fi>

	* README.win32: Updates.

	* gtk-zip.sh.in: New file, used to build distribution package for
	Windows.

	* gdk/gdkglobals.c: Mark gdk_threads_mutex for DLL export when
	applicable with GDKVAR.

	* gtk/gtk.def: Update.

	* gtk/gtkfilesel.c: Include <winsock.h> (if available) for
	gethostname().

	* gtk/gtkmain.c
	* gtk/gtkrc.c: (Win32) Save actual DLL name for later use in DLL
	entry function. Avoid hardcoded paths GTK_LIBDIR, GTK_SYSCONFDIR,
	GTK_DATA_PREFIX and GTK_LOCALEDIR, instead add functions that call
	g_win32_get_package_installation_subdirectory() with the actual
	DLL name saved above. Redefine above directory name macros to call
	these functions. Remove some ifdefs.

	* gtk/maketypes.awk: Output GTKTYPEBUILTINS_VAR (that marks
	variable for export on Win32) also to the _vars file.

	Changes for autoconfiscated build on Win32, and addition of Win32
	backend to the related files:

	* configure.in: Like in GLib, set LT_CURRENT_MINUS_AGE for use
	when forming DLL name in some files. Set MS_LIB_AVAILABLE is
	lib.exe is available. Call AC_LIBTOOL_WIN32_DLL. Set
	PLATFORM_WIN32, OS_WIN32 and USE_WIN32 automake conditionals. Add
	win32 target, using pangowin32. Don't use the
	-export-symbols-regex option on Win32, we use .def files to list
	exported symbols. Check <winsock.h> (for gethostname() in
	gtkfilesel.c). Enclose nested AC_CHECK_* macros in brackets to
	prevent premature m4 expansion.

	* acconfig.h: Add HAVE_WINTAB.

	* gdk/Makefile.am: Add libgdk-win32-1.3.la target and associated
	macros and rules. Use -no-undefined on Win32. Use gdk.def file. If
	MS_LIB_AVAILABLE, build MS import library. Install the import
	libraries. If HAVE_WINTAB, link with the Wintab library.

	* gtk/Makefile.am: Add libgtk-win32-1.3.la target and associated
	macros and rules. Use -no-undefined on Win32. Use gtk-win32.def
	file. Install import libraries.
2001-10-29 07:06:37 +00:00