Compare commits

..

983 Commits

Author SHA1 Message Date
Matthias Clasen
5b2be2f6f1 GdkTouchCluster Clarify doc language
'Transient' is what was meant here, not 'transitive'.
2012-02-18 18:05:00 +01:00
Matthias Clasen
b51662cafa GdkCrossingMode: Remove duplicated doc entry 2012-02-18 18:05:00 +01:00
Carlos Garnacho
a328313885 gtk: Release captured events down the hierarchy
Instead of releasing directly onto the target widget,
release down the hierarchy as if uncaptured.
2012-02-18 18:05:00 +01:00
Carlos Garnacho
8528385c80 touchcluster: use an array to store touch IDs
A GList doesn't make much sense for storing guints, so
now a GArray is used internally.

gdk_touch_cluster_get_touches() has changed to return an
allocated guint*, and gdk_touch_cluster_get_n_touches()
has been added too.
2012-02-18 18:05:00 +01:00
Carlos Garnacho
c7eba11400 scrolledwindow: store whether the last button press was valid independently
Use a separate boolean instead of coding it up in the last button press
coordinates. This incidentally fixes 0-threshold on kinetic scrolling,
allowing the child widget to get button releases before it prematurely
gets ::grab-broken.
2012-02-18 17:48:54 +01:00
Carlos Garnacho
2cb50c9af2 scrolledwindow: Do not handle dnd-threshold=0
There's no need for it as the GtkSettings property has a lower
limit of 1.
2012-02-18 17:48:54 +01:00
Carlos Garnacho
bc5e401de4 docs: Add section about multitouch and other interaction patterns
This is a ripoff of http://live.gnome.org/GTK%2B/DeviceInteractionPatterns,
with better phrasing in general, some more factual points, and multitouch
explained.
2012-02-18 17:48:54 +01:00
Carlos Garnacho
fb99b5eeb4 improve docs for multitouch features 2012-02-18 17:48:53 +01:00
Carlos Garnacho
d6e23b0924 gtk,gestures: Only match 0-length strokes with homologous stock ones
Avoids spurious stroke matching with fleeting touches.
2012-02-18 17:48:53 +01:00
Carlos Garnacho
42c0d95791 gtk,gestures: Handle multitouch gestures
Gestures are only compared with stock gestures with the same number
of strokes. If a gesture consists of several strokes, the first stroke
is compared (and any possible angle skew is gotten from it), and then
the other strokes are correlated and also compared.

If there's no feasible correlation of strokes, or the gestures yield
an accumulated confidence that's below the threshold, the gesture is
not considered to match.

testgestures has been also added a simple 2-finger gesture for testing.
2012-02-18 17:48:53 +01:00
Carlos Garnacho
6d7ac9e87e textview: Set background on the widget's window
The widget window is usually covered by the bin_window,
this is just necessary so the parent scrolled window
picks the right color for drawing the overshoot area.
2012-02-18 17:48:53 +01:00
Carlos Garnacho
607a1e8fc5 iconview: Set background on the widget's window
The widget window is usually covered by the bin_window,
this is just necessary so the parent scrolled window
picks the right color for drawing the overshoot area.
2012-02-18 17:48:53 +01:00
Carlos Garnacho
02eeed70bd treeview: Set background on the widget's window
The widget window is usually covered by the bin_window,
this is just necessary so the parent scrolled window
picks the right color for drawing the overshoot area.
2012-02-18 17:48:53 +01:00
Carlos Garnacho
849661a573 scrolledwindow: Use the child widget's window bg color for the overshoot area
This makes the overshoot area seamless, if the child plays along.
2012-02-18 17:48:53 +01:00
Carlos Garnacho
ca84ac7a6a tests: only handle gestures on testgestures after the last stroke is lifted 2012-02-18 17:48:53 +01:00
Carlos Garnacho
8d421b2af2 gtkwidget: only emit ::gesture when the last stroke is lifted 2012-02-18 17:48:53 +01:00
Carlos Garnacho
b2776581da gtk,gestures: Add gtk_gestures_interpreter_get_n_active_strokes
This call gets the number of currently active strokes, finished
strokes (i.e. those that already had a GDK_BUTTON/TOUCH_RELEASE
processed) don't count.
2012-02-18 17:48:53 +01:00
Carlos Garnacho
f7eb9edb9b entry: Only allow press-and-hold on the text_area window
This avoids oddities in spinbuttons, press-and-hold shouldn't
be triggered on the buttons.
2012-02-18 17:48:53 +01:00
Carlos Garnacho
fe87311f51 gtk,pah: Don't cancel a ::press-and-hold that's scheduled to be activated
There was a slight window where the operation could be cancelled, causing
an assert as the p-a-h data is NULL.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
c38159d4d7 gdkwindow: Add device parameter to gdk_window_create_touch_cluster()
gdk_touch_cluster_set_device() had to be called right after anyway,
so set the device directly within this call, and favor the most common
scenario where there's just 1 single multitouch device behind 1 master
device.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
075911ccfd demos: Demonstrate further features in the multitouch demo
Now that GtkButton and GtkScale are multitouch approved, it's
sufficient to enable GDK_TOUCH_MASK on them to have them deal
with multitouch devices.

The scales set rgba of the currently selected rectangle, and
the button adds more rectangles, those can be manipulated
simultaneously together with the rectangles, the only limit
is the number of touches the touchscreen hw is able to detect.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
20a5364a5f gdk: Listen to touch events by default on the native window
GDK will only receive touch events when dealing with a multitouch
device, so these must be transformed to pointer events if the
client-side window receiving the event doesn't listen to touch
events, and the touch sequence the event is from does emulate
the pointer.

If a sequence emulates pointer events, it will result in a
button-press, N motions with GDK_BUTTON1_MASK set and a
button-release event, and it will deliver crossing events
as specified by the current device grab.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
4a3037574d gdk,devicemanager: Mark touch events emulating the pointer as such 2012-02-18 17:48:52 +01:00
Carlos Garnacho
fee9840d52 gdk: Only trigger motion hints machinery on motion events
Touch events have no need for it, plus the concept behind
gdk_event_request_motions() doesn't wrap around multiple
touches within a device.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
10bd4f8a72 gdk: Have touch grabs behave like the implicit grab wrt crossing events
These are equivalent to an implicit grab (with !owner_events), so
if the touch leaves or enters the grab window, the other window
won't receive the corresponding counter-event.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
1d986aa8a4 gtk,button: Handle touch events
Touch events don't generate crossing events themselves, so
do not rely on these to determine whether the button release
happened within the event window.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
33790437ce gtk,range: Don't perform a GTK+ grab
The implicit grab on priv->event_window already warrants that this
widget is the only one getting events while the button is pressed,
so don't spare the GTK+ grab here.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
239f52d543 gtk: rewrite touch events wrt the window group too
Likewise to pointer events, have touch events during a device
grab with owner_events=TRUE be delivered normally as long as
the widget pertains to the same window group.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
f2d71d3da5 gdk,csw: handle implicit touch grabs
If the touch sequence happens on a window with GDK_TOUCH_MASK set,
a GdkTouchGrabInfo is created to back it up. Else a device grab is
only created if the sequence emulates the pointer.

If both a device and a touch grab are present on a window, the later
of them both is obeyed, Any grab on the device happening after a
touch grab generates grab broken on all the windows an implicit
touch grab was going on, and all touches would be automatically
removed from every touch cluster.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
61e625d9a6 gdk,display: Add internal API to deal with touch implicit grabs
The necessary information about a touch implicit grab is stored in
GdkTouchGrabInfo structs, these are meant to be transient to the
touch sequence
2012-02-18 17:48:52 +01:00
Carlos Garnacho
9e3330c90b gdk,csw: Don't change window_under_pointer for pure touch events
Only touch events that emulate the pointer do change it.
2012-02-18 17:48:52 +01:00
Carlos Garnacho
108c831e23 gdk,xi2: set pointer emulated flags on events with XIPointerEmulated 2012-02-18 17:48:51 +01:00
Carlos Garnacho
77f071b5ff gdk: Add internal API to set "pointer emulated" flag on events
This flag will be used for non-pointer events that are emulated
from eg. touch events, or pointer events being emulated.
2012-02-18 17:48:51 +01:00
Carlos Garnacho
fb35e29a19 gdk,xi2: Set GDK_BUTTON1_MASK on touch events
GTK+ handles both touch and pointer events through the same
event handlers, so enable this modifier on touch events to
avoid much special casing.
2012-02-18 17:48:51 +01:00
Carlos Garnacho
b1f4497697 gdk,xi2: Only enable multitouch if the server reports XI2.2
This enables multitouch-enabled GTK+ to run on older X servers.
2012-02-18 17:48:51 +01:00
Carlos Garnacho
29569e6049 gdk,xi2: Update to latest XInput2.2 spec 2012-02-18 17:48:51 +01:00
Carlos Garnacho
c201145d02 gtk,pah: Handle press-and-hold on touch devices 2012-02-18 17:48:51 +01:00
Carlos Garnacho
eb214aae74 gdk: Add gdk_event_get_touch_area()
If given an event coming from a touch devices,
this functions will read the MT major/minor/orientation
axes and return a cairo_region_t with the touch shape.
2012-02-18 17:48:51 +01:00
Carlos Garnacho
fbef4384aa gestures: Add some unit tests 2012-02-18 17:48:51 +01:00
Carlos Garnacho
88909ac9b2 gtk: Document helper GtkWidget gestures API 2012-02-18 17:48:51 +01:00
Carlos Garnacho
84d9872a26 gestures: Add API documentation 2012-02-18 17:48:51 +01:00
Carlos Garnacho
576ba1a03d gtk: Add helper API to handle gestures
Although GtkGesturesInterpreter can be used standalone, GtkWidget
deserves helper API to enable support for gestures. gestures can
be enabled/disabled, and the ::gesture signal can be used to get
the gesture ID.

The internal GtkWidget gestures interpreter is only handled by
touch events, if gestures are needed for other devices, a
standalone gestures interpreter must be used.
2012-02-18 17:48:51 +01:00
Carlos Garnacho
bb448f619c tests: Add testgestures
This testcase handles all gestures offered by GtkGestureType,
and also creates and registers a custom M-shaped GtkGesture.
2012-02-18 17:48:51 +01:00
Carlos Garnacho
9827003e06 gestures: Implement gestures interpretation
The algorithm works on 2 GtkGestures, it finds out the similarity
of these by bending the user provided gesture so it equals a stock
one, the differences in areas are used to determine the level of
confidence on both gestures being similar.
2012-02-18 17:48:51 +01:00
Carlos Garnacho
14100b867c Add a gestures interpreter base implementation
This object is currently shallow, the API is defined but no gesture
interpretation is performed. Additional API is declared to create
and define gestures, which may consist of several strokes with an
offset.
2012-02-18 17:48:51 +01:00
Carlos Garnacho
5926e3cfec xi2: Use GDK_SOURCE_TOUCH for multitouch devices
Any device with XITouchValuatorClassInfo classes qualify as
multitouch now.
2012-02-18 17:48:50 +01:00
Carlos Garnacho
e09d7b5456 gdk: Update touch events to latest spec 2012-02-18 17:48:50 +01:00
Carlos Garnacho
c9b8f866df gtk-demo: Add multitouch demo
Pretty much ignores pointer events currently, so you're out
of luck to see anything happening at all if you don't have
a multitouch device...
2012-02-18 17:48:50 +01:00
Carlos Garnacho
eea525ac89 Add multitouch-event signal and vfunc to GtkWidget 2012-02-18 17:48:50 +01:00
Carlos Garnacho
76e7a9e5b7 Add machinery to emit GdkEventMultiTouch events
These events are created from GDK_TOUCH_MOTION/PRESS/RELEASE
events, if the touch ID generating the event is within a
touch cluster, that event is stored and not pushed to the queue,
so a touch ID can only emit GDK_TOUCH_* or GDK_MULTITOUCH_* events
at the same time.
2012-02-18 17:48:50 +01:00
Carlos Garnacho
5a523e500b Define GdkEventMultiTouch and its related event types.
This event will gather all touches within a GdkTouchCluster,
including an array of the latest GDK_TOUCH_MOTION events for
the touch IDs contained in there.
2012-02-18 17:48:50 +01:00
Carlos Garnacho
33ea7850c9 Add gdk_window_[create|remove]_touch_cluster()
These are the functions to create/destroy a GdkTouchCluster,
as they are associated to GdkWindows.
2012-02-18 17:48:50 +01:00
Carlos Garnacho
9856a2faeb Introduce GdkTouchCluster
This is a per-window/device object to gather a group of touch IDs
as a single entity.
2012-02-18 17:48:50 +01:00
Carlos Garnacho
a19c4b207c Add gdk_event_get_touch_id()
Just a helper function to get the touch ID from touch events, it
returns FALSE in any other case.
2012-02-18 17:48:50 +01:00
Carlos Garnacho
264739e6ad Make touch events go through csw/widget event handling.
In GtkWidget, touch events go through the same handler
than motion events, with the difference that touch_id
will have something meaningful there.

Touch events need to be explicitly selected, so if this
is enabled, the possibility of different motion streams
with different touch IDs must be handled in some way.
2012-02-18 17:48:50 +01:00
Carlos Garnacho
10b4eaa10b Handle TouchBegin/End events
These are translated into GDK_TOUCH_PRESS/RELEASE GdkEvents,
which use the GdkEventButton struct, a touch_id parameter
has been added there to cope with touches.
2012-02-18 17:48:50 +01:00
Carlos Garnacho
be21cc53bc Add initial handling of TouchMotion events.
GdkDeviceManagerXI2 now handles TouchMotion and TouchMotionUnowned
events, which are translated to GDK_TOUCH_MOTION events.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
cda35f142f Add touch motion event type and mask.
These events' struct is the same than GdkEventMotion, which has been
added a touch_id parameter. The gdk_event_* functions have been modified
to also handle this event type.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
5c98ea081e configure: Detect XInput 2.1 2012-02-18 17:48:49 +01:00
Carlos Garnacho
78866ca13d gdk,xi2: Add major/minor properties to XI2 device manager
This may be used to turn on/off the features that are added to
new XInput2 revisions.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
d4382300b4 gtk,range: Have slider jump to the pointer coordinates on touch devices
This widget is too narrow to make touch interaction tricky enough, so
don't add the penalty of having the slider run farther from the touch
coordinates if it happens to miss the slider.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
7ef01e70f7 gtk,scrolledwindow: Ensure the view snaps back when overshooting
Instead of just stopping the acceleration source ID, check whether
it's overshooting, and let it snap back if needed after ::grab-notify
and ::button-release-event
2012-02-18 17:48:49 +01:00
Carlos Garnacho
10316b6ab2 gtk,scrolledwindow: set slower inverse acceleration on the overshoot area
This is so snapping back is more fluid and noticeable.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
e11d9904bc gtk,scrolledwindow: Improve initial velocity calculation
Velocity calculation has been refactored out of the captured motion events
handler, and also has more tolerance defore determining that a drag is actually
still.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
f1d33f76c7 gtk,menu: Don't popdown submenus on button release for touch devices
This is so submenus stay open as the parent menu item is pressed/released,
as the user would typically lift the finger in order to select a submenu
item.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
fe72a8192d gtk,settings: Deprecate gtk-touchscreen-mode
It's not used anywhere in GTK+ anymore.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
bf543ac8f4 gtk,range: Remove gtk-touchscreen-mode usage
Emulated crossing events with mode GDK_CROSSING_TOUCH_PRESS/RELEASE
already catter dinamically for the "don't prelight on touch devices"
usecase.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
93f7a97f01 gtk,togglebutton: Remove gtk-touchcreen-mode usage
Emulated crossing events with mode GDK_CROSSING_TOUCH_PRESS/RELEASE
already catter dinamically for the "don't prelight on touch devices"
usecase.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
cc188dffa9 gtk,menushell: Remove gtk-touchscreen-mode usage
This usage in a keybinding signal is hardly related to touchscreens,
so just remove it.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
33e3b9ddbb gtk,menu: Remove gtk-touchscreen-mode from scrolling code
scrolling is handled via ::captured-event dynamically, so remove
this now unused code.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
8c4b0b66b8 gtk,menu: Select the first item for touch devices
This was done through gtk-touchscreen-mode, now is handled
dynamically on the current event source device.
2012-02-18 17:48:49 +01:00
Carlos Garnacho
2781c9544b gtk,menu: Implement scrolling through ::captured-event for touch devices
This makes overflown menus scrollable via direct manipulation. Once past
the threshold, the item below the pointer is unselected and scrolling
starts.
2012-02-18 17:48:48 +01:00
Carlos Garnacho
4765dde5cf gtk,menu: handle item selection for touch devices dynamically
Instead of using gtk-touchscreen-mode, the behavior changes depending
on the source device in use.
2012-02-18 17:48:48 +01:00
Carlos Garnacho
658b0e8092 gtk,textview: Pop up context menu on press-and-hold 2012-02-18 17:48:48 +01:00
Carlos Garnacho
0e5d05f8e0 gtk,textview: Also cancel DnD on ::grab-notify
If is about to start when the drag device is grabbed
somewhere else, unset drag start x/y so DnD doesn't
happen anyway.
2012-02-18 17:48:48 +01:00
Carlos Garnacho
f1570c5c92 gtk,entry: Pop up menu on press-and-hold 2012-02-18 17:48:48 +01:00
Carlos Garnacho
e042c53caa gtk,label: Pop up menu on press-and-hold 2012-02-18 17:48:48 +01:00
Carlos Garnacho
a7b6859561 xi2: Get the effective group state by ORing the XIGroupState values 2012-02-18 17:48:48 +01:00
Carlos Garnacho
14235c9c17 gdk: Ensure that GdkPointerWindowInfo is only generated for pointers 2012-02-18 17:48:48 +01:00
Carlos Garnacho
6a6bed8e04 gtk: Only set widget under device on non-virtual crossing events
_gtk_widget_set_device_window() is suppose to make accounting of
the topmost widget under the device at each time, so avoid setting
it on virtual crossing events as the device is already in another
window.
2012-02-18 17:48:48 +01:00
Carlos Garnacho
7a07995944 gtk,scrolledwindow: remove scrollbars auto-hide
This is in a really sorry state, and scrollbars need to be
thought out for the new design anyway.
2012-02-18 17:48:48 +01:00
Carlos Garnacho
62afe5cda6 gtk,scrolledwindow: capture crossing events when dragging
Also, instead of connecting 2 more times to ::captured-event,
have it all go through a single handler.
2012-02-18 17:48:48 +01:00
Carlos Garnacho
95f6b7fa82 gtk,scrolledwindow: Add GtkKineticScrollingFlags
gtk_scrolled_window_set_kinetic_scrolling() now takes a set of flags,
GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS makes the "capture button
press and maybe replay later" vs "let button press go through, but
trust in ::grab-broken to undo things" an opt-in, by default that
flag is set, which is the most conservative approach.
2012-02-18 17:48:48 +01:00
Carlos Garnacho
ae2438df90 gtk,scrolledwindow: Grab only after starting drag
This is so the grab doesn't break the implicit grab on the
child widget's window, which avoids that the button press and
release are possibly sent to different windows, and after the
grab was actually broken.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
fafb78e38e gdk: Generate crossing events around touch devices' press/release
Anytime a touch device interacts, the crossing events generation
will change to a touch mode where only events with mode
GDK_CROSSING_TOUCH_PRESS/RELEASE are handled, and those are sent
around button press/release. Those are virtual as the master
device may still stay on the window.

Whenever there is a switch of slave device (the user starts
using another non-touch device), a crossing event with mode
GDK_CROSSING_DEVICE_SWITCH may generated if needed, and the normal
crossing event handling is resumed.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
4068758bb8 gdk: Keep track of the last slave device used
This last slave device (stored per master) is used to fill
in the missing slave device in synthesized crossing events
not directly caused by a device event (ie. due to configure
events or grabs)
2012-02-18 17:48:47 +01:00
Carlos Garnacho
bb87595220 gtk,tooltips: Use the source device instead of gtk-touchscreen-mode
This makes tooltips behavior dynamic based on the interacting device.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
001a1517da gtk,scrolledwindow: Clamp early overshooting when snapping back
Fixes the situation where overshooting in scrolled windows with a
small viewport could end up overshooting right to the opposite
side, and then back again indefinitely.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
76b285f475 gtk: Handle motion hints for ::captured-event
Request automatically 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.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
0b796299c1 gtk,scrolledwindow: capture motions until the kinetic scrolling cancellation
If the widget which events are captured listens to motion hints, there
are situations where neither the scrolled window or the child widget
request more motions.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
5d2af3e13d gtk,pah: Show a bigger press-and-hold indicator on touchscreens
On touch devices it uses a 2.5cm diameter via gdk_screen_get_width_mm()
in the hope that it'll pop out of the finger area.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
15d2f1697d gtk,scrolledwindow: Unset dragging device on ::grab-notify
The child widget may still call gtk_(device_)grab_add, which left
the scrolled window in an inconsistent state.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
460a54ce15 gtk,scrolledwindow: Rework physics behind kinetic scrolling
The maths being used didn't resemble much about velocities or
friction/deceleration, so reimplement it in terms of velocity
vectors and decelerations, measured in pixels/ms^2.

Overshooting is also handled within the deceleration effect,
turning into a constant acceleration vector in the opposite
direction so it returns elastically within the boundaries.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
3ab0ccf643 gtk,scrolledwindow: Implement overshooting
An extra GdkWindow has been added, this window is the parent
of the child widget, and is the one getting resized/moved when
overshooting.

The unclamped adjustments' values are also stored in
GtkScrolledWindowPrivate as a separate value, overshooting is
pretty specific to GtkScrolledWindow and it isn't worth to
expose API in GtkAlignment for this single purpose.

This method allows GtkScrollable children to be blissfully
unaware of overshooting, as otherwise they'd have to handle
rather odd adjustment values themselves.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
cebd79e7eb gtk,scrolledwindow: Add window for overshooting
This window is the child widget's parent window, and will
be the one that's moved when overshooting.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
4e321365cf scrolledwindow: Handle nested scrolled windows in kinetic scrolling
The innermost scrolled window always gets to capture the events, all
scrolled windows above it just let the event go through. Ideally
reaching a limit on the innermost scrolled window would propagate
the dragging up the hierarchy in order to keep following the touch
coords, although that'd involve rather evil hacks just to cater
for broken UIs.
2012-02-18 17:48:47 +01:00
Carlos Garnacho
1b088606f7 gtk: Add event storing/replaying to GtkWidget::captured-event
It now returns a GtkCapturedEventFlags which tells whether the
widget captured the event, and additionally whether the event
should be stored for later replay.

gtk_widget_release_captured_events() has been added too so
all stored events are released onto the widget that was initially
to receive the events.
2012-02-18 17:48:46 +01:00
Carlos Garnacho
7bf410f927 scrolledwindow: Use event times when calculating deceleration
Using g_get_current_time() isn't going to be realistic on lagging
events.
2012-02-18 17:48:46 +01:00
Carlos Garnacho
5476f09d35 scrolledwindow: bypass kinetic scrolling if no scrollbars are shown 2012-02-18 17:48:46 +01:00
Carlos Garnacho
a49c9a27fb scrolledwindow: Remove priv->event_window
It looks like a leftover from pre-captured-event iterations of
the patch, it is completely unnecessary now.
2012-02-18 17:48:46 +01:00
Carlos Garnacho
e5a3cf5a36 scrolledwindow: Don't use p-a-h for the "let event go through" timeout
Just use a timeout there, the press-and-hold feedback is undesirable
here.
2012-02-18 17:48:46 +01:00
Carlos Garnacho
59a0f62079 gtk,pah: Hook directly into gtk_main_do_event()
Press and hold couldn't reasonably work if nested widgets
handle ::captured-event, once the widget inits press-and-hold,
it'd better also handle possible cancellation on motion and
button release, which isn't guaranteed with ::capture-event.

Also, tentatively start press-and-hold by default on the
grab_widget, and before event capturing happens, this avoids
awkward situations like the scrolled window preventing/delaying
press-and-hold to happen on the child textview for example.
2012-02-18 17:48:46 +01:00
Carlos Garnacho
fbbd6b2c2e scrolledwindow: Enable kinetic scrolling by default 2012-02-18 17:48:46 +01:00
Carlos Garnacho
d77977aa62 scrolledwindow: add another shortcut to bypass event capture
When clicked again close to the previous button press location
(assuming it had ~0 movement), the scrolled window wil allow
the child to handle the events immediately.

This is so the user doesn't have to wait to the p-a-h timeout
in order to operate on the scrolledwindow child.
2012-02-18 17:48:46 +01:00
Carlos Garnacho
da35350ee3 scrolledwindow: Only do kinetic scrolling on touch devices
This is sort of meaningless on pointer devices, besides it implies
a different input event handling on child widgets that's unnecessary
there.
2012-02-18 17:48:46 +01:00
Carlos Garnacho
40996af9c1 scrolledwindow: Don't crash on 0-sized motion buffer 2012-02-18 17:48:46 +01:00
Carlos Garnacho
7e29b38bd4 scrolledwindow: Set also a GTK+ grab on p-a-h scrolling
This is so the widget is ensured to receive the events
regardless of the pointer position.
2012-02-18 17:48:46 +01:00
Carlos Garnacho
c1b86a5eab scrolledwindow: Add GdkDevice parameter to ::press-and-hold handler 2012-02-18 17:48:46 +01:00
Carlos Garnacho
68587c203c gtk: Handle press-and-hold for touch devices
Also, only react to the first button
2012-02-18 17:48:46 +01:00
Carlos Garnacho
80e08d1b1b gtk: Add a GdkDevice parameter to ::press-and-hold
This would be useful when popping up menus, just so we
know what device to trigger it for.
2012-02-18 17:48:46 +01:00
Carlos Garnacho
0a05318277 gtk: Clean up press-and-hold code
The press and hold animation now fully relies on style context
transitions, finishing the p-a-h operation right after it
finishes. There's also no need to connect to ::drag-begin as
::grab-notify will also tell when a grab begins.
2012-02-18 17:48:45 +01:00
Carlos Garnacho
5c187245a4 tests: Add an entry to testpressandhold
Useful for checking behavior while selecting,
starting drags, subwindows...
2012-02-18 17:48:45 +01:00
Carlos Garnacho
739059cc91 entry: Handle ::grab-notify
Store the device, and unset private fields whenever the device
is shadowed by another GTK+ grab, so popping up menus while
selecting (i.e. press-and-hold) doesn't leave it in a confused
state.
2012-02-18 17:48:45 +01:00
Carlos Garnacho
86e966b944 gtk: Do not use deprecated APIs on press-and-hold 2012-02-18 17:48:45 +01:00
Carlos Garnacho
ef08d3975c tests: Update testkineticscrolling to use GtkGrid 2012-02-18 17:48:45 +01:00
Carlos Garnacho
c50007b33a gtk: connect to grab-notify for press and hold
This is so press and hold is cancelled if a click actually
causes an inner widget to do a GTK+ grab.
2012-02-18 17:48:45 +01:00
Carlos Garnacho
9f20e16683 gtk: Propagate ::captured-event up the hierarchy for crossing events 2012-02-18 17:48:45 +01:00
Carlos Garnacho
4f2ce2f7b6 gtk: emit ::captured-event starting from the GTK grab widget 2012-02-18 17:48:45 +01:00
Carlos Garcia Campos
a404a56254 scrolledwindow: Allow selections and drag-and-drop when kinetic scrolling is enabled
If the scrolling doesn't start after a long press, the scrolling is
cancelled and events are handled by child widget normally.
2012-02-18 17:48:45 +01:00
Carlos Garcia Campos
7a59b443ee Add GtkWidget::press-and-hold signal
Press-and-hold signal is emitted when the mouse button is pressed for a
given amount of time, specified in the new "press-and-hold-timeout"
GtkSetting. It's commonly used in mobile platforms to emulate a right
click to show a context menu. This patch is based on previous patches by
Kristian Rietveld and Danielle Madeley.

https://bugzilla.gnome.org/show_bug.cgi?id=315645
2012-02-18 17:48:45 +01:00
Carlos Garnacho
127bfd71d7 gtksettings: Set animation for press-and-hold through GtkStyleProvider
The "gtk-press-and-hold-timeout" setting has also been added, to control
its duration.
2012-02-18 17:48:45 +01:00
Carlos Garnacho
35341511b9 themingengine: Implement press-and-hold notification renderer
gtk_render_activity() uses it for the GTK_STYLE_CLASS_PRESS_AND_HOLD
style class.
2012-02-18 17:48:45 +01:00
Carlos Garcia Campos
65888ac515 scrolledwindow: Add auto-hide-scrollbars style property
To hide the scrollbars in kinetic mode when not scrolling.
2012-02-18 17:48:45 +01:00
Carlos Garcia Campos
313f51d1f8 tests: Add new test for kinetic scrolling 2012-02-18 17:48:44 +01:00
Carlos Garcia Campos
5ddf0f4e5f test: Add checkbox to enable/disable kinetic scrolling in scrolled window test 2012-02-18 17:48:44 +01:00
Carlos Garcia Campos
5e726db14e scrolledwindow: Initial kinetic scrolling support 2012-02-18 17:48:44 +01:00
Carlos Garcia Campos
705dde471f timeline: Add _gtk_timeline_get_elapsed_time()
To get the time in milliseconds since the last frame
2012-02-18 17:48:44 +01:00
Carlos Garcia Campos
d83640dc34 Add GtkWidget::captured-event signal
https://bugzilla.gnome.org/show_bug.cgi?id=641836
2012-02-18 17:48:44 +01:00
Carlos Garnacho
ed20c3255b gdk: Add GDK_SOURCE_TOUCH
This device source applies to touch capable devices, most
notably touchscreens.
2012-02-18 17:48:44 +01:00
Yaron Shahrabani
0a189935ad Updated Hebrew translation 2012-02-18 14:59:12 +02:00
Yaron Shahrabani
1f5681e419 Updated Hebrew translation. 2012-02-18 14:42:42 +02:00
Cosimo Cecchi
8dd4a0adf1 color-swatch: don't render our active badge if background-image is set
If the color active swatch has been set a background image from the
theme, use it as an asset, and do not draw our custom thing.
2012-02-18 09:55:45 +01:00
Cosimo Cecchi
dcec8dfdde color-swatch: render a background if the swatch doesn't have a color
We still want to call into the background rendering code, to draw the
default background.
2012-02-18 09:55:45 +01:00
Cosimo Cecchi
8e85702dca color-swatch: derive directly from GtkWidget
Instead of GtkDrawingArea, since that calls in realize
gtk_style_context_set_background(). We don't want that to happen, given
that we do all the painting ourselves in _draw().
2012-02-18 09:55:45 +01:00
Chao-Hsiung Liao
b58d50a0da Updated Traditional Chinese translation(Hong Kong and Taiwan) 2012-02-18 08:49:57 +08:00
Daniel Mustieles
1578585c08 Updated Spanish translation 2012-02-17 18:02:22 +01:00
Daniel Mustieles
a18b3f2ed4 Updated Spanish translation 2012-02-17 17:50:13 +01:00
Cosimo Cecchi
039eb8dc04 color-editor: mark the GtkColorSwatch as not selectable 2012-02-17 17:03:15 +01:00
Cosimo Cecchi
5f0c4fc20f color-swatch: add a "selectable" property to GtkColorSwatch
We don't want e.g. the swatch in GtkColorEditor to get the select badge
when it's clicked, so make this a property (on by default).
2012-02-17 17:03:15 +01:00
Fran Diéguez
04b36dabd0 Updated Galician translations 2012-02-16 15:00:06 +01:00
Claudio Saavedra
cfe65a0d6c GtkNotebook: and another fix
https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-16 12:33:26 +02:00
Claudio Saavedra
ccf7867c35 GtkNotebook: fix one child-notify emission
Forgot to increase the counter in the for loop, doing it now.

https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-16 12:28:46 +02:00
Benjamin Otte
bf89bc624b widget-factory: Don't crash when showing about dialog 2012-02-15 15:14:31 +01:00
Javier Jardón
392fdff8e5 docs: GtkWidget's "state-flags-changed" is a signal not a property 2012-02-15 13:43:58 +00:00
Daniel Mustieles
444f562955 Updated Spanish translation 2012-02-15 13:11:35 +01:00
Daniel Mustieles
db8555ed31 Updated Spanish translation 2012-02-15 13:05:43 +01:00
Daniel Mustieles
cc1b29cd67 Updated Spanish translation 2012-02-15 13:01:13 +01:00
Murray Cumming
a0b4ab109d Documentation: Correct references to properties.
These should use :, not ::, though signals would use ::.
See
http://developer.gnome.org/gtk-doc-manual/unstable/documenting_syntax.html.en
and
http://developer.gnome.org/gtk-doc-manual/unstable/documenting_symbols.html.en
2012-02-15 11:43:33 +01:00
Rico Tzschichholz
87d979f498 Remove obsolete reference to gtk.css.raleigh 2012-02-15 08:03:05 +01:00
Matthias Clasen
f9be52cb2f Add color and font chooser to the widget gallery 2012-02-14 23:48:36 -05:00
Matthias Clasen
fae1be06cd Docs: Reorder a sections 2012-02-14 23:36:02 -05:00
Matthias Clasen
e1a625aa78 GtkColorSwatch: Add accessible actions 2012-02-14 21:16:52 -05:00
Claudio Saavedra
347328adb0 GtkNotebook: emit child-notify::position on drag 'n drop reorder
https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-15 01:05:12 +02:00
Claudio Saavedra
cb775a6a6d GtkNotebook: emit child-notify::position on page add/removal
For each page added/removed, notify all the other children changing
position.

https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-15 01:05:12 +02:00
Matthias Clasen
6c2b7a9441 Revert "Add a button to back to the palette"
This reverts commit 32f1a5ad83.
2012-02-14 16:39:05 -05:00
Cosimo Cecchi
bef12c003c color-scale: remove Adwaita GtkColorScale trough hack
Instead of special-casing Adwaita, apply the half-width logic for themes
that have a scale slider with vertical proportions.
Also, simplify the rendering code a bit by factoring out the trough
sizing logic.
2012-02-14 16:37:05 -05:00
Cosimo Cecchi
19da38b811 colorchooser: factor out a private method to get the checkboard pattern
And use it in the color widgets.
2012-02-14 16:37:04 -05:00
Matthias Clasen
453aecd346 Improve a11y names for colors
Only read alpha if it is != 1, and read percentages also for
'unnamed' palette colors.
2012-02-14 16:37:04 -05:00
Matthias Clasen
2d57c5c374 Update TODO 2012-02-14 16:37:04 -05:00
Matthias Clasen
c2426516c4 Update POTFILES 2012-02-14 16:37:04 -05:00
Matthias Clasen
18ea4825cf Mark color names as translatable 2012-02-14 16:37:04 -05:00
Matthias Clasen
1f698e4f62 GtkColorScale: fix an RTL issue
When using a horizontal scale in RTL, we need to flip the
background image to go along with the flipped scale.
2012-02-14 16:37:04 -05:00
Cosimo Cecchi
49a23acd89 test-toplevelembed: use new GtkColorChooserDialog 2012-02-14 16:37:03 -05:00
Cosimo Cecchi
80f0feda98 testgtk: use GtkColorChooserDialog instead of GtkColorSelectionDialog 2012-02-14 16:37:03 -05:00
Cosimo Cecchi
06b34b3fc1 prop-editor: don't use GtkColorButton deprecated API 2012-02-14 16:37:02 -05:00
Cosimo Cecchi
92322a63f5 gtk-demo: use the new GtkColorChooserDialog in the color demo 2012-02-14 16:37:02 -05:00
Cosimo Cecchi
5e77e1c117 colorsel: include gtkcolorutils.h
Fix the build
2012-02-14 16:37:02 -05:00
Cosimo Cecchi
6dbb4d6384 color-widget: don't use a GtkAlignment to center the color editor
We can just use a GtkBox, and set hexpand=TRUE/halign=CENTER to allocate
the editor in the middle of the box.
2012-02-14 16:37:01 -05:00
Cosimo Cecchi
988cbb6300 color-editor: don't use a GtkAlignment to layout popups
Set a margin on the contents and use a box instead.
2012-02-14 16:37:01 -05:00
Cosimo Cecchi
1cbaca6c60 color-editor: don't use an alignment to give the popup extra space 2012-02-14 16:37:01 -05:00
Cosimo Cecchi
2abe72283e color-editor: also set a row spacing in the popup tooltip 2012-02-14 16:37:01 -05:00
Cosimo Cecchi
126e941466 color-button: simplify internal children
Instead of going GtkAlignment->GtkFrame->GtkAlignment, just pack a
GtkDrawingArea inside the button, and use halign/margin properties to
get the desired layout.
2012-02-14 16:37:01 -05:00
Cosimo Cecchi
51c6e8329d color-swatch: cleanup unused property enum value 2012-02-14 16:37:01 -05:00
Matthias Clasen
91b4781ae9 Revert an accidental commit 2012-02-14 16:37:00 -05:00
Matthias Clasen
92618eb8e2 GtkColorSwatch: Use widget state instead of a custom 'selected' 2012-02-14 16:37:00 -05:00
Matthias Clasen
9cc827fcd1 A11y improvements 2012-02-14 16:37:00 -05:00
Matthias Clasen
40974b1463 GtkColorSwatch: Drop an unnecessary field 2012-02-14 16:37:00 -05:00
Matthias Clasen
dc1929a9de Avoid a 10th custom color 2012-02-14 16:37:00 -05:00
Matthias Clasen
57e057df60 Fill the custom palette up some more 2012-02-14 16:37:00 -05:00
Matthias Clasen
32f1a5ad83 Add a button to back to the palette
This is just for trying this out; if it is considered good,
it will be moved into GtkColorChooserDialog
2012-02-14 16:36:59 -05:00
Matthias Clasen
1f05f94885 GtkColorChooserDialog: propagate notification for ::show-editor 2012-02-14 16:36:59 -05:00
Matthias Clasen
05e2124f24 GtkColorChooserWidget: emit notification for ::show-editor 2012-02-14 16:36:59 -05:00
Matthias Clasen
1fd311803a Document gtk_color_chooser_add_palette 2012-02-14 16:36:59 -05:00
Matthias Clasen
7f44feab19 Fix use_alpha initialization and propagation
We must set use_alpha to TRUE initially, and when passing it
down to the swatches, we must iterate over the custom box, too.
2012-02-14 16:36:59 -05:00
Matthias Clasen
3a7ed2e7bd Remove unused variables 2012-02-14 16:36:59 -05:00
Matthias Clasen
bad24bc119 Consistently private headers
Add a 'private' suffix to all newly introduced private
headers.
2012-02-14 16:36:58 -05:00
Matthias Clasen
5aaeaa7b81 Fix the build
A G_BEGIN_DECLS went missing here.
2012-02-14 16:36:58 -05:00
Cosimo Cecchi
bcc4186388 color-swatch: remove gtk_color_swatch_set_corner_radii()
It's unused now.
2012-02-14 16:36:58 -05:00
Cosimo Cecchi
74a53b542b color-widget: use a GtkBox for the custom section
Since we only allow a single row there, it's better to just use a
GtkBox, and use :first-child, :last-child and :only-child to style
swatches in there.
2012-02-14 16:36:58 -05:00
Cosimo Cecchi
9da3d8b7b9 color-widget: add LEFT/RIGHT/TOP/BOTTOM style classes to the swatches
As we add them to the grid, for setting theming properties.
2012-02-14 16:36:58 -05:00
Cosimo Cecchi
73944c6e81 color-editor: don't call gtk_color_swatch_set_corner_radii()
It's going away.
2012-02-14 16:36:58 -05:00
Cosimo Cecchi
a9c2a586b1 color-swatch: don't hardcode list-add-symbolic as swatch icon
We have that as a property, we should use it.
2012-02-14 16:36:57 -05:00
Cosimo Cecchi
83de34882b color-swatch: allow styling the "active badge"
Instead of calling gtk_render_check() there, just render a symbolic
icon, falling back to a built-in one if the icon is not available.
Also, add a style class for the active badge on the swatch:
"color-active-badge".
2012-02-14 16:36:57 -05:00
Cosimo Cecchi
1ccedc5fa4 color-swatch: use GtkThemingBackground to draw the background
This allows e.g. for the corner radii to be styled directly from the
theme.
2012-02-14 16:36:57 -05:00
Cosimo Cecchi
33e54e45be color-swatch: add a color-light/color-dark style class for intensity
Themes might want to set different colors on the badge if the displayed
color is light or dark. Use a style class for this when we set a color
on the swatch.
2012-02-14 16:36:57 -05:00
Cosimo Cecchi
46187037a3 themingbackground: make it based on GtkStyleContext
Instead of GtkThemingEngine. This will allow for the object to be also
used from inside e.g. a _draw() method.
2012-02-14 16:36:57 -05:00
Cosimo Cecchi
ae132c0a1a roundedbox: add _apply_border_radius() variations for engine/context
And make the base function just use the raw corner radii struct.
2012-02-14 16:36:56 -05:00
Cosimo Cecchi
4c61f1f663 themingengine: add a private _gtk_theming_engine_get_context()
We'll need this later.
2012-02-14 16:36:56 -05:00
Cosimo Cecchi
4e37d56d51 themingengine: move _gtk_theming_engine_set_context to private header
Where it belongs.
2012-02-14 16:36:56 -05:00
Matthias Clasen
8f201d62d9 Add API to set palettes
I'm not really convinced by this; the API is a little complicated.
May need more thought.
2012-02-14 16:36:56 -05:00
Matthias Clasen
d7cff0797e Misc cleanups 2012-02-14 16:36:56 -05:00
Matthias Clasen
ed5aa953d5 testcolorchooser: Add more options
Add a --edit option that brings the color chooser up in
single-color edit mode right away.
2012-02-14 16:36:56 -05:00
Matthias Clasen
cb128cc6e9 Deprecate old color selection widgets
GtkColorSelectionDialog, GtkColorSelection and GtkHSV have
been superseded by the GtkColorChooser* family of widgets.
2012-02-14 16:36:55 -05:00
Matthias Clasen
23a5f7a22c Add docs 2012-02-14 16:36:55 -05:00
Matthias Clasen
03a2b338ee Small documentation tweaks in font choosers 2012-02-14 16:36:55 -05:00
Matthias Clasen
c5cfb6e02b Rework the API a bit
Rename get/set_color to get/set_rgba and show_alpha to use_alpha,
to match existing GtkColorButton API and let GtkColorButton implement
GtkColorChooser.
2012-02-14 16:36:55 -05:00
Matthias Clasen
1f68d7d827 Simplify GtkColorScale private api a bit 2012-02-14 16:36:55 -05:00
Matthias Clasen
6ed16b5b41 Fix up exported symbols
Only GtkColorChooser* is public for now.
2012-02-14 16:36:54 -05:00
Matthias Clasen
43ffb8521d Add a small comments 2012-02-14 16:36:54 -05:00
Matthias Clasen
1f7cc92219 Dismiss popups on show
This ensures that the editor always comes up without popups,
even when it is reused.
2012-02-14 16:36:54 -05:00
Matthias Clasen
3f92e24cb7 Add more todos 2012-02-14 16:36:54 -05:00
Matthias Clasen
cc127c64a9 Add some accessible labels 2012-02-14 16:36:54 -05:00
Matthias Clasen
327e36e360 Mark strings for translation 2012-02-14 16:36:53 -05:00
Matthias Clasen
f2aaffaf07 Finishing touches
Implement popups in the editor, fix window sizing, fix RTL flipping.
GtkColorPlane is now using adjustments, and GtkColorEditor is using
adjustments as its model as well.
2012-02-14 16:36:53 -05:00
Matthias Clasen
cd300835d7 Allow context menus on scale sliders
This will be used for a popup in the color chooser.
2012-02-14 16:36:53 -05:00
Matthias Clasen
e56adaebea Only activate on double-click 2012-02-14 16:36:53 -05:00
Matthias Clasen
dbbe4c12fa Remove an erraneous g_free call 2012-02-14 16:36:53 -05:00
Matthias Clasen
296cd814e5 Add an Adwaita hack
When the theme is Adwaita, let the thumb extend out over the
colored trough.
2012-02-14 16:36:53 -05:00
Matthias Clasen
5bd4c234fb Draw no trough for color scales 2012-02-14 16:36:52 -05:00
Matthias Clasen
4226551fff Move color scales into separate widget 2012-02-14 16:36:52 -05:00
Matthias Clasen
bdb8931bda Fix a few problems with custom color replacement
We were allowing one too many custom colors in, and when one
of them was dropped, we did not update the shape of the penultimate
one.
2012-02-14 16:36:52 -05:00
Matthias Clasen
3a35895a00 Make color chooser always come up with palette 2012-02-14 16:36:52 -05:00
Matthias Clasen
d3b30bff0c Show new color chooser from color button 2012-02-14 16:36:52 -05:00
Matthias Clasen
2a8d3f78e9 Use a swatch in the editor
For now, we simply make it insensitive to turn off unwanted
interactivity.
2012-02-14 16:36:51 -05:00
Matthias Clasen
ff1f5de62f Don't waste memory 2012-02-14 16:36:51 -05:00
Matthias Clasen
1720e8ebf3 Preliminary color sliders 2012-02-14 16:36:51 -05:00
Matthias Clasen
8178578359 Make alpha optional 2012-02-14 16:36:51 -05:00
Matthias Clasen
8d1565df94 Show alpha in the palette as well 2012-02-14 16:36:51 -05:00
Matthias Clasen
9161119329 No popup menu on the button 2012-02-14 16:36:50 -05:00
Matthias Clasen
9b81322409 Make saving custom colors work as intended
The custom colors are now pushed over to the right as new ones
are added, and everything beyond the 9th row gets dropped.
Customized colors are added to the custom colors array.
2012-02-14 16:36:50 -05:00
Matthias Clasen
e1bf3b6650 Choose a different initial color when adding custom colors
Going for pure red 'hides' the hairline at the edge of the
plane. This color makes it nicely visible.
2012-02-14 16:36:50 -05:00
Jon McCann
efccf87961 Show editor when clicking custom button 2012-02-14 16:36:50 -05:00
Jon McCann
2c24e3cb6a Align label with swatches 2012-02-14 16:36:50 -05:00
Jon McCann
ce8212c5a8 Add Tangoish grayscales 2012-02-14 16:36:50 -05:00
Jon McCann
ea6ac7131e Use the Tango palette by default 2012-02-14 16:36:49 -05:00
Matthias Clasen
e06ccb0fbb Move the plane into a separate widget 2012-02-14 16:36:49 -05:00
Matthias Clasen
021f5e0365 Initial work on a color editor
This replaces GtkHSV with a compound widget featuring
a hue slider and an sv-plane, amongst others.
2012-02-14 16:36:49 -05:00
Matthias Clasen
759765114f Add a simple color chooser test 2012-02-14 16:36:49 -05:00
Matthias Clasen
3b6e316e74 Initial cut at implementing a new color chooser
This is a partial implementation of
https://live.gnome.org/GnomeOS/Design/Whiteboards/ColorSelection
The new color editor has not been implemented yet.
2012-02-14 16:36:49 -05:00
Matthias Clasen
e2bde55277 Remove leftover debug spew 2012-02-14 13:08:27 -05:00
Cosimo Cecchi
abdbe207fe about-dialog: set proper spacing between columnns in credits section
Spacing ended up being really tight; add another 6px.

https://bugzilla.gnome.org/show_bug.cgi?id=668114
2012-02-14 11:26:16 -05:00
Cosimo Cecchi
a04fa5300a about-dialog: don't set a margin around the license area
Make it consistent with the credits page.

https://bugzilla.gnome.org/show_bug.cgi?id=670077
2012-02-14 11:21:52 -05:00
Cosimo Cecchi
8dc9866e2a about-dialog: add a stroke around the credits area
Makes it consistent with e.g. the license page.

https://bugzilla.gnome.org/show_bug.cgi?id=670078
2012-02-14 11:19:04 -05:00
Alexander Larsson
4b200a0429 Set a bg on GtkViewport to ensure we get fast scrolling
Otherwise it will use the default alpha transparency and
not scroll efficiently.
2012-02-14 15:18:30 +01:00
Cosimo Cecchi
713c532940 treeview: don't use gtk_render_focus() for dnd indicator
There's no reason this should be a focus ring rather than an actual
frame. In the past this was probably used to get a dashed effect, but
now we even support that natively for borders.
2012-02-13 22:43:07 -05:00
Cosimo Cecchi
a3b097639f treeview: set "dnd" style class when drawing drag and drop indicators
This is useful to theme the rings that appear around rows on drag and
drop.
2012-02-13 22:19:53 -05:00
Alexander Larsson
42c2d51ad9 Always make offscreen window rgba
This fixes issues where the new default bg of transparent
didn't work, making offscreen windows black.

I don't think this is a practical performance problem.
Offscreen windows are rarely used and generally used for
graphics tricks like alpha anyway.
2012-02-13 15:06:09 +01:00
Alexander Larsson
2d972058ab Fix up win32 CSS
Now that we removed the default css a lot of stuff needed fixing
2012-02-13 12:24:06 +01:00
Murray Cumming
842d3ac53d GtkButton: Small documentation improvements 2012-02-13 09:18:07 +01:00
Benjamin Otte
90e65f30ab a11y: Mark cells as defunct when deleting them
Just unreffing isn't enough, atk-bridge might have a reference to the
object still.
2012-02-12 16:45:14 +01:00
Matthias Clasen
a96c122fa4 Plug a small memory leak 2012-02-11 13:06:12 -05:00
Benjamin Otte
194a48bd4a a11y: Redo ref_accessible_at_point()
use direct access to the RBTree instead of fiddling with the path.

Removes the lat caller of get_index() and with it count_rows(), so those
are gone now.
2012-02-11 05:11:00 +01:00
Benjamin Otte
01193bcae2 tests: Reenable a11y tree-relationships test
It passes now.
2012-02-11 04:46:43 +01:00
Benjamin Otte
3827d75f64 a11y: create focus cell accessibles when they get focused 2012-02-11 04:44:27 +01:00
Benjamin Otte
bf8d9ceb2f a11y: Split out cell creation function 2012-02-11 04:41:45 +01:00
Benjamin Otte
315ac9413b a11y: Set relations without tree path
We can directly use at the rbtree's parent.
2012-02-11 04:13:04 +01:00
Benjamin Otte
6130c65470 a11y: Remove unused variable 2012-02-11 03:42:14 +01:00
Benjamin Otte
da30c8253b a11y: Keep treeview accessibles around
Refcounting behavior kinda requires that we track of accessibles until
the row goes away. This is necessary for reference handling and for some
assumptions that atk-bridge does.
2012-02-11 03:37:25 +01:00
Benjamin Otte
5e587229c8 a11y: Remove old treeview focus tracking code 2012-02-11 03:14:22 +01:00
Benjamin Otte
24db6d7a6f a11y: Emit focus change events when focus cell changes 2012-02-11 03:02:20 +01:00
Benjamin Otte
5fe947640c treeview: Add internal get_cursor_node() API 2012-02-11 03:02:20 +01:00
Benjamin Otte
07f8336dbd a11y: Update treeview focused status
... when the cursor row changes. Also emit active-descendant-changed.
2012-02-11 02:50:26 +01:00
Benjamin Otte
00a810ae04 treeview: Add private get_focus_column() API 2012-02-11 02:49:12 +01:00
Benjamin Otte
f90ff5d50b treeview: Notify accessible about focus changes 2012-02-11 02:38:48 +01:00
Benjamin Otte
a4559f1e19 treeview: Tell accessible about focus column changes 2012-02-11 01:59:19 +01:00
Sebastian Keller
f33fe5b677 docs: Add documentation for alpha() in CSS 2012-02-11 01:48:03 +01:00
Claudio Saavedra
e2339f5ebd GtkNotebook: emit child-notify::position a few more times
When moving a page around, all children changing their position
need to be notified.

There are still other places where proper notification is missing
(drag 'n drop, etc.)

https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-10 16:39:44 +02:00
Benjamin Otte
3b1d8beab0 accessible: Unset widget on dispose, not finalize
Unsetting the widget causes events to get emitted and we want to
(a) really emit that event to our signal handlers
(b) still be recognized as a real GObject while doing that

https://bugzilla.gnome.org/show_bug.cgi?id=669794
2012-02-10 13:21:06 +01:00
Benjamin Otte
5e3c2524f8 reftests: Add a test for misrendering of transparent windows
If a widget with a GDK window is set to be transparent in the CSS, it
gets drawn as black instead. This test checks that the fix works.
2012-02-10 11:46:19 +01:00
Ryan Lortie
6d430ad713 widget factory: link against gdkpixbuf
Otherwise we fail to link, seeing this:

/usr/bin/ld: gtk3_widget_factory-widget-factory.o: undefined reference
to symbol 'gdk_pixbuf_new_from_resource'
2012-02-09 17:54:22 -05:00
Rui Matos
db2eb85e4a x11: Cancel _NET_WM_MOVERESIZE if we get a matching ButtonRelease
This implements the following part of the EWMH spec:

"The special value _NET_WM_MOVERESIZE_CANCEL also allows clients to cancel the
operation by sending such message if they detect the release themselves
(clients should send it if they get the button release after sending the move
resize message, indicating that the WM did not get a grab in time to get the
release)."

In particular, it fixes the case of clicking widgets that use
gdk_window_begin_[resize|move]_drag*() and the click "sticking", i.e. the
mouse button getting released but the resize or move operation remaining in
effect.

https://bugzilla.gnome.org/show_bug.cgi?id=669208
2012-02-09 23:44:09 +01:00
Alexander Larsson
cdc6e82720 Remove all default css and make Raleigh a pure fallback theme
It was problematic to maintain Raleigh going forward, as any
changes in it affected all themes. Also, its more robust if
each theme is a full standalone css rather than relying on
an inherited css base.

So, this changes Raleigh to a standalone theme that we can tweak
without accidentally breaking other themes, and makes the
default theme empty. In fact, we don't even add the default
provider anymore as its always empty.
2012-02-09 23:19:17 +01:00
Piotr Drąg
7de0672650 Updated POTFILES.skip 2012-02-09 21:32:56 +01:00
Alexander Larsson
251cffb638 Fix transparency handling with non-double-buffered drawing
Sometimes we need to read back the window content into our double
buffer due to rendering a window with alpha when there is
no implicit paint or it has been flushed due to non-db drawing
before.

However, in this case we can't use gdk_cairo_set_source_window as
it might trigger an implicit paint flush as we detect what we
think is a direct non-double buffered window draw operation, which
will flush the implicit paint operation that we're just setting up.

To fix this we use the raw gdk_window_ref_impl_surface operation
to get the source surface.
2012-02-09 21:14:07 +01:00
Alexander Larsson
5d9736fe13 Fix non-double-buffered drawing
There was a sign issue in a coordinate transform that made us
flush the wrong region when flushing an implicit paint.
The non-double buffered drawing would then be drawn over the
right area, but then at the end of the implicit paint this
would be overdrawn with the area we didn't properly remove
from the implicit paint.

Also, the translation from window coords to impl window
coords is now done before removing any active double
buffered paints, as these are also in impl window coords.
2012-02-09 21:14:07 +01:00
Kalev Lember
b21dd67d60 win32: Don't crash when installed in a top-level directory
Avoid NULL-pointer dereference when package installation directory
doesn't contain any slashes.

Reported by Paweł Forysiuk.
2012-02-09 17:58:21 +02:00
Alexander Larsson
fed1cfb122 Make the default background for GdkWindows transparent
With the changes in default CSS to make the default background transparent
we ran into issues where intermediate GdkWindow (for instance the
view_window in GtkViewport) where we didn't set an explicit background
(because before they were always covered). So instead of showing throught
the transparent windows were showing the default backgroind of the intermediate
window (i.e. black).

With this change we also needed to fix GtkViewport, as it was previously
relying on the bin and view windows to cover widget->window so that the
border was not visible if shadow_type was NONE.
2012-02-09 16:39:23 +01:00
Alexander Larsson
6723feae8a viewport: Set frame styleclass when getting border size during size allocation
Without this you don't get the right border/padding for widget->window
and the border shows up under the scrolled contents.
2012-02-09 16:39:23 +01:00
Matthias Clasen
c525fe27f3 Set BUILT_SOURCES 2012-02-09 09:10:50 -05:00
Matthias Clasen
56f8cf91e0 widget-factory: add the logo 2012-02-09 09:06:32 -05:00
Matthias Clasen
71efe31f16 Move widget-factory to demos/
Lets install this, for the benefit of artists everywhere.
2012-02-09 08:45:40 -05:00
Matthias Clasen
41e98b14d3 gtk-demo: Use preprocessing for resources
Strip blanks from ui files, and convert pngs into pixdata.
This is useful and serves as a test of these preprocessing
options at the same time.
2012-02-09 08:08:23 -05:00
Matthias Clasen
72ede43928 gtk-demo: Use gdk-pixbuf resource api
This is nicer than manual stream manipulation.
2012-02-09 08:08:23 -05:00
Matthias Clasen
b4c31b070f widget-factory: add an about dialog
This is a first step towards making widget-factory an installed
demo.
2012-02-09 08:08:23 -05:00
Baurzhan Muftakhidinov
bc95f03f37 [l10n] Updated Kazakh translation 2012-02-09 15:09:30 +06:00
Matthias Clasen
c2512d1c03 Avoid a C99ism
Move variable declarations to the beginning of the block.
https://bugzilla.gnome.org/show_bug.cgi?id=669511
2012-02-08 07:26:25 -05:00
Diego Escalante Urrelo
63865720b7 gtkbuilder-menus: translation-domain can be NULL
GtkBuilder defaults its translation-domain to NULL, which is a perfectly
fine value for d_gettext() and friends.

https://bugzilla.gnome.org/show_bug.cgi?id=669638
2012-02-08 04:36:26 -05:00
Diego Escalante Urrelo
a0f6fc137b gtkactiongroup: clarify set_translation_domain docs
NULL is an actual useful value for
gtk_action_group_set_translation_domain, but this information is buried
in g_dgettext() documentation.

Be extra redundant, to make it obvious that NULL is ok.

https://bugzilla.gnome.org/show_bug.cgi?id=669636
2012-02-08 04:36:26 -05:00
Mattias Põldaru
afcd3c9f70 [l10n] Updated Estonian translation 2012-02-08 10:59:07 +02:00
Matthias Clasen
9a2ea96a1b Bump version 2012-02-06 17:32:46 -05:00
Matthias Clasen
de1b5e67b6 3.3.14 2012-02-06 16:38:47 -05:00
Matthias Clasen
20c3f95e7b Adapt expected output
A recent string change in GtkAboutDialog needs to be reflected
here.
2012-02-06 16:11:27 -05:00
Benjamin Otte
33864064f4 tests: Remove untrue assertion
Even if something is not at the top, things might still not be scrolled.
For example in the case where things are exactly at the center.
2012-02-06 21:53:36 +01:00
Benjamin Otte
75eddfffbb tests: Don't test something we can't test
When using GtkTreeStore, don't compute row positions assuming
everything's a list store, which is how get_row_start_for_index() works.

So instead, do a laxer check and don't insist on proper alignment.
2012-02-06 21:53:35 +01:00
Benjamin Otte
6a381b0c1d tests: Remove unused argument from treeview-scrolling test 2012-02-06 21:53:35 +01:00
Matthias Clasen
9e14789b63 Work around a drawing problem with small notebooks 2012-02-06 15:50:40 -05:00
Matthias Clasen
137bab8710 More resetting 2012-02-06 15:43:47 -05:00
Matthias Clasen
9ec7d6b68e Use larger screen for tests
We used to run Xvfb with 800x600, which turns out to be too small
for some of our reftests. Bump it to 1024x768.
2012-02-06 15:09:24 -05:00
Matthias Clasen
ac9a94b7af Fix declarations-valid-15 css parser test 2012-02-06 14:44:21 -05:00
Benjamin Otte
40a89fccb5 reftests: Fix background-origin reftest for all themes
We want to @import reset-to-defaults.css here.
2012-02-06 20:43:05 +01:00
Benjamin Otte
33961154b6 tests: Fix height checks in treeview scrolling test
If things get centered in the scrolling area depens on the height of the
row, too.
2012-02-06 20:43:05 +01:00
Benjamin Otte
c2a6dcc73c tests: Fix assertion emission
We want to assert() when doing the actual check, not do some
  g_assert (testing_failed());
2012-02-06 20:43:05 +01:00
Matthias Clasen
b5d5e6427a Fix declarations-valid-14 css parser test 2012-02-06 14:06:20 -05:00
Matthias Clasen
81465d2d97 Updates 2012-02-06 11:51:34 -05:00
Alexander Larsson
cb625d21b4 Fix leak when parsing image urls 2012-02-06 15:06:29 +01:00
Swecha Localization Team
af200feb0e Updated Telugu Translations 2012-02-06 17:30:09 +05:30
Piotr Drąg
bd05c1f959 Add bloatpad to POTFILES.skip
It doesn't break the build yet, but it will once intltool is fixed to accept translatable='yes'
2012-02-06 02:38:25 +01:00
Matthias Clasen
c064bdb00c Mark strings as translable in bloatpad
We don't have any intention of actually translating bloatpad,
but this ends up as example in the docs.
2012-02-05 19:12:41 -05:00
Matthias Clasen
a45b3df9d0 Bump requirements of glib and gdk-pixbuf 2012-02-05 17:56:22 -05:00
Fran Diéguez
68f51ee980 Updated Galician translations 2012-02-05 23:45:17 +01:00
Kjartan Maraas
aa390b5e57 Updated Norwegian bokmål translation 2012-02-04 12:31:58 +01:00
Daniel Mustieles
8971d5ed74 Updated Spanish translation 2012-02-03 18:06:49 +01:00
Ignacio Casal Quinteiro
022e17afbc aboutdialog: add a \n in the copyright text 2012-02-03 17:13:38 +01:00
Alexander Larsson
fb0c53a0ed Fix crash with theme resource file
The freeing the GResource in gtk_css_provider_reset caused problems
because it was called from gtk_css_provider_load_from_path() inside
gtk_css_provider_get_named(). We fix this by delaying the
setting of priv->resource until we successfully loaded the file.
2012-02-03 16:37:54 +01:00
Alexander Larsson
6b2f10321f Remove accidental leftover spew 2012-02-03 16:27:32 +01:00
Alexander Larsson
b5b9965283 css: Remove any loaded resource in gtk_css_provider_reset 2012-02-03 16:01:51 +01:00
Alexander Larsson
610ea728b2 Special case resource pixbuf files loading
This means we can share the pixbuf data when using GdkPixdata
images in the resource.
2012-02-03 15:51:55 +01:00
Alexander Larsson
57386285fa Support a gtk.gresource file in themes
This lets themes install a .gresource for efficient loading
of resources. This resource file will (if it exists) be automatically
loaded (mmaped) when the theme is used and unloaded when not used.
2012-02-03 15:50:49 +01:00
Piotr Drąg
35db0819ff Updated POTFILES.skip 2012-02-02 17:25:40 +01:00
Daniel Mustieles
fa3544e744 Updated Spanish translation 2012-02-02 12:13:29 +01:00
Benjamin Otte
f855238cc7 reftests: Improve 'unresolvable' test
Include reset-to-defaults here, too
2012-02-02 03:14:02 +01:00
Benjamin Otte
8cdbebae71 reftests: Fix css-match-exact
Ensure that background-colors are always set. And import
reset-to-defaults so that there's no background image or so.
2012-02-02 03:14:02 +01:00
Benjamin Otte
1484208b4c reftests: Fix entry-progress-coloring test
Use reset-to-defaults here.
2012-02-02 03:14:02 +01:00
Benjamin Otte
bc1a689e55 reftests: Add another background-size test
This one tests the keywords for the background-size property
2012-02-02 03:14:02 +01:00
Benjamin Otte
e84af235ee css: Implement padding as numbers
Also remove the now unused border parsing function for shorthands.
2012-02-02 03:14:02 +01:00
Benjamin Otte
f2352a5f35 reftests: Fix border-image-url reftest
"border-style: none;" sets border widths to 0. So no border was drawn.
Use "border-style: groove" instead. (If the border was drawn that way,
it'd look noticably different.)

Also include reset-to-defaults.css so we really get default CSS.
2012-02-02 03:14:02 +01:00
Benjamin Otte
2fdadb053c tests: Add 'px' to css tests 2012-02-02 03:14:02 +01:00
Benjamin Otte
f1c73fcc0c reftests: Add 'px' to all properties 2012-02-02 03:14:02 +01:00
Benjamin Otte
cc83986eb8 reftests: Make test runner always use image surfaces
See comment in code for why.
2012-02-02 03:14:01 +01:00
Benjamin Otte
3c4b8a676f css: Port margin properties to GtkCssNumber 2012-02-02 03:14:01 +01:00
Benjamin Otte
cfebd1ec06 reftests: Add reftest for background-size 2012-02-02 03:14:01 +01:00
Benjamin Otte
1eeafcf569 reftests: Put border-image-repeat test back
This reverts commit 001d42f369.

Because now that we have background-size support, we can use it to make
stuff work!
2012-02-02 03:14:01 +01:00
Benjamin Otte
ceed732d65 reftests: set style properties to 0 in reset-to-defaults
GtkButton doesn't conform to CSS with these properties.
Bad GtkButton!
2012-02-02 03:14:01 +01:00
Benjamin Otte
2434dbc10a themingbackground: Implement background-size support 2012-02-02 03:14:01 +01:00
Benjamin Otte
82b739c490 tests: Add parsing test for background-size 2012-02-02 03:14:01 +01:00
Benjamin Otte
1979d048d3 css: Implement parsing for 'background-size' 2012-02-02 03:14:01 +01:00
Benjamin Otte
d56ac0d4df reftests: Add a bunch of linear gradient tests 2012-02-02 03:14:01 +01:00
Benjamin Otte
2e901752b1 tests: Add parsing tests for linear gradients 2012-02-02 03:14:01 +01:00
Benjamin Otte
811e848832 css: Implement repeating linear gradients 2012-02-02 03:14:00 +01:00
Benjamin Otte
5df9b0188a css: Implement CSS 3 linear-gradient() syntax 2012-02-02 03:14:00 +01:00
Benjamin Otte
f22c986102 tests: Update CSS tests for borders
Borders now expect 'px'.
2012-02-02 03:14:00 +01:00
Benjamin Otte
0c140daff2 css: Implement support for angles 2012-02-02 03:14:00 +01:00
Benjamin Otte
a63ff72406 css: Convert border-radius to GtkCssNumber
We can do % now, wohoo!
2012-02-02 03:14:00 +01:00
Benjamin Otte
82c2dad178 themingengine: Add a private function to query lengths 2012-02-02 03:14:00 +01:00
Benjamin Otte
762ea4793f css: Make border-width a length property 2012-02-02 03:14:00 +01:00
Benjamin Otte
a81ac3d5cd css: Add a check function for specified types
... and use it.

It seems kinda necessary for the refactoring I'm about to do...
2012-02-02 03:14:00 +01:00
Benjamin Otte
9551f542bd css: Ensure proper type for parsing custom properties 2012-02-02 03:14:00 +01:00
Benjamin Otte
893807bee0 css: Add GtkCssNumber 2012-02-02 03:14:00 +01:00
Benjamin Otte
bd8fefb20e styleproperties: Add a warning
GtkStyleProperties stores computed values. Make sure it does.
2012-02-02 03:14:00 +01:00
Benjamin Otte
032e8f9f9b styleproperty: Simplifiy registering function
... and rename it to conform to the actual type.

We don't need 2 registering functions anymore now that we can use the
specified type.
2012-02-02 03:13:58 +01:00
Benjamin Otte
6ba33e7af5 css: Allow bypassing the compute_value() stage
This is useful when overriding values.
2012-02-02 03:13:38 +01:00
Benjamin Otte
e4c2d9b259 csslookup: Query the bitmask
Checking if the value is NULL is the wrong thing to do - the bitmask is
usd to keep track of that.

The reason for that will become apparent in the next patch.
2012-02-02 03:13:38 +01:00
Benjamin Otte
4c8e9ee6b6 css: Remove two unused declarations 2012-02-02 03:13:38 +01:00
Benjamin Otte
c8786c3b97 css: color_compute no longer needs to check type
The input is always a symbolic color.
2012-02-02 03:13:38 +01:00
Benjamin Otte
5e5e8367ce css: Initialize value before calling compute function 2012-02-02 03:13:38 +01:00
Benjamin Otte
f7e0ce3b28 css: Initialize values to their specified type
.. when parsing.
2012-02-02 03:13:38 +01:00
Benjamin Otte
25affd4766 css: Create SymbolicColor fallback properties for colors 2012-02-02 03:13:38 +01:00
Benjamin Otte
c2fb315878 css: parse 'currentColor' for symbolic colors 2012-02-02 03:13:38 +01:00
Benjamin Otte
9fa764abec styleproperty: Introduce "specified type" and "computed type"
Make the types explicit. This way, we can actually do useful stuff with
them (like sanity checks, d'oh).
2012-02-02 03:13:34 +01:00
Benjamin Otte
05f14af24c css: Make the 'currentColor' keyword a symbolic color
This is the first step on a quest to ensure that there is only ever one
GType in use for GValues in every stage of the CSS resolving process.
2012-02-02 00:40:33 +01:00
Benjamin Otte
6b04c0f828 raleigh: remove general 'padding' declaration
Fixes reftests that were broken after images and labels applied padding.
Things look much more cramped now. On the plus side, treeview headers
and comboboxes have better spacing. Menubars look like crap now though.

Needs someone with artistical talent to figure out.
2012-02-02 00:14:01 +01:00
Benjamin Otte
21e20b0d5b raleigh: Remove unnecessary border-width declaration 2012-02-02 00:09:05 +01:00
Benjamin Otte
4dd9a73c8a raleigh: Don't set bg-color for all widgets
Just set oit for things that need it.
(FIXME: Buttons should probably not need it, but spinbuttons and
treeview headers don't have a proper background without it.)
2012-02-02 00:05:51 +01:00
Cosimo Cecchi
95f5ca062b reftests: set border-image: none in border-image-url's reference CSS
Fix border-image-url reftest
2012-02-01 17:59:28 -05:00
Cosimo Cecchi
d61a84bb3a reftests: add a bunch of missing reset-to-defaults
Fix the css-match-* reftests.
2012-02-01 17:59:27 -05:00
Cosimo Cecchi
2ae2c443d0 app-chooser-dialog: cancel the PK operation when the dialog is dismissed
This doesn't really seem to have any effect; probably PK doesn't listen
for changes on the passed-in cancellable, but it's correct.

Related to: https://bugzilla.gnome.org/show_bug.cgi?id=649121
2012-02-01 13:21:43 -05:00
Cosimo Cecchi
623b5192cc app-chooser-dialog: make sure to hold a ref when doing async ops
Hold a ref to the GtkDialog while doing async operations with the
GtkAppChooserOnline object.
This is needed, since somebody could call gtk_widget_destroy() on us
while an async operation is in progress. We don't want to be finalized
in that case, but mark the fact that we were dismissed and just return
from the callback in that case.
This avoids crashing if the dialog is destroyed in the middle of a PK
operation.

https://bugzilla.gnome.org/show_bug.cgi?id=649121
2012-02-01 13:21:43 -05:00
Benjamin Otte
c0ee68b7fe gtkmain: Invoke keysnoopers unconditionally
Now that ATK no longer uses a key snooper but is invoked directly,
checking in advance for existing snoopers is wrong and stops ATK from
working.

Also: code reduction without performance loss == good thing.

https://bugzilla.gnome.org/show_bug.cgi?id=669176
2012-02-01 15:45:49 +01:00
Cosimo Cecchi
26ff536069 combobox: fix cell area allocation in menu mode for RTL
We were missing a padding to subtract from the child widget here.
2012-01-31 20:30:43 -05:00
Cosimo Cecchi
aa16f469bc combobox: fix dropdown menu alignment for RTL languages
We need to add in the left padding, instead of subtracting it in that
case.
2012-01-31 20:30:43 -05:00
Cosimo Cecchi
65e6248542 combobox: use gtk_container_class_handle_border_width()
Avoids us fiddling with the border width manually in our size request
and allocation cycles.
2012-01-31 20:30:43 -05:00
Cosimo Cecchi
cf7f0cb27a combobox: always trim the allocated area by padding and border for child
When we're size allocating the children widgets, always trim the
allocation for padding and border of GtkComboBox, as that's all the area
they have available.
2012-01-31 20:30:42 -05:00
Cosimo Cecchi
ec6b36add5 combobox: cleanup allocation of children in list mode
Instead of setting the same values for child allocation in different
places, just do it once.
2012-01-31 20:30:42 -05:00
Cosimo Cecchi
a8211b75b2 combobox: cleanup and comment the allocation code somewhat 2012-01-31 20:30:42 -05:00
Cosimo Cecchi
00325e992b combobox: make sure to respect the GtkComboBox padding in menu mode
When the combobox is in menu mode, we still shouldn't discard the
GtkComboBox padding value; it's wrong to allocate it to the button.
2012-01-31 20:30:42 -05:00
Cosimo Cecchi
c598a9501f combobox: cleanup GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON
It was using the wrong padding values for RTL, and generally, using the
same variables in a distant macro makes this method even more
complicated than it already is...
2012-01-31 20:30:41 -05:00
Cosimo Cecchi
1bbd2c48c5 combobox: simplify size request code by using the button content box
Similar to what we did for size_allocate.
2012-01-31 20:30:41 -05:00
Cosimo Cecchi
821365af15 combobox: move the allocation of the button contents box directly
If we're in menu mode with no children, instead of tweaking the
allocation of the arrow and the separator separately, tweak the
allocation of the box that contain both.
2012-01-31 20:30:41 -05:00
Cosimo Cecchi
93523e70a0 combobox: allocate the CSS borders to GtkComboBox
Consider borders in the allocation/size-request machinery, like every
widget should do.
2012-01-31 20:30:40 -05:00
Cosimo Cecchi
4675ed27fd combobox: remove handling of focus-padding and focus-line-width
GtkComboBox always handles focus through its children, so there's no
need to request and allocate them again.
In fact, Adwaita was forcing these style properties to zero for
GtkComboBox.
2012-01-31 20:30:40 -05:00
Javier Jardón
9d7a722b38 gtkentry: Fix compilation warnings 2012-01-31 20:46:14 +00:00
Javier Jardón
44135ba2eb gtkspinbutton: Fix compilation warning 2012-01-31 20:46:13 +00:00
Ryan Lortie
8abc74680d Bring back the GMenu separators
4240bfb74a contained a likely copy/paste
mishap that accidentally disabled all separators for GtkMenus created
from GMenuModels.

Bring them back.
2012-01-31 13:23:34 -05:00
Cosimo Cecchi
0e395ea5a2 entry: deprecate the progress-border style property
Since we don't use it anymore.
2012-01-31 10:04:27 -05:00
Cosimo Cecchi
8dab59e5c9 entry: use the CSS margin for the progress margin offset
The progressbar inside GtkEntry has a progress-border style property,
which is actually the margin of the progressbar inside the GtkEntry
allocation.
Use a CSS margin instead of reading the progress-border property.
2012-01-31 10:04:27 -05:00
Cosimo Cecchi
5ec36a015c entry: use padding on the image area to position the image
Don't assume the padding of the icons is the same padding of the rest of
the entry.
This also allows to set different paddings for left and right icons.
2012-01-31 10:04:27 -05:00
Cosimo Cecchi
2cbe088674 entry: deprecate inner-border and gtk_entry_get/set_inner_border()
They're unused in GTK now and have suitable replacements in the CSS
properties.
2012-01-31 10:04:27 -05:00
Cosimo Cecchi
dd2bbd1b85 cell-renderer-text: don't use gtk_entry_set_inner_border()
There's no need to, since now the theme can just tweak the padding like:

.cell.entry {
  padding: 12;
}
2012-01-31 10:04:26 -05:00
Cosimo Cecchi
a5b189093b cell-renderer: add the CELL style class to the editing widget
When we create an editing widget, add the CELL style class to it, for
identification by the themes.
2012-01-31 10:04:26 -05:00
Cosimo Cecchi
4b90ba2701 entry: always add padding to the allocation
Even when we don't have a frame. We just ignore the borders in this
case.
2012-01-31 10:04:26 -05:00
Cosimo Cecchi
d140411698 entry: don't consider inner-border for allocation and layout
We want to deprecate the inner-border property and use the standard CSS
border/padding properties. Start with replacing its uses in GtkEntry.
2012-01-31 10:04:26 -05:00
Cosimo Cecchi
3ca795d447 entry: don't blindly center the text area in the allocated height
Since top/bottom borders might be different.
2012-01-31 10:04:25 -05:00
Cosimo Cecchi
8275a20026 entry: change _gtk_entry_get_borders() to return a GtkBorder 2012-01-31 10:04:25 -05:00
Cosimo Cecchi
5b2c1ee828 entry: allocate the CSS borders to GtkEntry
Every widget should allocate its borders. Make this true for GtkEntry.
2012-01-31 10:04:25 -05:00
Marek Kasik
9afe13bf91 printing: Don't crash when printing
This commit fixes crash which occurs in Firefox, Thunderbird and Inkscape
during printing. This crash was caused because of wrong handling of Custom
CUPS options. (#543520)
2012-01-31 12:15:43 +01:00
Michael Meeks
0481fbf7ce broadway: terminate v7 input to avoid parsing uninit memory. 2012-01-31 10:39:01 +00:00
Ryan Lortie
4041accda3 GtkBuilder menus: reject all attributes on <item>
These were just being silently ignored before.  That's bad, since it
used to be valid to have these.
2012-01-31 00:09:11 -05:00
Matthias Clasen
36242f8035 Bump version 2012-01-30 23:16:43 -05:00
Matthias Clasen
25231e36a2 3.3.12 2012-01-30 23:15:55 -05:00
Matthias Clasen
26da21f352 Drop some unintentional exports 2012-01-30 22:14:05 -05:00
Matthias Clasen
f663d4c82e Fix menu xml syntax in tests 2012-01-30 22:14:05 -05:00
Benjamin Otte
50c5bf97ea shorthand: Only unset values that are set
Otherwise g_value_unset() complains. And that breaks the testsuite.
2012-01-31 03:59:32 +01:00
Benjamin Otte
f01cef05c8 window: Avoid unnecessary attach-widget resets 2012-01-31 03:43:43 +01:00
Matthias Clasen
9b6ae2e9d5 Fix make check
Several unwanted symbols have sneaked in.
2012-01-30 20:46:44 -05:00
Matthias Clasen
4497ac6b58 Document the gtkbuilder xml file better
Replace the (invalid) DTD in the GtkBuilder docs by a
RELAX NG schema. Also install the schema in /usr/share/gtk-3.0,
so it can be used to validate GtkBuilder ui files.
2012-01-30 20:32:22 -05:00
Matthias Clasen
585a6652d5 Use G_SOURCE_CONTINUE/REMOVE
Now that GLib provides these macros, we should use them
to make the code more readable.
2012-01-30 19:12:27 -05:00
Matthias Clasen
7a080413ad Typo fix 2012-01-30 18:38:04 -05:00
Kristian Høgsberg
12e661c801 wayland: Fix return type from gdk_wayland_window_configure()
Should be void.  Copy and paste error.
2012-01-30 09:07:24 -05:00
Chao-Hsiung Liao
b2eadbc723 Updated Traditional Chinese translation(Hong Kong and Taiwan) 2012-01-29 23:03:31 +08:00
Kristian Høgsberg
aae9a71986 wayland: Also synthesize a configure event from gdk_window_wayland_move_resize 2012-01-29 07:32:44 -05:00
Matej Urbančič
1cf1fbdbbf Updated Slovenian translation 2012-01-28 20:42:10 +01:00
Kjartan Maraas
c32fedc264 Updated Norwegian bokmål translation 2012-01-28 15:44:51 +01:00
Carlos Garcia Campos
3c486ee96d testgtk: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
80b414efc2 examples: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
f7c6c97710 gtk-demo: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
67c3bf7b02 gtktreeviewcolumn: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
349b1eff03 gtktreeview: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
4e41b5c5fd gtktextview: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
f20551e2ed gtkstatusicon: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
f84ec775d8 gtkspinbutton: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
99c903ec04 gtkrange: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
15711a3bf7 gtkpathbar: Use symbolic names for button numbers 2012-01-27 09:47:44 +01:00
Carlos Garcia Campos
0453f91f02 gtkpaned: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
594903ecde gtknotebook: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
59a1434557 gtkmenutoolbutton: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
73449a4e28 gtkmenu: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
38d869cb8e gtklabel: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
c7756f0410 gtkiconview: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
203f600373 gtkhsv: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
76420c4793 gtkexpander: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
d088e729e5 gtkentry: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
6e9b06028c gtkdnd: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
7f2b08c04d gtkcombobox: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
2dbfa88459 gtkcolorsel: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
f8e9d264da gtkcellarea: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Carlos Garcia Campos
c5d9c6f27c gtkcalendar: Use symbolic names for button numbers 2012-01-27 09:47:42 +01:00
Carlos Garcia Campos
e796f3a4e7 gtkbutton: Use symbolic names for button numbers 2012-01-27 09:47:42 +01:00
Carlos Garcia Campos
ffd6dab8aa gtkappchooserwidget: Use symbolic names for button numbers 2012-01-27 09:47:42 +01:00
Carlos Garcia Campos
f11e5a3f4d gtkaboutdialog: Use symbolic names for button numbers 2012-01-27 09:47:42 +01:00
Carlos Garcia Campos
bc5d8da0c6 gdkevents: Use symbolic names for button numbers 2012-01-27 09:47:42 +01:00
Carlos Garcia Campos
2890ac842f gdk: Add macros for left, middle and right buttons
https://bugzilla.gnome.org/show_bug.cgi?id=668688
2012-01-27 09:47:42 +01:00
Daniel Mustieles
7a39912cae Updated Spanish translation 2012-01-26 17:14:25 +01:00
Piotr Drąg
0fb61e883e Updated POTFILES.in 2012-01-26 15:22:19 +01:00
Piotr Drąg
78d2ac2cb6 Updated POTFILES.in 2012-01-26 15:22:01 +01:00
Marek Kasik
e0d32d9456 printing: Fix a typo
Fix a typo which crashes on my printer.
2012-01-26 10:52:47 +01:00
Michael Natterer
90b991dd13 quartz: s/gdk_cursor_ref/g_object_ref/ 2012-01-26 10:37:12 +01:00
Michael Natterer
3ca7ec693f Bug 667691 - implement gdk_window_restack() for Quartz
Apply patch from Paul Davis which implements this missing function.
(cherry picked from commit e1c107a094)
2012-01-26 10:25:47 +01:00
Will Newton
96cfd3f8c7 iconcache: Always check return value of find_image_offset.
find_image_offset returns 0 if it failed to find a matching image.
Check this return value in _gtk_icon_cache_get_icon to avoid
making bad memory accesses later.

Signed-off-by: Will Newton <will.newton@imgtec.com>

https://bugzilla.gnome.org/show_bug.cgi?id=667745
2012-01-25 22:57:52 -05:00
Matthias Clasen
dbd66a8f02 GtkMenu: Improve annotations
Add a 'Rename to' annotation so gtk_menu_popup_for_device
appears in bindings as gtk_menu_popup (which we skip anyway).

https://bugzilla.gnome.org/show_bug.cgi?id=657385
2012-01-25 21:14:52 -05:00
Matthias Clasen
4c1a45f9ab Add some menu markup documentation 2012-01-25 20:59:22 -05:00
Ryan Lortie
7c1717886a Remove one last user of gmenumarkup 2012-01-25 20:56:06 -05:00
Ryan Lortie
e2750a4f5e GtkTimeline: protect the timeline from unref
The timeline frame function emits several signals, assuming that the
timeline will exist after these signals return.  This assumption can be
invalid if signal handlers unref the timeline.

https://bugzilla.gnome.org/show_bug.cgi?id=668675
2012-01-25 20:29:31 -05:00
Ryan Lortie
eed307713b GtkBuilder: change format of menus
Change the format of GtkBuilder <menu> to be more in-line with the style
of the rest of GtkBuilder so that we can do translation in a consistent
way.

The format is now substantially more difficult to hand-write, but tools
should be along soon.

There is an xslt program attached to the bug to help you convert your
existing .ui files from the old format to the new one.

https://bugzilla.gnome.org/show_bug.cgi?id=668696
2012-01-25 19:42:19 -05:00
Cosimo Cecchi
c76cccd437 application: sync clipboard and recent manager on shutdown
This mimics the code for gtk_main(), since GApplication iterates the
main context directly.
2012-01-25 18:31:25 -05:00
Matthias Clasen
d00368cac9 GtkAboutDialog: Make credits section extensible
This commit adds API that allows to add new named sections
to the Credits part of GtkAboutDialog, in addition to the
hardcoded sections for authors, documenters, artists and
translators.

https://bugzilla.gnome.org/show_bug.cgi?id=484693
2012-01-25 18:25:43 -05:00
Dieter Verfaillie
fe1907708c win32: fix gdk_win32_window_raise
When calling gtk_window_present(), gdk_win32_window_raise did not
actually raise the window anymore. Replacing BringWindowToTop() with
SetForegroundWindow() fixes this.

During testing, we also discovered that sometimes SetForeGroundWindow()
will (correctly) refuse to raise the window and fail(for example: sometimes
when dragging a different application at the time of a gtk_window_present()
call). To prevent a GdkWarning from being produced, usage of the API_CALL
macro has been removed for this case.

Additional goodies of SetForeGroundWindow:
- it brings the window to the front when the process owning the
  window to raise is the foreground process (for example when
  gtk_window_present is called from a GtkStatusIcon's activate
  signal handler)
- it limits itself to flashing the task bar button associated
  with the window if the process owning the window to raise
  is *not* the foreground process (for example when gtk_window_present
  is called from a g_timeout_add callback function)

https://bugzilla.gnome.org/show_bug.cgi?id=665760
2012-01-25 20:32:50 +01:00
Benjamin Otte
8da4c2affa css: Return GArrays from shorthand parsing
GValueArray is deprecated now.
2012-01-25 19:05:33 +01:00
Benjamin Otte
fd4f701c50 css: Use GArray in GtkCssComputedValues
GValueArray is deprecated in glib. Also, bump the required glib version
for g_array_set_clear_func().
2012-01-25 19:05:33 +01:00
Javier Jardón
104d9cab37 gdkapplaunchcontext: Add tags to code example 2012-01-25 17:36:57 +00:00
Alexander Larsson
fa6ad2ca04 broadway: Properly handle masked websocket messages
Thanks to Rafal Luzynski for pointing this out.

https://bugzilla.gnome.org/show_bug.cgi?id=656521
2012-01-25 11:47:16 +01:00
Matthias Clasen
1e869311c1 GtkApplicationWindow: Some more docs 2012-01-24 22:51:05 -05:00
Matthias Clasen
38f395481c Doc tweaks 2012-01-24 22:41:36 -05:00
Matthias Clasen
7d56c052d4 Fix a doc typo 2012-01-24 22:28:34 -05:00
Matthias Clasen
d818bdc297 gtk3-demo-application: add an example for the new api
Turn the menutoolbutton menu into one that is gmenu/gaction backed.
2012-01-24 22:27:28 -05:00
Matthias Clasen
4240bfb74a Add API to create menus from models
This is needed to bring context menus, etc into the GAction world.
2012-01-24 22:25:35 -05:00
Matthias Clasen
e7d6400149 GtkApplication: documentation additions
Document that startup() needs to chain up first.
2012-01-24 22:22:08 -05:00
Matthias Clasen
1819543e1e GtkModelMenu: Plug a memleak 2012-01-24 21:30:33 -05:00
Siegfried-Angel Gevatter Pujals
1ae4b1ecc1 g_content_type_guess expects a path, not an URI 2012-01-24 19:22:54 +01:00
Siegfried-Angel Gevatter Pujals
0d9d3025c6 Fix mem leak introduced with my previous commit 2012-01-24 19:05:29 +01:00
Kjartan Maraas
8599c98780 Updated Norwegian bokmål translation 2012-01-24 18:17:05 +01:00
Benjamin Otte
2f3ffd5fde treeview: Fix comparison to catch all cases
Otherwise, we could sometimes fail to update the cursor node when the
right row was deleted.

Also, I'd like to file a formal complaint that this node/tree
differentiation makes writing comparisons too complicated.

https://bugzilla.gnome.org/show_bug.cgi?id=668169
2012-01-24 17:55:14 +01:00
Siegfried-Angel Gevatter Pujals
080f8740f2 GtkRecentManager: guess mime-type from filename when file doesn't exist 2012-01-24 13:59:12 +01:00
Andre Klapper
d0393d7376 Typofix in documentation 2012-01-24 13:52:53 +01:00
Matthias Clasen
4c2e53a468 Silence a compiler warning 2012-01-24 00:41:26 -05:00
Matthias Clasen
3104e5d2c1 Add an example for settings<>action integration
Turn the 'color' action in gtk3-demo-application into an
action that is backed by a setting.
2012-01-24 00:07:03 -05:00
Matthias Clasen
0363a7a2e3 Bloatpad: propertly escape <> in markup 2012-01-23 22:14:28 -05:00
Matthias Clasen
5c10f8ce8c Pedantic spelling fix
Its 'theming', not 'themeing'.
2012-01-23 16:48:02 -05:00
Paolo Borelli
1326466309 Render background of a GtkImage
Useful to e.g. style the bg color of a symbolic icon
2012-01-23 21:03:05 +01:00
Paolo Borelli
31e89b44da Fix gtkmisc padding calculation
Actually sum css padding and gtkmisc padding as intended in the previous
patch.
2012-01-23 21:03:05 +01:00
Ryan Lortie
880daf8bb2 GtkApplication: change the accel prefix we use
GtkApplication adds to the global accel map using the prefix <Actions>
which is also used by GtkAction.  This causes GtkApplicationWindow to
try to parse GtkAction-added accels as if they were its own (which
fails).

Switch to a different namespace -- <GAction>/.

https://bugzilla.gnome.org/show_bug.cgi?id=668367
2012-01-23 11:17:07 -05:00
Paolo Borelli
e34589ddea Factor out _gtk_misc_get_padding_and_border
The new semi-private function will allow to implement support for css
padding and border in widgets inheriting from GtkMisc.
Use the new function for GtkLabel, GtkArrow and GtkImage.
2012-01-22 13:36:47 +01:00
Matej Urbančič
bf7779bfb7 Updated Slovenian translation 2012-01-21 21:04:20 +01:00
Colin Walters
a9614a39a4 gtkmenuitem: Silence a compiler warning 2012-01-21 10:29:07 -05:00
Philip Withnall
5df87d06d4 progressbar: Tidy up the gtk-doc comments a little 2012-01-21 10:05:10 +00:00
Matthias Clasen
835e37f08f GtkApplicationWindow: Improve app menu label
When we are showing the app menu in process, use the application
name, if it has been set. Otherwise, we still fall back to
"Application".
2012-01-20 20:06:25 -05:00
Matthias Clasen
c06887c9f0 Bloatpad: Set the application name
This will be picked up for the app menu label in fallback mode
in the near future.
2012-01-20 20:05:43 -05:00
Matthias Clasen
0c514dc7dd Correct an introspection annotation
Mistake pointed out in bug 668265.
2012-01-20 19:46:53 -05:00
Matthias Clasen
d5656b6139 bump rev 2012-01-20 16:13:37 -05:00
Matthias Clasen
d9f1ac1c9c 3.3.10 2012-01-20 16:12:25 -05:00
Matthias Clasen
15b4198a80 Bump GLib dep
This is needed for the app menu moves.
2012-01-20 15:30:46 -05:00
Matthias Clasen
391cd36a5b Updates 2012-01-20 15:29:09 -05:00
Matthias Clasen
691a94214a Fix doc syntax 2012-01-20 08:17:39 -05:00
Matthias Clasen
284ff06ef6 GtkApplication: fix !x11 build
Since we moved the menu models to GTK+, we need to deal with
them on all platforms, even if we don't do anything special
with them on win32.
2012-01-20 08:16:35 -05:00
Alexander Larsson
d80bad037f Fix builddir != srcdir build issue 2012-01-20 13:48:33 +01:00
Alexander Larsson
7ec927a386 Fix visibility notification event reporting
We were checking the event mask for GDK_VISIBILITY_NOTIFY,
not GDK_VISIBILITY_NOTIFY_MASK, which was clearly a typo.
2012-01-20 11:01:49 +01:00
Matthias Clasen
681871dd9e GtkApplicationWindow: Fix resize grip positioning
Based on a patch by Carlos Garcia Campos, bug 668248
2012-01-20 01:01:08 -05:00
Cosimo Cecchi
4b7ec2be82 main: fix a compilation warning 2012-01-19 13:51:32 -05:00
Michael Natterer
0ea1924494 quartz: add virtual modifiers already in GDK, just as X11 does it
Key event states  will now always contain GDK_META_MASK in addition
to GDK_MOD2_MASK.
(cherry picked from commit d915d17ff6)
2012-01-19 16:29:41 +01:00
Kristian Høgsberg
b9190c7fe9 wayland: Destroy shell surface as we destroy the surface 2012-01-19 09:57:43 -05:00
Daniel Mustieles
fa17e23ce7 Updated Spanish translation 2012-01-19 11:01:28 +01:00
Benjamin Otte
dbabff0846 a11y: Invoke key snooper directly
Gets around the deprecated function warnings.
2012-01-19 10:32:21 +01:00
Cosimo Cecchi
637e6688da notebook: fixup previous commit
Oops, I hit push too early.
2012-01-18 16:14:31 -05:00
Cosimo Cecchi
70cf23a729 notebook: don't force ACTIVE state flag on the label for active tab
This is just wrong, since it's not the tab label being active, but the
tab itself.
2012-01-18 16:13:25 -05:00
Ryan Lortie
ba9546ff32 Don't call set_application() in gtk_window_realize
This call has no effect and with the newly-added restrictions it's
violating the set-application-after-realized rule.

https://bugzilla.gnome.org/show_bug.cgi?id=668203
2012-01-18 14:53:08 -05:00
Ryan Lortie
60317cbf1a move menus over from GLib
App menu and menubar are now properties of GtkApplication and their bus
location is exported using X window properties.

https://bugzilla.gnome.org/show_bug.cgi?id=668118
2012-01-18 13:40:05 -05:00
Benjamin Otte
ed8e7d1793 Revert "a11y: Remove keysnooping support"
This reverts commit 0c8ecba7dc.

The change broke Orca completely, and we need a proper fix first.
So we have to live with the bugs intorduced by this until then.
2012-01-18 18:33:11 +01:00
Kristian Høgsberg
4c79e25915 wayland: Report middle and right buttons correctly
The linux evdev button codes have right as 274 and left as 273.
2012-01-18 12:04:18 -05:00
Rob Bradford
29641ecd07 wayland: Update modifiers handling to match new semantics
Due to changes in the behaviour of the virtual modifiers around MOD1 the
implementation of the map_virtual_modifiers vfunc was mangling the modifiers
and making keybindings not work correctly.

This change updates the implementation to match the X11 implementation's
behaviour.
2012-01-18 16:32:44 +00:00
Matthias Clasen
1839caa7b7 GtkScale Remove an unused variable 2012-01-18 11:06:33 -05:00
Benjamin Otte
9770184643 css: Fix memleak in shadow parsing 2012-01-18 10:46:46 +01:00
Matthias Clasen
345d865ac6 GtkScale: Fix late setting of marks 2012-01-18 00:58:38 -05:00
Matthias Clasen
d6f9eb1ff8 Add more GtkScale mark tests
This code tests adding scale marks 'late', and how this interact
with inversion.
2012-01-18 00:58:38 -05:00
Benjamin Berg
27f3c3c031 Strip "Custom." prefix when getting default options from cups. 2012-01-17 20:33:32 +01:00
Kristian Høgsberg
b9509ec15d wayland: Handle request for selection atoms when there's no selection 2012-01-17 11:10:59 -05:00
Ryan Lortie
85fcd50b3f Revert "set the G_PARAM_CONSTRUCT flag on the GtkWindow:application property"
This reverts commit d4fe912879.

This patch caused some unanticipated compatibility issues.
2012-01-17 10:56:30 -05:00
Colin Walters
626c08a847 tests/visuals: Squash a compiler warning 2012-01-17 10:24:39 -05:00
Rob Bradford
dba9c2e5a7 wayland: Adapt move_resize vfunc implementation to match semantics
Callers of this function were passing in -1, -1 for the width and height if
they just wanted the window moving - rather than the size changing. We need to
respect that behaviour and don't try and set the width/height to those
dimensions.

Now pop-up windows (ala combo-boxes) work!
2012-01-17 15:05:03 +00:00
Matthias Clasen
299a4eca28 Back to odd 2012-01-16 23:14:07 -05:00
Matthias Clasen
4d76860697 3.3.8 2012-01-16 23:13:27 -05:00
Matthias Clasen
0bf41f38ee Remove appchooser tests from the Makefile as well 2012-01-16 22:37:26 -05:00
Matthias Clasen
173740a2f6 Remove the appchooser a11y dump test as well
This test is also affected by treeview a11y fallout.
2012-01-16 21:55:43 -05:00
Matthias Clasen
1aff20b93e Remove tree.ui a11y dump test
This is just broken currently; it needs fixing before it can come
back.
2012-01-16 21:07:36 -05:00
Matthias Clasen
d8b86bcb2b Disable broken tree-relationships tests for now
Needs to be fixed up before it can come back.
2012-01-16 21:06:11 -05:00
Matthias Clasen
3e6b37726a Remove a check that broke the color chooser a11y dump
With the visible check, the opacity slider ended up without
a labeled-by, which is sad.
2012-01-16 21:05:01 -05:00
Matthias Clasen
f29195e741 Adapt to focus changes in the treeview 2012-01-16 21:04:24 -05:00
Matthias Clasen
001d42f369 Remove broken border-image-repeat test
It will come back when it works
2012-01-16 19:14:20 -05:00
Alexandre Rostovtsev
e2053a582a Add Since: to gdk_x11_device_get_id(), gdk_x11_device_manager_lookup(), gdk_x11_window_set_utf8_property() docs
https://bugzilla.gnome.org/show_bug.cgi?id=667730
2012-01-16 18:08:16 -05:00
Matthias Clasen
57126ae56b GtkScale: Always chain up in notify
Pointed out by Stefan Sauer.
2012-01-16 18:05:44 -05:00
Matthias Clasen
edd888f92b Updates 2012-01-16 17:36:31 -05:00
Matthias Clasen
f802b7e0a8 Bump GLib dep to 2.31.10
Needed for GResource
2012-01-16 17:24:27 -05:00
Ryan Lortie
a55ef45515 gtk3-demo-application: fix sections
<section> doesn't need to be given in a menubar but it does need to be
given for submenus, so add those ones back.
2012-01-16 17:19:26 -05:00
Matthias Clasen
7a3e1bbc41 configure: Set GLIB_COMPILE_RESOURCES 2012-01-16 17:07:46 -05:00
Matthias Clasen
2a6a354aa8 gtk-demo: Improve the GtkApplication demo
Following suggestions in bug 667968
2012-01-16 17:07:12 -05:00
Kristian Høgsberg
7328cc73aa wayland: Set GdkWindow focused state based on keyboard focus 2012-01-16 15:36:28 -05:00
Kristian Høgsberg
5f07e937c8 wayland: Implement client side keyboard repeat 2012-01-16 15:36:27 -05:00
Rico Tzschichholz
85da4ca5bd gtk.symbols: updated 2012-01-16 19:45:27 +01:00
Rico Tzschichholz
8b183af57f build: Add missing files to EXTRA_DIST 2012-01-16 19:27:23 +01:00
Benjamin Otte
6f9cc94fae cssprovider: Improve error handling for import errors
We don't want to include the whitespace after an import statement.
Because people tend to add newlines after @import, we report the wrong
lines for failed imports. And that's bad.
2012-01-16 18:44:43 +01:00
Benjamin Otte
a213b0b33e image: Fix gcc warnings 2012-01-16 18:39:52 +01:00
Benjamin Otte
f04c12bd2c tests: Add a deprecation warning
This should probably have been added a while ago...
2012-01-16 18:34:41 +01:00
Benjamin Otte
1b0231b743 css: Don't import CSS too early
First, finish parsing the import rule including the semicolon. Then try
to actually import.

test: css/parser/at-invalid-01.css
2012-01-16 18:34:41 +01:00
Benjamin Otte
4653c7017f css: Fix memleak
https://bugzilla.gnome.org/show_bug.cgi?id=667910
2012-01-16 18:34:41 +01:00
Kjartan Maraas
8411088c54 Updated Norwegian bokmål translation 2012-01-16 17:04:31 +01:00
Rui Matos
f0a80fa308 x11: Fix the _NET_SUPPORTING_WM_CHECK window fetch to be spec compliant
"The child window MUST also have the _NET_SUPPORTING_WM_CHECK property set to
the ID of the child window. […] If the _NET_SUPPORTING_WM_CHECK window on the
client window is missing or not properly set, clients SHOULD assume that no
conforming Window Manager is present."

This commit implements that, which allows us to not have to do a
XGetWindowProperty() every N seconds when running under a compliant WM.

This is also a more correct fix for the bug handled in commit
daf29bffed.

https://bugzilla.gnome.org/show_bug.cgi?id=666921
2012-01-16 15:38:33 +00:00
Javier Jardón
608637b562 Trivial doc fix
Use GLib consistently capitalized in the docs.
2012-01-16 14:49:38 +00:00
Alexander Larsson
c6e253564c Add missing cursors 2012-01-16 14:36:18 +01:00
Alexander Larsson
e46971306a Ensure we can load images via resource:// uris from CSS 2012-01-16 14:19:19 +01:00
Alexander Larsson
6afeb8d355 Move fallback dnd cursors to resources 2012-01-16 14:19:19 +01:00
Alexander Larsson
622b78c000 Add GtkImage constructors from resources
Atm you can't read back the resource path like
you can with filenames. Maybe we should add that.
2012-01-16 14:19:18 +01:00
Alexander Larsson
1a36414da7 Access win32 css as resource, not custom generated C code 2012-01-16 14:19:18 +01:00
Alexander Larsson
4f0cc6572b Add Gtk resource file with the default CSS file 2012-01-16 14:19:16 +01:00
Alexander Larsson
739ab8548d Add gtk_ui_manager_add_ui_from_resource
This is a helper function to easily add ui from resource files.
2012-01-16 13:59:58 +01:00
Alexander Larsson
c72a76c754 Add resource support for GtkBuilder
There are new calls to load ui files from resources, and
you can now read pixbufs by using relative paths in a ui
file read from a resource, or by using absolute resource:/// uris.
2012-01-16 13:59:58 +01:00
Alexander Larsson
84883ccf7c Fix build
Was getting this error:

main.c:785:13: error: ‘gtk_demos’ undeclared (first use in this function)
main.c:785:13: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function ‘main’:
2012-01-16 13:58:23 +01:00
Matthias Clasen
cf172a5873 Revert "GtkNotebook: fix crash when DnD tabs between windows"
This reverts commit eeb9de80e1.
2012-01-15 18:54:05 -05:00
Matthias Clasen
261abe55c4 Forgotten file 2012-01-15 14:46:31 -05:00
Matthias Clasen
eb4a685691 GtkScale: Fix marks for inverted scales
Problem pointed out by Stefan Sauer in bug 667598. The solution
here is different from his patch. We always draw marks in increasing
direction, and flip the marks and stop positions to match.
2012-01-15 14:13:10 -05:00
Matthias Clasen
fa7207dcdd Add an non-symmetric mark example
This makes it easier to spot problems with inverting.
2012-01-15 14:13:10 -05:00
Matthias Clasen
800e605cb3 GtkScale: remove an unused argument
All callers were passing 1 for 'match', so just get rid of it.
Patch provided by Stefan Sauer, in bug 667590.
2012-01-15 14:13:10 -05:00
Matthias Clasen
eda949c5f3 Make testscale more versatile 2012-01-15 14:13:10 -05:00
Stefan Sauer
9bedf0128f scale: use a GList instead of a GSList
The range widget can be inverted, this will help us to handle that case.
2012-01-15 14:13:10 -05:00
Daniel Mustieles
aaf7a0ac28 Updated Spanish translation 2012-01-15 19:29:58 +01:00
Matthias Clasen
b9b23f4f18 GtkRange: fix resize-grip overlap handling
We only want to shrink the scrollbar allocation by the actual
overlap, not always by the full size of the resize grip.
2012-01-14 20:35:19 -05:00
Matthias Clasen
b0936a12d9 GtkStatusbar: Fix resize-grip overlap calculation
The allocation is relative to the window, so the way the statusbar
was doing the overlap calculation was wrong.
2012-01-14 20:35:19 -05:00
Matthias Clasen
9ef2fdf956 GtkApplicationWindow: another size allocation fix
Set the window allocation before giving allocations to children,
in case the children want to refer to the window allocation.
2012-01-14 20:35:19 -05:00
Matthias Clasen
45d9b912d9 Add a GtkApplication example to gtk3-demo 2012-01-14 20:35:18 -05:00
Fran Diéguez
3b6665aad2 Updated Galician translations 2012-01-15 00:43:07 +01:00
Matthias Clasen
eced73c441 GtkApplicationWindow: Fix size-request logic
When finding the width for a given height, we can pass the full
height to both the menubar and the content. Instead, give the
menubar its minimum height, and give the rest to the content.
2012-01-14 13:26:09 -05:00
Matthias Clasen
7234a2617e GtkApplicationWindow: Fix size-allocation logic
The code was not properly removing the menubar height from the
height given to the content, causing the statusbar to drop off
the bottom of the window in some examples.
2012-01-14 13:24:39 -05:00
Paolo Borelli
208bfbd053 Do not leak tree path when setting the model. 2012-01-14 14:33:23 +01:00
Paolo Borelli
9ad78370eb Destroy cairo context after painting css image url 2012-01-14 11:52:48 +01:00
Cosimo Cecchi
e0efeba27e parser: remove unused _gtk_css_parser_read_uri()
It's not used anymore now.
2012-01-13 18:09:30 -05:00
Cosimo Cecchi
ddd164c230 provider: use _gtk_css_parse_read_url() in parse_import()
Instead of _gtk_css_parser_read_uri(), which is going away.
2012-01-13 18:08:12 -05:00
Cosimo Cecchi
d1f3fe4342 parser: remove a duplicate copy of gtk_css_parse_url()
Move the function to gtkcssparser.c and use it in both places.
2012-01-13 17:55:53 -05:00
Piotr Drąg
4f4e42239a Updated POTFILES.in 2012-01-13 21:07:26 +01:00
Rob Bradford
2d837769a0 wayland: Add basic implementation of GtkClipboard for Wayland
This follows the approach used by the Quartz port - that of a separate
implementation matching GtkClipboard.

The simple clipboard tests in gtk3-demo function correctly but there are
almost certainly leaks and bugs.
2012-01-13 16:50:47 +00:00
Rob Bradford
08f5483fb7 wayland: Free the internal selection data when the selection is cleared 2012-01-13 16:50:47 +00:00
Rob Bradford
1e0b22c176 wayland: Fix memory handling for the selection callbacks 2012-01-13 16:50:47 +00:00
Rob Bradford
368d6c50b7 wayland: Add basic API for setting and clearing the selection on the device 2012-01-13 16:50:47 +00:00
Rob Bradford
cd795de6bf wayland: Expose basic mechanism for getting selection content by callback
This version has a couple of TODOs/FIXMEs:

* We should do something better than g_io_channel_read_to_end
* Need to check the mime type is valid
2012-01-13 16:50:47 +00:00
Rob Bradford
9d90a17a7c wayland: Add call to get types available for the selection as atoms 2012-01-13 16:50:47 +00:00
Rob Bradford
fe3f275945 wayland: Remove unused variables to silence compiler warning 2012-01-13 16:50:47 +00:00
Kristian Høgsberg
0e10fae36c wayland: Set surface type based on GdkWindow hint 2012-01-13 09:50:38 -05:00
Daniel Mustieles
e77ed49f84 Updated Spanish translation 2012-01-13 14:42:21 +01:00
Rob Bradford
9e29ef5f3b wayland: Update to new SHM buffer format type 2012-01-13 11:36:36 +00:00
Yaron Shahrabani
96e729d500 Updated Hebrew translation. 2012-01-13 09:37:09 +02:00
Yaron Shahrabani
09f56c3272 Updated Hebrew translation. 2012-01-13 09:35:54 +02:00
Matthias Clasen
05acb492b6 Updates 2012-01-12 22:56:17 -05:00
Matthias Clasen
46ee761c0d Expand the docs for GtkWindow::attached-to 2012-01-12 20:39:48 -05:00
Cosimo Cecchi
27f6441bb2 visuals: remove copy paste leftover 2012-01-12 17:31:00 -05:00
Piotr Drąg
14d66b5d0a Updated POTFILES.skip 2012-01-12 23:23:29 +01:00
Cosimo Cecchi
9283ca93c5 visuals: add a runner for visual GtkBuilder files
This is useful to sketch out in GtkBuilder widgets in different states
all at once, so that we can check theming is right for them.
Add some initial UI files for primary-toolbar and inline-toolbar widgets.
2012-01-12 17:05:36 -05:00
Dan Winship
dc100a8e7b gtk.symbols: fix a symbol name 2012-01-12 15:06:59 -05:00
Khaled Hosny
94f9e365b4 Update Arabic translation 2012-01-12 21:56:58 +02:00
Cosimo Cecchi
c4a13b5287 window: improve docs for gtk_window_set_attached_to() 2012-01-12 14:03:00 -05:00
Andrea Cimitan
4a18fe7ef2 Introduce gtk_window_get/set_attached_to()
gtk_window_get/set_attached_to() is a new API that allows for windows to
be attached to a GtkWidget.
The attachment is a logical binding between the toplevel window and the
widget that generated it; this kind of information is currently used to
propagate style information from the widget to the window, but is also
useful e.g. for accessibility.

https://bugzilla.gnome.org/show_bug.cgi?id=666103
2012-01-12 14:03:00 -05:00
Benjamin Otte
133179fd25 treeview: Do not focus a path on model change
Instead, focus nothing and wait until we get focus before doing so. This
restores previous behaviour but still emits proper cursor-changed
events.

Fixes a bunch of bugs in the filechooser which populates the treeview
asynchronously.

https://bugzilla.gnome.org/show_bug.cgi?id=613728
2012-01-12 19:37:15 +01:00
Benjamin Otte
feb1f8de1c filechooser: Use SELECTION_SINGLE
We want to allow people to unselect the item.
2012-01-12 19:37:15 +01:00
Rob Bradford
e7e86ba5f4 wayland: Remove unused variable from grab implementation 2012-01-12 13:48:57 +00:00
Rob Bradford
0aa210866c wayland: Fix compilation warning for destroy function implementation 2012-01-12 13:48:57 +00:00
Rob Bradford
f791687d3b wayland: Fix implementation of gdk_atom_name 2012-01-12 13:48:57 +00:00
Rob Bradford
7f404a1fee wayland: Remove unused variable 2012-01-12 13:48:46 +00:00
Javier Jardón
c958667a92 gtkapplication.c: Add missing "Since" tag 2012-01-12 12:58:56 +00:00
Daniel Mustieles
f70267f1ae Updated Spanish translation 2012-01-12 10:30:11 +01:00
Benjamin Otte
ff1e1e1f91 a11y: Disconnect from buffer signals
This way, we don't get crashes when the buffer is still in use after a
TextView gets finalized.

https://bugzilla.gnome.org/show_bug.cgi?id=667632
2012-01-12 04:45:34 +01:00
Benjamin Otte
cac47f45b7 accessible: Remove stray semicolon
Note to self: Use -Wempty-body more
2012-01-12 04:45:34 +01:00
Benjamin Otte
4a33eb1aae styleproperty: Fix 'currentColor'
It was always looking at the 'color' keyword for the parent context
instead of only doing that when used with the 'color' property.

Tested by border-color-default.ui reftest.
2012-01-12 04:38:33 +01:00
Benjamin Otte
581cc59945 stylecontext: Don't unref animation description
We get it without a ref since 6962b49a99
2012-01-12 01:10:26 +01:00
Cosimo Cecchi
d994ace41e tests: add a CSS test for currentColor in border-color 2012-01-11 17:37:21 -05:00
Cosimo Cecchi
09b4658c06 shorthand: fix parsing of currentColor for border-color shorthand
Code for border-color was missing the currentColor parsing.
2012-01-11 17:35:59 -05:00
Cosimo Cecchi
984834ea57 reftests: fix background-area reftest
background-clip: content-box broke when I made GtkButton allocate its
border-width, as for the CSS box model.
2012-01-11 16:13:09 -05:00
Dan Winship
9c7d795d5a testlogout: actually quit if told to
https://bugzilla.gnome.org/show_bug.cgi?id=667705
2012-01-11 12:00:06 -05:00
Dan Winship
05c484dcb0 GtkApplication: add inhibitor dialog under OS X
Since OS X doesn't have an inhibitors API, we need to display the
inhibit reason ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=667705
2012-01-11 12:00:06 -05:00
Dan Winship
7afc7081c1 GtkApplication: fix/simplify OS X implementation
Make the OS X implementation compile, and remove the code that was
only needed to support user interaction during the quit request.

https://bugzilla.gnome.org/show_bug.cgi?id=667705
2012-01-11 12:00:06 -05:00
Cosimo Cecchi
b02591bfae widget-factory: make the combobox entry focusable 2012-01-11 11:46:56 -05:00
Cosimo Cecchi
d286a1ff4c widget-factory: add items to the entry dropdown 2012-01-11 11:22:45 -05:00
Benjamin Otte
945b9ff9e2 reftests: Add reftest for empty area fix 2012-01-11 15:48:54 +01:00
Benjamin Otte
6100900e1a themingengine: Don't draw background image if no area
If the background positioning area is empty (width/height <=0), don't
attempt to draw the background image.
2012-01-11 15:48:54 +01:00
Benjamin Otte
a815f10299 API: Add gtk_style_context_get_section()
This API allows querying the location where style properties were
defined. An example implementation will be committed soon.
2012-01-11 15:48:54 +01:00
Benjamin Otte
6962b49a99 css: Introduce GtkCssComputedValues
To be used for storing computed values. Is the replacement for
GtkStyleProperties, which is now legacy code.
2012-01-11 15:48:54 +01:00
Benjamin Otte
694a9114af stylecontext: Simplify even more code 2012-01-11 15:48:54 +01:00
Benjamin Otte
f27f8db2d8 stylecontext: Use our own color resolve function
... instead of using the StyleProperties.
2012-01-11 15:48:54 +01:00
Benjamin Otte
abcae0cea4 stylecontext: Simplify function
Also, make it easier to port to what I want to do next. ;)
2012-01-11 15:48:54 +01:00
Benjamin Otte
5939baa556 styleproperty: Make query function take a vfunc
This way we can use different methods to query properties and aren't
bound to a GtkStyleProperties object.
2012-01-11 15:48:54 +01:00
Benjamin Otte
738f96252e shorthand: Get rid of GParameter dance
Instead assign properties directly.
2012-01-11 15:48:54 +01:00
Benjamin Otte
53b2f05a64 shorthand: Unify unpack_border()
Just use the property names.
2012-01-11 15:48:54 +01:00
Benjamin Otte
df88700230 shorthand: Do an unpack function to assign to everything
It's basically the opposite to pack_first_element() - it takes the given
value and stores it in all subproperties.
2012-01-11 15:48:54 +01:00
Benjamin Otte
73fac24a3a shorthand: Add a "pack_first_element" pack function
And use it where appropriate.
See the docs in the function for what it does.
2012-01-11 15:48:53 +01:00
Benjamin Otte
6ebb85a69e shorthand: Unify border parsing code
Parse border.{top,right,bottom,left} into subproperties {1,2,3,4}.
2012-01-11 15:48:53 +01:00
Benjamin Otte
78fee2f54b shorthand: Remove hack
This hack was used for parsing back before the refactoring.
2012-01-11 15:48:53 +01:00
Benjamin Otte
e603992ac7 shorthand: Move pack funcs from base class
Also make the vfuncs take the shorthand as an argument.
2012-01-11 15:48:53 +01:00
Benjamin Otte
aa98aca45f styleproperties: Remove color set function
Now that we do resolvage with the style context directly, this is no
longer needed.
2012-01-11 15:48:53 +01:00
Matthias Clasen
5f8c77f6d5 Don't leak plugin actions
Pointed out by Guillaume Desmottes in bug 667695.
2012-01-11 09:44:30 -05:00
Carlos Garcia Campos
b9c7f057f1 printing: gtk_print_settings_load_key_file() ignores group_name 2012-01-11 15:38:51 +01:00
Ryan Lortie
7fdf2e0bde document GtkActionable
This should have been done before it was merged...
2012-01-11 13:39:19 +01:00
Christophe Fergeau
ba2d3d1469 Remove duplicate definition of GtkStylePrintFunc 2012-01-11 13:10:28 +01:00
Rico Tzschichholz
f24dd8f067 Fix some missing renames of GtkApplicationEndStyle 2012-01-11 08:49:34 +01:00
Ryan Lortie
b7a28de755 GtkButton: don't do string compare on property set
Just set the property unconditionally.

https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-11 00:26:56 -05:00
Ryan Lortie
ab91527032 Rename gtk_application_window_get_observer
This should have been called _create_observer

https://bugzilla.gnome.org/show_bug.cgi?id=667394

Fixup switch
2012-01-11 00:26:47 -05:00
Matthias Clasen
bec43213da Add a switch
Add a switch. This demonstrates:
- that switches can be placed in toolbars
- that GtkSwitch is actionable
- that actions can be shared between multiple actionables
2012-01-11 00:10:51 -05:00
Matthias Clasen
fdc2e29d69 GtkSwitch: Implement GtkActionable 2012-01-11 00:10:34 -05:00
Matthias Clasen
7c0c65ec8d Rename GtkApplicationEndStyle
Call it EndSession to make it clearer what this is about.
2012-01-10 22:16:01 -05:00
Matthias Clasen
bb80081620 Bloatpad: Register with the session 2012-01-10 21:46:51 -05:00
Matthias Clasen
1c486fb8b8 Simplify logout notification api
We don't expose ::quit-requested as API anymore. Instead, we expect
users to register inhibitors when needed. Without quit-requested,
there is no need for ::quit-cancelled and gtk_application_quit_response
anymore.

We still emit ::quit when the application is about to quit.
2012-01-10 21:45:30 -05:00
Javier Jardón
c1f44c0f83 migrating-unique-GtkApplication: Update to new GApplication api 2012-01-10 16:23:53 +00:00
Rico Tzschichholz
71f6b2d40a tests: Fix typo in Makefile.am 2012-01-10 17:00:57 +01:00
Guillaume Desmottes
d4fe912879 set the G_PARAM_CONSTRUCT flag on the GtkWindow:application property
This allows subclass to get the value of this property in their constructed
method.

https://bugzilla.gnome.org/show_bug.cgi?id=667628
2012-01-10 16:03:57 +01:00
Patrick Welche
2ceb092afc Non-XInput2 build fix
The part in gdkwindow-x11.c which uses XIEvent and friends is "protected"
by HAVE_XGENERICEVENTS, i.e., XGetEventData() has been found. (Xlib.h)

XIEvent and friends are defined in <X11/extension/XInput2.h> which is
included by gdkdisplay-x11.h if XINPUT_2 is defined.

The patch makes sure XIEvent is only used if XINPUT_2 is defined.

https://bugzilla.gnome.org/show_bug.cgi?id=667534
2012-01-10 13:54:22 +00:00
Daniel Mustieles
d05db5f5ff Updated Spanish translation 2012-01-10 10:43:22 +01:00
Timo Jyrinki
938cd0a746 Updated Finnish translations by Jiri Grönroos. 2012-01-10 09:54:13 +01:00
Matthias Clasen
9cb4518a24 Fix wrong refencences in the docs
Replace all references to g_application_set_app_menu and
g_application_set_menubar by their gtk variants, which
actually exist. Pointed out in bug 667546
2012-01-09 17:30:09 -05:00
Matthias Clasen
64f3347cd7 Fall back to the builtin icons for spinbutton +/-
We do have list-add/-remove icons in the builtin icon theme,
so why not use them ?
2012-01-09 17:15:17 -05:00
Matthias Clasen
8ca309bd37 Add missing symbols 2012-01-09 16:19:50 -05:00
Benjamin Otte
c4566da282 styleproperty: Call style properties init function in more places
In particular, call it when querying properties by id. This is necessary
for make check to not die.
2012-01-09 22:08:48 +01:00
Matthias Clasen
2dc10600ea Fix doc markup 2012-01-09 14:13:44 -05:00
Piotr Drąg
d9ffc6e40c Updated POTFILES.in and POTFILES.skip 2012-01-09 19:51:50 +01:00
Rui Matos
e9adaabc5e Rename 'window-unfocused' to 'backdrop'
'window-unfocused' is too long and mentions "focus" which is historically
loaded with the meaning "input focus".

'backdrop' isn't generally used in GUI speak and still conveys the state the
widgets in an unfocused or background toplevel window are in.
2012-01-09 18:38:00 +01:00
Benjamin Otte
7a00a95508 themingengine: Move border-image handling into render_frame_internal()
This fixes 2 bugs:
1) extensions didn't get border images
2) border-images caused outlines to not be drawn
2012-01-09 18:38:00 +01:00
Benjamin Otte
0c483cab0c roundedbox: close path
Just because we do it everywhere else, too.
2012-01-09 18:38:00 +01:00
Benjamin Otte
c15839f4be themingengine: Implement outline support 2012-01-09 18:38:00 +01:00
Benjamin Otte
68cfb80631 themingengine: Split out the border drawing function 2012-01-09 18:38:00 +01:00
Benjamin Otte
e9cd339573 css: Add outline CSS properties 2012-01-09 18:38:00 +01:00
Benjamin Otte
1b9e15485e themingengine: Implement 'dotted' and 'dashed' 2012-01-09 18:38:00 +01:00
Benjamin Otte
34a62d779b css: Introduce a corner order enum
Same order as CSS again.

The nice thing about this is that now edge i in a rounded box follows
corner i and is followed by corner (i + 1) % 4.
2012-01-09 18:38:00 +01:00
Benjamin Otte
998055c835 css: Introduce GtkCssSide
... and use it.

This is basically an encoding of the order of sides in CSS. So when
parsing things, this is the way we parse things in.
2012-01-09 18:37:59 +01:00
Benjamin Otte
9e8e9a77b7 themingengine: Implement ridge and groove 2012-01-09 18:37:59 +01:00
Benjamin Otte
4ce34a8e13 themingengine: Redo color handling
Don't work on malloc()ed colors. Instead, use an array on the heap. This
makes it easier to copy the array.
2012-01-09 18:37:59 +01:00
Benjamin Otte
d21e7506e7 themingengine: Refactor drawing code
... and implement 'double' border-style as proof-of-concept.
2012-01-09 18:37:59 +01:00
Benjamin Otte
fbde62d8e7 css: border-style: hidden computes a 0 border 2012-01-09 18:37:59 +01:00
Benjamin Otte
de3111f1ff API: Add all border styles from CSS 3 2012-01-09 18:37:59 +01:00
Benjamin Otte
fd3afa3606 styleproperty: Simplify code
Merge 1-line function into only caller
2012-01-09 18:37:59 +01:00
Benjamin Otte
3d6a76a866 tests: Add a test for all the border shorthands
Too much fun with random test generation, so I did a big one.
2012-01-09 18:37:59 +01:00
Paolo Borelli
c167b4129e Also add border-{top|right|bottom|left} shorthands 2012-01-09 18:37:59 +01:00
Paolo Borelli
0120aaace5 Add the border css shorthand 2012-01-09 18:37:59 +01:00
Benjamin Otte
f021291423 tests: Fix for changes in this branch
The expected results are now more correct,  but still not perfect.
2012-01-09 18:37:59 +01:00
Paolo Borelli
6525ed76e0 Rename parse_border
For consistency we will use this name for the boder shorthand.
2012-01-09 18:37:59 +01:00
Paolo Borelli
04ea69ab38 Add reftets for border-style property 2012-01-09 18:37:59 +01:00
Benjamin Otte
cc2446d29b reftests: Add a CSS file to reset properties to default values
We can use this to be independant of themes. See the comment at the top
of the file
2012-01-09 18:37:59 +01:00
Paolo Borelli
b8aea82743 Use the border-style subproperties for drawing
Use the newly introduced per-side property to draw frames.
2012-01-09 18:37:59 +01:00
Benjamin Otte
2c5a8420b5 Set border-width to 0 in compute function
This reverts commit c276f53796 and
implements the same feature using the compute function.
A nice side effect is that gtk_style_property_get_border() and
gtk_style_property_get("border") to the same thing now.
2012-01-09 18:37:58 +01:00
Paolo Borelli
e69f14cf2b Add border-{top|left|bottom|right}-style properties
Add all the border-style subproperties and turn border-style itself in a
shorthand.
2012-01-09 18:37:58 +01:00
Benjamin Otte
066f3be659 themingengine: Remove an optimization
We optimize the case later on, so no need to do it here.
2012-01-09 18:37:58 +01:00
Benjamin Otte
0e48cc6dae spinbutton: Pass the right size
We need a better diffrentiation between icon sizes - ie GtkIconSize vs
pixel size. Or more CSS.
2012-01-09 18:37:58 +01:00
Benjamin Otte
bbf5fe179d background: Implement all options of background-repeat 2012-01-09 18:37:58 +01:00
Benjamin Otte
af8c7ebecd tests: Add test for background-repeat 2012-01-09 18:37:58 +01:00
Benjamin Otte
bc9373fb43 styleproperty: Parse all values for background-repeat
... and its component in the background property.
2012-01-09 18:37:58 +01:00
Benjamin Otte
77af93bad9 reftests: Add a test for 'background'
It just tests all the permutations to make sure my idea for implementing
random ordering actually works.

It does (at least currently).
2012-01-09 18:37:58 +01:00
Benjamin Otte
181ac0280d shorthand: Implement the 'background' shorthand
Weee, shorthands are now really trivial \o/
2012-01-09 18:37:58 +01:00
Benjamin Otte
a43553ab86 cssimage: Add _gtk_css_image_can_parse()
Looks at the first token of the stream to see if this looks like an
image declaration. If it does: return %TRUE.
2012-01-09 18:37:58 +01:00
Benjamin Otte
4b7ca9602d background: Simplify background-repeat
It used to be a struct, now it's just an enum
2012-01-09 18:37:58 +01:00
Benjamin Otte
07aa7f6b20 css: Remove GtkCssBorderRadius
It's not used anymore.
2012-01-09 18:37:58 +01:00
Paolo Borelli
fee09e726f Introduce _gtk_css_parser_try_length
This starts to introduce the proper API abstraction for when we will
support different units
2012-01-09 18:37:58 +01:00
Benjamin Otte
fce45757cb borderimage: Change memory management
Making it a on-stack object simplifies things a lot.
2012-01-09 18:37:58 +01:00
Benjamin Otte
9b47a6a4e3 border-image: Remove pack/unpack functions
They are not used anymore. Also, it's no longer necessary to register
GtkBorderImage as a custom GType.
2012-01-09 18:37:58 +01:00
Benjamin Otte
96abf8c725 shorthand: Make border-image unget/settable 2012-01-09 18:37:57 +01:00
Benjamin Otte
f014d4f02e shorthand: Don't require pack/unpack functions
When using G_TYPE_NONE as the shorthand's type, the property is not
gettable/settable using regular APIs, so it essentially doesn't exist.
As it should be.
2012-01-09 18:37:57 +01:00
Benjamin Otte
84bc280440 borderimage: Add _gtk_border_image_new_for_context()
and use it.
2012-01-09 18:37:57 +01:00
Benjamin Otte
cee05fbeb8 borderimage: Remove unused enums 2012-01-09 18:37:57 +01:00
Benjamin Otte
cc3e4c4eec reftests: Ensure no explicit colors are set on labels 2012-01-09 18:37:57 +01:00
Benjamin Otte
af8dd87867 styleproperty: Use a custom resolve function for colors
We want to make sure to fall back to the initial value of the property
if resolving fails.

This is kinda tricky, because the initial value itself might need
resolving, too.
2012-01-09 18:37:57 +01:00
Benjamin Otte
d10f851201 reftests: Fix a bunch of invalid CSS cases
use 'transparent' instead of 'none' for colors.
2012-01-09 18:37:57 +01:00
Benjamin Otte
839b0f5317 css: Handle 'currentColor' special value
Computes to the value of the 'color' property, or when used on that
property, is treated as 'inherit'.
2012-01-09 18:37:57 +01:00
Benjamin Otte
84d294ee7f stylecontext: NMake safe to call into during lookup
When resolving a lookup, we may want to query the current style context,
as in the next patch. This works now.
2012-01-09 18:37:57 +01:00
Benjamin Otte
6dfab12e1b styleproperty: Change order for property registration
Some properties depend on other properties, handle those first.
2012-01-09 18:37:57 +01:00
Benjamin Otte
d021ed7c5e win32: Remove GtkWin32ThemePart
Its job is done by GtkCssImage now.
2012-01-09 18:37:57 +01:00
Benjamin Otte
37b11b6c8a borderimage: Convert to using GtkCssImage 2012-01-09 18:37:57 +01:00
Benjamin Otte
52af00686b themingbackground: Convert to GtkCssImage
The conversion is incomplete and requires some work to account for
all the CSS crazies, like repeat modes and background-size.
2012-01-09 18:37:57 +01:00
Benjamin Otte
60b8b7a398 csslookup: Use the new gtk_style_context_peek_property() 2012-01-09 18:37:57 +01:00
Benjamin Otte
53b4fd69db themingengine: Add _gtk_theming_engine_peek_property()
This is useful for getting at computed values and allows accessing
images before the code autoconverts them to a cairo pattern.
2012-01-09 18:37:57 +01:00
Benjamin Otte
2c8ef919ae stylecontext: Add _gtk_style_context_peek_property()
This allows peeking at the computed value for a property. This is useful
for looking at GtkCssImage.
2012-01-09 18:37:56 +01:00
Benjamin Otte
a35df38443 theme: Apply background merging code
It was unused and untested and did not do at all what the CSS spec says.
2012-01-09 18:37:56 +01:00
Benjamin Otte
0bc170cd84 styleproperty: Convert background-image from pattern to GtkCssImage 2012-01-09 18:37:56 +01:00
Benjamin Otte
2bb899b5c0 cssimage: Add a few convenience functions 2012-01-09 18:37:56 +01:00
Benjamin Otte
cdd4ed6600 styleproperty: Use factored-out gradient parser 2012-01-09 18:37:56 +01:00
Benjamin Otte
2a6c168235 win32: Add a CssImage implementation 2012-01-09 18:37:56 +01:00
Benjamin Otte
f7eea0b86e cssimage: Add GtkCssImageGradient 2012-01-09 18:37:56 +01:00
Benjamin Otte
8f42f8c554 win32: Export _gtk_win32_theme_part_create_surface() 2012-01-09 18:37:56 +01:00
Benjamin Otte
590b125ffc win32: Export _gtk_win32_lookup_htheme_by_classname() 2012-01-09 18:37:56 +01:00
Benjamin Otte
950b95af40 cssimage: Improve new_parse() to select right image type 2012-01-09 18:37:56 +01:00
Benjamin Otte
38be9fe879 css: Add _gtk_css_parser_has_prefix() 2012-01-09 18:37:56 +01:00
Benjamin Otte
11ec705133 css: Add image implementation for urls 2012-01-09 18:37:56 +01:00
Benjamin Otte
b3389a017a css: Add GtkCssImage class
Doesn't do anything yet, just exists.
2012-01-09 18:37:56 +01:00
Benjamin Otte
9181282d88 style: Remove GtkStylePropertyContext again
We need to solve this differently. I have no idea yet how, but I'll
invent something later.

This only affects win32 theming and that's broken anyway.
2012-01-09 18:37:56 +01:00
Benjamin Otte
32c8bbb575 styleproperty: Remove context arg from _gtk_style_context_query() 2012-01-09 18:37:56 +01:00
Benjamin Otte
a9d1be0bef stylecontext: Remove GtkStylePropertyContext from pack funcs 2012-01-09 18:37:56 +01:00
Benjamin Otte
e8cb6f3165 styleproperty: Add compute_value vfunc 2012-01-09 18:37:55 +01:00
Benjamin Otte
c3d337312a styleproperty: Move parse/print vfuncs to GtkCssStyleProperty 2012-01-09 18:37:55 +01:00
Benjamin Otte
22a65bcd82 styleproperty: Add a compute vfunc 2012-01-09 18:37:55 +01:00
Benjamin Otte
232d9226f9 tests: Add test for 'initial' and 'inherit' on shorthands 2012-01-09 18:37:55 +01:00
Benjamin Otte
e87cf5d789 css: Redo value resolving
Instead of on-demand resolvage, we now resolve during lookup. The step
is done via
  _gtk_css_style_property_compute_value()
which currently calls into
  _gtk_css_style_compute_value()
That function has all the old resolving machinery.

The only part missing for now is the handling of win32 code. It will be
added back later.
2012-01-09 18:37:55 +01:00
Benjamin Otte
29382c1305 gradient: Allow resolving with contexts 2012-01-09 18:37:55 +01:00
Benjamin Otte
4576653006 stylecontext: Export _gtk_style_context_resolve_color()
We'll need it soon.
2012-01-09 18:37:55 +01:00
Benjamin Otte
f2dc63cc6a css: Pass the real context to the CSS lookup
This will be necessary soon.
2012-01-09 18:37:55 +01:00
Benjamin Otte
91202ef497 styleproperty: Move pspec to GtkCssCustomProperty
It's only used there.
2012-01-09 18:37:55 +01:00
Benjamin Otte
3375dd2a5f styleproperty: Move property_parse_func member
It belongs in GtkCssCustomProperty
2012-01-09 18:37:55 +01:00
Benjamin Otte
61042d155c styleproperty: Add custom parser for custom properties
In particular, move the property_parse_func handling to
GtkCssCustomProperty exclusively.
2012-01-09 18:37:55 +01:00
Benjamin Otte
22e9588dad styleproperty: Stop using pspecs
The pspec type is wrong most of the time anyway.
2012-01-09 18:37:55 +01:00
Benjamin Otte
799110b011 styleproperties: Don't validate values anymore
Pspecs are on their way out, so validation is, too.
2012-01-09 18:37:55 +01:00
Benjamin Otte
65f6925dd1 styleproperty: Don't use gtk_style_properties_register_property()
This would make the internal properties custom properties. And they are
not.

Also get rid of default initial values, we now specify the correct one
at all times.
2012-01-09 18:37:55 +01:00
Benjamin Otte
4b4792f65d styleproperty: Make the register functin take varargs
.. for the initial value.
2012-01-09 18:37:55 +01:00
Benjamin Otte
09b25facb0 styleproperty: Don't register a property parse func
Nobody does that anymore.
2012-01-09 18:37:54 +01:00
Benjamin Otte
8bcfa6ef78 styleproperty: Move implementations to separate file 2012-01-09 18:37:54 +01:00
Benjamin Otte
2d46618e08 styleproperty: Let parse_value() initialize the value
... and document that behavior.
2012-01-09 18:37:54 +01:00
Benjamin Otte
70af2cb2e3 styleproperty: Move parse func
It's specific to GtKCssStyleProperty after all.
2012-01-09 18:37:54 +01:00
Benjamin Otte
47a27a00f5 shorthand: Remove old parse func support
It's not used anymore
2012-01-09 18:37:54 +01:00
Benjamin Otte
069cb74691 shorthand: Do font parsing the new way 2012-01-09 18:37:54 +01:00
Benjamin Otte
f6422513b1 shorthand: Update border-image parsing
Also update tests. None is not a valid value...
2012-01-09 18:37:54 +01:00
Benjamin Otte
a0606d513c shorthand: Initialize unparsed values
All values that the parse funcs didn't parse are initialized to
'initial'.
2012-01-09 18:37:54 +01:00
Benjamin Otte
442040876a shorthand: Move border-color to new parsing code 2012-01-09 18:37:54 +01:00
Benjamin Otte
cd4470cfd3 shorthand: Move border radius parsing to new parsing code
We also now properly allow assigning an integer value to the
border-radius property.
2012-01-09 18:37:54 +01:00
Benjamin Otte
8ab426e6d5 themingengine: Don't use GtkBorderRadius struct
use GtkBorderCornerRadius instead. Also, don't do NULL checks anymore,
the property is guaranteed to never return NULL.
2012-01-09 18:37:54 +01:00
Benjamin Otte
ea6a898344 styleproperty: Set a default value for border-*-radius
That way, we don't have to check if it is indeed set.
2012-01-09 18:37:54 +01:00
Benjamin Otte
fdb3abefc3 roundedbox: Use GtkCssBorderCornerRadius type
GtkCssBorderRadius is going away.
2012-01-09 18:37:54 +01:00
Benjamin Otte
13aac54d19 shorthand: Implement border parsing with new parse func 2012-01-09 18:37:54 +01:00
Benjamin Otte
148d8fbca8 shorthand: Allow registering a new parse func 2012-01-09 18:37:54 +01:00
Benjamin Otte
14994e3fc9 styleproperty: Remove _gtk_style_property_unpack()
The function is no longer needed in public API
2012-01-09 18:37:54 +01:00
Benjamin Otte
01548bfcbe shorthand: Redo shorthand value parsing
The new approach does not need unpack functions anymore.
2012-01-09 18:37:53 +01:00
Benjamin Otte
e876d9fed5 styleproperty: Make parse_value() a vfunc 2012-01-09 18:37:53 +01:00
Benjamin Otte
4821e52cf2 styleproperty: Move pspec to GtkCssStyleProperty
shorthands don't use pspecs anymore.
2012-01-09 18:37:53 +01:00
Benjamin Otte
5ae00c3755 css: Use _gtk_style_property_get_value_type() where appropriate 2012-01-09 18:37:53 +01:00
Benjamin Otte
389531d15d styleproperty: require property in _gtk_style_property_parse_value()
Other code uses _gtk_css_style_parse_value() instead now.
2012-01-09 18:37:53 +01:00
Benjamin Otte
30eb26087c css: Feed sections to CSS lookup code 2012-01-09 18:37:53 +01:00
Benjamin Otte
79a171de0a styleproperty: Make query() and assign() vfuncs
... and implement them in the 2 known subclasses.
2012-01-09 18:37:53 +01:00
Benjamin Otte
b904679a11 styleproperty: Move value printing to real properties
We can't print shorthands, so don't try.
In particular, I want to get away from shorthands being representable
using GValue, and this function kinda requires that.
2012-01-09 18:37:53 +01:00
Benjamin Otte
078fc725e0 css: Split generic parse/print functions out
It seems to be some sort of sport for me to split them out and merge
them back in...
2012-01-09 18:37:53 +01:00
Benjamin Otte
f5fafb18c9 css: 'transparent' is a valid color everywhere 2012-01-09 18:37:53 +01:00
Benjamin Otte
36e1bcac3c css: No longer expose internal properties
... in gtk_style_properties_lookup_property(). Those properties will
soon stop having pspecs or even being gettable and settable, so better
not tell anyone about it.
2012-01-09 18:37:53 +01:00
Benjamin Otte
73a632a4ae css: Handle custom properties in a custom object
This way we can also get rid of the hack where we required modifying the
pspec after creation, as the name is now a separate property.
2012-01-09 18:37:53 +01:00
Benjamin Otte
55a38f4746 shorthand: Remove a bunch of unused functionality
- The unset func is no longer used
- Shorthands can't be printed
- property_parse funcs and initial values aren't used
2012-01-09 18:37:53 +01:00
Benjamin Otte
674485a138 styleproperties: Implement unsetting directly
With subproperties, there's no need anymore for custom unset functions.
2012-01-09 18:37:53 +01:00
Benjamin Otte
341a738dc6 styleproperty: Move member variables
These variables are only relevant for style properties, but not for
shorthands, so put them there.
2012-01-09 18:37:53 +01:00
Benjamin Otte
d9c5d37e56 shorthand: shorthands can't be inherited
... so remove the flag handling.
2012-01-09 18:37:52 +01:00
Benjamin Otte
544d210a61 css: Move a bunch of functions
... from GtkStyleProperty to GtkCssStyleProperty.
2012-01-09 18:37:52 +01:00
Benjamin Otte
0a3ac5efbc styleproperty: Move id handling
only real style properties can have an id, so let
GtkCssStylePropertyClass handle it.
2012-01-09 18:37:52 +01:00
Benjamin Otte
edb8bf4b1d styleproperty: Add gtk_style_property_assign() 2012-01-09 18:37:52 +01:00
Benjamin Otte
c9dc9d5a88 styleproperties: Use _gtk_style_property_get_value_type()
... and check the case where the property is not get/settable.
2012-01-09 18:37:52 +01:00
Benjamin Otte
7a4bbc8f35 styleproperty: Add GtkStyleProperty::value-type 2012-01-09 18:37:52 +01:00
Benjamin Otte
7a76694780 styleproperty: Use _gtk_style_property_get_name() 2012-01-09 18:37:52 +01:00
Benjamin Otte
2128b356b2 shorthand: Add a property for all subproperties 2012-01-09 18:37:52 +01:00
Benjamin Otte
4383701e25 styleproperty: unconstify
GtkStyleProperty is a real GObject now, so treat it like one and don't
use const.
2012-01-09 18:37:52 +01:00
Benjamin Otte
a3a580d53e styleproperty: Remove unuse args from register()
Those arguments are only relevant for shorthands.
2012-01-09 18:37:52 +01:00
Benjamin Otte
927b922208 styleproperty: Add custom registration func for shorthands 2012-01-09 18:37:52 +01:00
Benjamin Otte
d4344164ac styleproperty: Move shorthand declarations to new file 2012-01-09 18:37:52 +01:00
Benjamin Otte
6b386dc574 styleproperty: border image is not a generic conversion thingy 2012-01-09 18:37:52 +01:00
Benjamin Otte
4e79ed7f4f styleproperty: Add a name property
And move the properties array to GtkStylePropertyClass.
Also add some docs.
2012-01-09 18:37:52 +01:00
Benjamin Otte
81b2bb0ade styleproperty: Get rid of _gtk_style_property_is_shorthand()
Use GTK_IS_CSS_SHORTHAND_PROPERTY() instead now that we have it.
2012-01-09 18:37:51 +01:00
Benjamin Otte
f9485241b1 styleproperty: Split into shorthand and real style properties 2012-01-09 18:37:51 +01:00
Benjamin Otte
f62c79b41c tests: Quit widget-factory when someone presses quit 2012-01-09 18:37:51 +01:00
Benjamin Otte
78dc75a350 styleproperty: Make this an object 2012-01-09 18:37:51 +01:00
Benjamin Otte
3e24b5dbbe styleproperty: Add _gtk_style_property_query()
This way, we only need to export one function, not 3.
2012-01-09 18:37:51 +01:00
Benjamin Otte
2573e72f49 styleproperties: Add _gtk_style_properties_peek_property() 2012-01-09 18:37:51 +01:00
Benjamin Otte
38e1c0a2d6 styleproperties: Remove unused function from private header
_gtk_style_properties_resolve_property() was added erroneously in
c09148ca09 but was never implemented.
2012-01-09 18:37:51 +01:00
Benjamin Otte
06960bb9d6 tests: Add a test for 'none' 2012-01-09 18:37:51 +01:00
Benjamin Otte
4da493402d css: 'none' is not a value background-repeat 2012-01-09 18:37:51 +01:00
Benjamin Otte
6fdf6ba68f css: Remove generic 'none' handling
Includes updated tests.
Who could have thought that our tests were broken. Ooops.
2012-01-09 18:37:51 +01:00
Benjamin Otte
7d353fbccf win32: Fix CSS for 'none' value going away
We want colors to be 'transparent' and not 'none'.
2012-01-09 18:37:51 +01:00
Benjamin Otte
c77dba2767 styleproperty: Add custom 'none' handling
The generic 'none' handling needs to go, because 'none' is not a valid
value most of the time.
2012-01-09 18:37:51 +01:00
Benjamin Otte
78024504aa reftests: Add a test comparing inherit and initial
One test has all properties set to 'inherit', the other to 'initial'.
This should result in the same result, as inherit will ensure every
widget inherits the same value, and for the toplevel 'inherit' is
defined as being identical to 'initial'.
2012-01-09 18:37:51 +01:00
Benjamin Otte
53bb230e12 reftests: Add a test for a parent in a different state
inherit in those cases should inherit from that different state, not
from this state.
2012-01-09 18:37:51 +01:00
Benjamin Otte
e9dfb8d5b8 tests: Add tests for 'inherit' and 'initial' 2012-01-09 18:37:51 +01:00
Benjamin Otte
57379adb3c css: Add generic support for 'inherit' and 'initial'
CSS3 says they work for every property, so here we go.
2012-01-09 18:37:51 +01:00
Benjamin Otte
a6ac53e2a9 css: Change prototype of _gtk_css_selector_matches()
Passing the length of the widget path that is relevant is not necessary
anymore, it was only useful for inheritance. Instead, we now pass the
state flags and let the selector do the state matching for us.
2012-01-09 18:37:50 +01:00
Benjamin Otte
a3225fdd42 cssprovider: Remove has_inherit flag from rulesets
It's not used anymore
2012-01-09 18:37:50 +01:00
Benjamin Otte
40a7618d2a cssprovider: Don't do inheritance anymore
Its' done in GtkCssLookup with the help of GtkStyleContext::parent now.
2012-01-09 18:37:50 +01:00
Benjamin Otte
fbedcdaf7d css: Make CSS resolving work according to spec
See inline code comments taken from
  http://dev.w3.org/csswg/css3-cascade/#cascade

This now respects the special values "inherit" and "initial" properly.
Note that those values cannot be parsed yet. This will be added in a
future commit.
2012-01-09 18:37:50 +01:00
Benjamin Otte
5a815e2159 styleproperty: Add _gtk_style_property_get_initial_value() 2012-01-09 18:37:50 +01:00
Benjamin Otte
242893a031 css: Pass the parent context to _gtk_css_lookup_resolve()
This way, we can resolve inherit properties.
2012-01-09 18:37:50 +01:00
Benjamin Otte
0ac519e8a1 widget: Set parent style context 2012-01-09 18:37:50 +01:00
Benjamin Otte
b50d2b74d7 API: Add GtkStyleContext::parent
We need this for proper support of CSS inherit.
2012-01-09 18:37:50 +01:00
Benjamin Otte
aa4925480d styleproperty: Pass initial value explicitly 2012-01-09 18:37:50 +01:00
Benjamin Otte
4d15186e67 css: Add GtkCssSpecialValue 2012-01-09 18:37:50 +01:00
Benjamin Otte
6dd50c6cca css: Add some docs to GtkCssLookup
In particular, document which parts of the CSS value querying we're
doing here.
2012-01-09 18:37:50 +01:00
Benjamin Otte
821f9b478f reftests: Add test for pseudo-class matching
Previous GTK matched pseudoclasses not based on CSS rules, but based on
their value in the enumeration. This is now fixed.
2012-01-09 18:37:50 +01:00
Benjamin Otte
ba5e7012b1 css: Redo StyleProvider interface
We now use the GtkStleProviderPrivate interface, which hopefully is
faster and more conformant to CSS. Long term, it definitely should be
both.

I would have liked to split this up into multiple commits, but couldn't
find a way.
2012-01-09 18:37:50 +01:00
Benjamin Otte
38a9b28a0e styleproperties: Add a hacky function to redirect color lookups
This will soon be necessary.
FIXME: Make sure this gets removed again.
2012-01-09 18:37:49 +01:00
Benjamin Otte
c048aac1d9 symboliccolor: Add _gtk_symbolic_color_resolve_full() 2012-01-09 18:37:49 +01:00
Benjamin Otte
899a381d31 stylecontext: Separate properties by states
We don't want to mix states the wrong way. And the current approach does
that.
2012-01-09 18:37:49 +01:00
Benjamin Otte
a488d2184a stylecontext: Pass state to style data lookup function 2012-01-09 18:37:49 +01:00
Benjamin Otte
cdb3f05bf1 css: Add _gtk_style_property_get_count() 2012-01-09 18:37:49 +01:00
Benjamin Otte
54d2b9dbc2 cssprovider: Keep a bitmask for the properties
That way we can easily tell wich properties are in use.
2012-01-09 18:37:49 +01:00
Benjamin Otte
eb38591c91 css: Add _gtk_style_property_get_id() 2012-01-09 18:37:49 +01:00
Benjamin Otte
f6cf447cad styleproperty: Assign a unique id to every styleproperty 2012-01-09 18:37:49 +01:00
Benjamin Otte
eddd36d1d9 tests: Add tests for GtkBitmask 2012-01-09 18:37:49 +01:00
Benjamin Otte
45b9193290 gtk: Add GtkBitmask
The CSS code likes to have that very much.
2012-01-09 18:37:49 +01:00
Stefan Sauer
f7d3ca46f7 gtkscale: fix bogus compare func
The GtkScaleMark values are gdouble, a simple a-b compare func would fail for
values with the same integer value. This breaks the sorting and causes random
marker label placement.
2012-01-09 18:33:11 +01:00
Rob Bradford
1f023cd2b1 wayland: Constrain the window configure requests to the window's geometry
When we receive a configure event from Wayland telling us to resize our
surface we check against the geometry constraints for the window to ensure we
do not resize below the minimum and maximum limits.
2012-01-09 17:19:34 +00:00
Rob Bradford
4107ef0b93 wayland: Implement set_geometry_hints vfunc
Our trivial implementation simply saves the passed in parameters into the
Wayland private data structure.
2012-01-09 17:19:34 +00:00
Rui Matos
052c6e0681 scrolledwindow: Render the background so that it can be styled 2012-01-09 16:45:44 +00:00
Rui Matos
09979513b2 window: Stop setting state flags on the style context for drawing
This also removes setting the FOCUSED state flag when
gtk_window_has_toplevel_focus() since this effect can now be done with the new
WINDOW_UNFOCUSED flag instead which actually works better regarding X grabs
and modal windows.
2012-01-09 16:45:44 +00:00
Rui Matos
440663f3fe treeview: Use the widget state flags as a base for drawing expanders 2012-01-09 16:45:44 +00:00
Rui Matos
2972236fdb treeview: Stop setting state flags on the style context for drawing 2012-01-09 16:45:44 +00:00
Rui Matos
76485b8670 trayicon-x11: Stop setting state flags on the style context for drawing 2012-01-09 16:45:44 +00:00
Rui Matos
8bb0773535 toolitemgroup: Use the widget state flags as a base for drawing 2012-01-09 16:45:44 +00:00
Rui Matos
4011326388 toolbar: Stop setting state flags on the style context for drawing 2012-01-09 16:45:44 +00:00
Rui Matos
a1f72eb06c Revert "button: Stop setting state flags on the style context for drawing"
Setting state flags is actually needed here since this function is called by
GtkButton subclasses which add their specific state flags as a parameter.

This reverts commit e868b8d6ea.
2012-01-09 16:45:44 +00:00
Rui Matos
2efa658a41 textdisplay: Use the widget state flags as a base for drawing 2012-01-09 16:45:44 +00:00
Rui Matos
b203ea2f93 spinner: Stop setting state flags on the style context for drawing 2012-01-09 16:45:44 +00:00
Rui Matos
e9549a7514 spinbutton: Use the widget state flags as a base for drawing 2012-01-09 16:45:43 +00:00
Rui Matos
9118ccb02d separator: Stop setting state flags on the style context for drawing 2012-01-09 16:31:11 +00:00
Rui Matos
95caabac03 scale: Stop setting state flags on the style context for drawing 2012-01-09 16:31:11 +00:00
Rui Matos
b2f5959147 range: Use the widget state flags as a base for drawing 2012-01-09 16:31:11 +00:00
Rui Matos
6dd0bd5536 radiobutton: Use the widget state flags as a base for drawing 2012-01-09 16:31:11 +00:00
Rui Matos
c98e9c94e7 widget-factory: Make the second spin button insensitive 2012-01-09 16:31:11 +00:00
Rob Bradford
eedd1ec92f wayland: Make the resize and move functions use gdk_device_ungrab
Now that grab and ungrab vfuncs are implemented on GdkDevice then we can use
gdk_device_ungrab to break the implicit grab created by the button press that
triggered the resize and move.
2012-01-09 16:00:14 +00:00
Kristian Høgsberg
e5283122fd wayland: Add implementations for the device_grab / device_ungrab vfuncs
This allows the correct implementation of breaking the grab in pointer driven
resize and move.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2012-01-09 15:59:02 +00:00
Rob Bradford
4007449a58 application: Correct the fallback definition for gtk_application_end_session
The function definition used a pointer to the enum value rather than the enum
itself.

This broke the build on platforms that don't have an implmentation of these
functions.
2012-01-09 15:09:27 +00:00
Ryan Lortie
cf2590d673 GtkButton: do not allow both types of actions
Only allow one of 'action-name' or 'related-action' to be set.

https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-09 15:02:10 +01:00
Ryan Lortie
4dbd12b1d8 bloatpad: add left/centre/right toolbar buttons
https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-09 15:02:08 +01:00
Ryan Lortie
88ec007b98 Add new GtkActionable interface
This is the interface for GtkWidgets that can be associated with an
action on a GtkAppicationWindow or associated GtkApplication.

It essentially features 'action-name' and 'action-target' properties
with some associated convenience API.

This interface is implemented by GtkButton and GtkToolButton.

https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-09 15:02:06 +01:00
Ryan Lortie
a3629592d3 drop debian/ directory 2012-01-09 14:29:11 +01:00
Murray Cumming
395bf54b8e gtkmain.h: Used GDK_DEPRECATED
If we use just G_GNUC_DEPRECATED then it cannot be disabled by
an ifdef.
2012-01-09 14:20:49 +01:00
Matthias Clasen
69a529572d Revert "GtkWindow: new API to store state in GSettings"
This reverts commit 730765de91.

This needs more thought, committing it on the same day as filing
the bug was premature.
2012-01-09 00:53:53 -05:00
Matthias Clasen
2ef4621e05 Fix up symbol lists 2012-01-09 00:31:20 -05:00
Matthias Clasen
ef1bc2923e Add more tests for GdkRGBA parsing
These examples are taken from bug 667485.
2012-01-09 00:31:20 -05:00
Matthias Clasen
e5e6d25a50 Tighten up GdkRGBA parsing
gdk_rgba_parse was accepting too much nonsense, as pointed out
in bug 667485.
2012-01-09 00:31:20 -05:00
Daniel Mustieles
7ac975bb48 Updated Spanish translation 2012-01-08 20:17:36 +01:00
Alexander Shopov
6d22bfe19c Updated Bulgarian translation 2012-01-08 17:21:05 +02:00
Matthias Clasen
f3533e4fc2 Fix the gtk_application_end_session implementation
We were passing the wrong flags, causing the meaning of
the request_confirmation parameter to be inverted.
2012-01-08 02:16:26 -05:00
Matthias Clasen
0191f11a7a Add a test for the new session api 2012-01-08 02:15:49 -05:00
Matthias Clasen
d2ed87fbdc Fix doc build 2012-01-07 21:47:42 -05:00
Matthias Clasen
27c21249b7 Add session management migration chapter
Add some preliminary information about migration from EggSMClient
to GtkApplication.
2012-01-07 21:44:52 -05:00
Matthias Clasen
983b7be5ab Rearrange migration chapter a bit
The 'checklist' is really just the 'extra credits', so put it
at the end, rather than the beginning.
2012-01-07 20:44:37 -05:00
Matthias Clasen
f78696f3d0 GtkApplication: only allow quit_response when it make sense
This check was present in the OS X implementation, but it
makes sense in the D-Bus implementation as well.
2012-01-07 20:01:23 -05:00
Matthias Clasen
00d5214695 Remove some debug spew 2012-01-07 19:55:20 -05:00
Matthias Clasen
bb957e5389 GtkApplication: Add OS X implementation from EggSMClient 2012-01-07 19:52:14 -05:00
Matthias Clasen
b3f2b41567 Rename rgba test file
Not testing GdkColor here, anymore.
2012-01-07 19:02:48 -05:00
Matthias Clasen
1e867a94a2 Use g_slice_dup
This saves some manual copying.
Pointed out in bug 667473.
2012-01-07 19:00:47 -05:00
Matthias Clasen
2b16ec9f14 Add a test for gdk_rgba_copy 2012-01-07 19:00:32 -05:00
Daniel Mustieles
166a3a1cf1 Missing file in POTFILEs.in 2012-01-07 18:53:26 +01:00
Paolo Borelli
7c8130dada Change param name to make gtk-doc happy. 2012-01-07 18:06:59 +01:00
Benjamin Otte
2359f03b6b tests: Fix deprecation warnings in prop-editor 2012-01-07 16:14:31 +01:00
Benjamin Otte
f6d2f4fa8d application: return a value 2012-01-07 15:56:26 +01:00
Martin Pitt
700a334d87 gtkapplication.c: Fix syntax error
Previous commit accidentally removed the closing } from
gtk_application_end_session(). Add it back to unbreak the build.
2012-01-07 10:04:18 +01:00
Matthias Clasen
916009b5d6 Add a trivial implementation of the new apis
For non-X11, this is just a placeholder until we get around
to moving the EggSMClient implementations over.
2012-01-07 03:20:56 -05:00
Matthias Clasen
48872705f0 Document the new apis 2012-01-07 03:20:56 -05:00
Matthias Clasen
3142d13972 Add gtk_application_end_session
This function allows applications to request that
the user session be ended by logout/shutdown/reboot.
2012-01-07 03:20:56 -05:00
Matthias Clasen
bdd7e15c84 GtkApplication: Add an inhibit api
This lets applications block logout and similar actions ahead
of time. Currently only implemented for D-Bus, but Windows has
very similar API since Vista.
2012-01-07 03:20:56 -05:00
Matthias Clasen
3133791302 GtkApplication: Add logout notification
This is fairly basic, allowing applications to learn when
the session manager is about to end the session, and possibly
block this. The only implementation at this point is using the
org.gnome.SessionManager D-Bus interface of gnome-session. It should
be straightforward to port the EggSMClient implementations for
Windows and OS X.
2012-01-07 03:20:56 -05:00
Chun-wei Fan
b40d16972f Update Visual C++ property sheets
"Install" (and hence compile with glib-compile-schemas.exe) the new
org.gtk.WindowState.gschema.xml gschema file.
2012-01-07 11:21:46 +08:00
Ryan Lortie
730765de91 GtkWindow: new API to store state in GSettings
https://bugzilla.gnome.org/show_bug.cgi?id=667438
2012-01-06 16:18:48 -05:00
Ryan Lortie
d47c3ac9e4 GtkBuilder: support parsing GVariant properties
https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-06 16:18:48 -05:00
Piotr Drąg
5ec521aad0 Updated POTFILES.skip 2012-01-06 21:18:28 +01:00
Rob Bradford
47146dacff wayland: Break an implicit grab when asking to be resized
An implicit grab is created inside GTK+ when the button is pressed down on a
window. The semantics of wl_shell_surface_resize means that you don't get a
corresponding release event that would ordinarily break the implicit grab. So
we must do it as part of the resize request.
2012-01-06 16:58:06 +00:00
Rob Bradford
675b2fddcb wayland: Make the event source use _gdk_display_get_next_serial 2012-01-06 16:58:05 +00:00
Rob Bradford
e13cca00cc wayland: Implement the get_next_serial vfunc on GdkDisplay 2012-01-06 16:58:05 +00:00
Zeeshan Ali (Khattak)
1996618569 gtkspinbutton: Don't hilight buttons when !editable
Don't hilight the buttons on mouse over when 'editable' property is set to
'FALSE.

https://bugzilla.gnome.org/show_bug.cgi?id=667229
2012-01-06 18:35:37 +02:00
Kristian Høgsberg
e2dd95aced wayland: The shared cursors are now installed in the weston directory
Signed-off-by: Rob Bradford <rob@linux.intel.com>
2012-01-06 15:12:14 +00:00
Matthias Clasen
7df5cf2a3a GtkApplication: Rename a member for clarity
'session' is a bit ambiguous (and GtkApplication may grow session
management support at some point), so rename the bus connection
to 'session_bus'.
2012-01-05 23:53:40 -05:00
Matthias Clasen
c74ac08143 Another attempt at fixing menu positioning corner cases
The code for moving the menu into monitor / workarea was duplicated,
once for the push-in scenario and once for without. The problem with
the second case is that we've stored the menu position before adjusting
it. That made us remember an out-of-monitor position that then later
triggered _another_ copy of this code in the size-request implementation.

Unify this to only have one copy of code, and only store the menu
position after adjusting it to be inside the monitor. This fixes both
statusicon menus that get popped up from the panel, outside the workarea,
to not have scroll arrows, and the gedit language menu which was not
placed in the monitor at all after the initial workarea commit.

As a side-effect of this change, we now make large scrolling menus
occupy the full height of the workarea. Before this change, we were
keeping either the top or bottom edge put while shrinking the menu
to fit in the monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=667249
2012-01-05 23:30:41 -05:00
Benjamin Otte
00e84f1cdb label: Avoid deprecation warning 2012-01-06 05:23:43 +01:00
Benjamin Otte
42d0a6de23 label: Actually mark visited labels as visited
A recalculate will clear the labels and compute them again, which will
clear the information if something was visited...
2012-01-06 05:23:43 +01:00
Benjamin Otte
b73ede690d reftests: Add a test for latest commit
We want to make sure we notice when we mess up label attribute ordering
again...
2012-01-06 05:23:43 +01:00
Benjamin Otte
d6bb8a63aa label: Make attr_list_merge() use sane merging rules
Instead of "attribute with later start index wins, make sure the
attribute list that is merged from takes precedence. This now gives the
multiple attribute lists we use in the label an order:

1) gtk_label_set_attributes()
  These attributes override everything. It's what the function's there
  for after all.
2) markup of label
  Other user-specified attributes come next.
3) attributes for links
  When we apply custom attributes on parts of the text, we put them
  last. We don't want to mess with what the user does. Also, we change
  color and underline, so we usually have something to show.
2012-01-06 05:23:42 +01:00
Benjamin Otte
e78e4d8dd8 label: Rename variable
The effective attributes aren't that anymore. They're now just the
attributes from the parsed markup.
2012-01-06 05:23:42 +01:00
Benjamin Otte
f1c9a3e633 label: Don't excessively recalculate
We don't merge attributes anymore, so no need to call the function that
used to do this job.
2012-01-06 05:23:42 +01:00
Benjamin Otte
396b177e3b label: Redo attribute application
- Don't compute link color attributes until layout creation
This is useful as a performance enhancement, because we don't have to
lookup the property after setting the text, so multiple markup sets
don't cost style lookups.
- Don't merge attrs into effective_attrs
We do this when applying link colors now. Keeping them separate allows
invalidating them separately.
2012-01-06 05:23:42 +01:00
Benjamin Otte
15ac572822 ilabel: Redo gtk_label_get_link_colors()
Don't pass out an allocated color, assign it instead. Gets rid of having
to call gdk_color_free() all the time.
2012-01-06 05:23:42 +01:00
Benjamin Otte
dd4df24382 label: Split out function that merges attr lists 2012-01-06 05:23:42 +01:00
Benjamin Otte
5783d3b68c gtk-demo: Prove that links work fine now
Also, doodling is fun.
2012-01-06 05:23:42 +01:00
Benjamin Otte
712d577531 label: Redo links parsing
Instead of getting confused by applied underline or color tags in the
regular markup, we store the link start/end when we actually parse the
text. As a bonus, we can avoid rescanning links when creating the
markup.
2012-01-06 05:23:42 +01:00
Benjamin Otte
18ce0b21a0 label: Move function into only caller 2012-01-06 05:23:42 +01:00
Benjamin Otte
fc37e2749c API: Deprecate key snooping
You really shouldn't be doing this. If you have to, you can use
gdk_window_add_filter() or listen to raw events on XI2.
2012-01-06 05:23:42 +01:00
Benjamin Otte
0c8ecba7dc a11y: Remove keysnooping support
As previously announced, key snooping is something that we should not
support in GTK. In particular because AT-SPI made every key press a
synchronous DBUS call / spawned a nested main loop with the key
snoopers. This breaks responsiveness, order of key presses and internal
consistency when the AT decides to remove key events.
2012-01-06 05:23:42 +01:00
Zeeshan Ali (Khattak)
43e29f7cbf gtkspinbutton: Ignore keynav when !editable
Don't allow changing of value through keyboard when 'editable' property is
set to 'FALSE.

https://bugzilla.gnome.org/show_bug.cgi?id=667229
2012-01-06 05:45:46 +02:00
Benjamin Berg
b3e352f489 Improve PICKONE_* handling in GtkPrinterOptionWidget (bug #543520)
This patch modifies GtkPrinterOptionWidget to support loading them
again. It also allows the user to enter values from the dropdown list
to select the item.
2012-01-06 00:20:42 +01:00
Benjamin Berg
6fa6576dda Set cups Custom print options correctly (bug #543520, patch by Marek Kašík)
This patch fixes the cups print backend to pass Custom options with
the "Custom." prefix to cups if neccessary.
2012-01-06 00:20:42 +01:00
Matthias Clasen
f7fb2fbebd Use the right icon-name for missing images
Patch by Erik van Pienbroek, bug 629878.
2012-01-05 14:07:04 -05:00
Rob Bradford
ff016a7857 wayland: Set a default cursor when the window cursor is set to NULL
This change follows on from a change in semantics in Wayland where calling
wl_input_device_attach with nil would make the compositor set the pointer
sprite to it's default cursor sprite.
2012-01-05 17:39:14 +00:00
Marek Kasik
f1995f80e7 GtkPrintUnixDialog: Hide unused tabs
Don't show tabs which are empty. This is related to
the recent GtkTable -> GtkGrid conversion. (#663479)
2012-01-05 13:17:46 +01:00
Xan Lopez
5f53045707 Revert "gtksettings.c: Do not use GdkColor API"
This reverts commit baef3e5f24.

This broke the Adwaita theme pretty severely, so I don't think it can
be right. See: http://i.imgur.com/Rq7wc.png
2012-01-05 12:22:05 +01:00
Javier Jardón
baef3e5f24 gtksettings.c: Do not use GdkColor API 2012-01-05 04:38:22 +01:00
Javier Jardón
e77ffa6f87 gtkcolorsel.c: Do not use GdkColor API 2012-01-05 04:38:22 +01:00
Javier Jardón
d005b01319 gtk/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Javier Jardón
6ad6f719c6 modules/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Javier Jardón
24360a8076 gdk/*: Use g_list_free_full convenience function 2012-01-05 04:22:42 +01:00
Javier Jardón
08a2b910e5 tests: Use g_list_free_full() convenience function 2012-01-05 04:22:42 +01:00
Ryan Lortie
0ea48c4139 GtkComboBoxText: allow id='' tag in builder markup
Presently, GtkComboBoxText lets you list the items for it in the
GtkBuilder markup like so:

<items>
  <item translatable='yes'>Red</item>
  <item translatable='yes'>Blue</item>
</items>

but has no way to set the "id" column for added items.  Add an id='' tag
for that purpose so that you can do:

  <item id='red' translatable='yes'>Red</item>

https://bugzilla.gnome.org/show_bug.cgi?id=667319
2012-01-04 17:00:35 -05:00
Xan Lopez
eeb9de80e1 GtkNotebook: fix crash when DnD tabs between windows
When doing DnD between windows the tab label is set as the child of
the DnD info window. If this is happening the remove method of
GtkNotebook should not unparent the tab label, since it's been already
unparented, belongs to the DnD window and will be properly destroyed
when the DnD is over.

https://bugzilla.gnome.org/show_bug.cgi?id=639875
2012-01-04 08:48:46 +01:00
Javier Jardón
912375ff38 gtk/gtkcolorbutton.c: Do not use deprecated GdkColor api 2012-01-04 01:55:16 +01:00
Zeeshan Ali (Khattak)
3caa370bb5 gtkspinbutton: Respect value of inherited 'editable' property
When this property is set to 'FALSE', user's click on the buttons
should not actually update the value but rather result in error bell.

https://bugzilla.gnome.org/show_bug.cgi?id=667229
2012-01-04 00:49:35 +02:00
Federico Mena Quintero
022c576bd2 treeview: bgo#666685 - Crash when toggling the selected status of a row
The refactoring from e01af5c5c seems to have caused this inadvertently.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-01-03 15:08:34 -06:00
Javier Jardón
abb7f40fb8 gtkcolorsel: Do not use deprecated GdkColor api 2012-01-03 18:00:57 +01:00
Javier Jardón
49d232d3a0 gtkcellview: Do not use deprecated GdkColor api 2012-01-03 18:00:57 +01:00
Chun-wei Fan
9f6e7d214c gtk/gtkprivate.c: Include stdlib.h
Include stdlib.h for getenv to avoid C4013/implicit declaration of ...
warnings
2012-01-04 00:52:44 +08:00
Javier Jardón
1796e2f6ba test/testgtk.c: Fix compilation warning 2012-01-03 16:58:42 +01:00
Matthias Clasen
266866e82c Fix problems with DND on some X servers
When the X server does not support the shape extension (as some
vnc implementations seem to), our DND code was always seeing
an empty input shape, so drops always missed their target.

http://bugzilla.gnome.org/show_bug.cgi?id=620240
2012-01-03 10:57:53 -05:00
Emmanuele Bassi
c62a1fd522 Add symbolic constants for event emission control
Similar to https://bugzilla.gnome.org/show_bug.cgi?id=631413 in GLib,
GTK+ should have symbolic constants for controlling the event handling
instead of a mere boolean value.

The GDK_EVENT_PROPAGATE and GDK_EVENT_STOP constants map to FALSE and
TRUE respectively.

https://bugzilla.gnome.org/show_bug.cgi?id=631414
2012-01-03 12:58:43 +00:00
Ignacio Casal Quinteiro
f0b8fc69e8 textdisplay: use g_list_free_full 2012-01-01 22:38:30 +01:00
Kjell Ahlstedt
6aeab7b7cc comboboxtext: Set entry-text-column and id-column props in the constructor
This is cleaner than setting the value in the _new() functions and
makes binding and GtkBuilder instantiation easier. Bug #612396, comment 65.
2011-12-30 11:10:26 +01:00
Chun-wei Fan
d273b817e8 Bug 667018-gtk/gtkwindow.c: Include deprecated/gtkstyle.h
This is needed for the prototype of gtk_widget_reset_rc_styles, to avoid
C4013/implicit declaration of ... warnings of that function
2011-12-30 17:25:48 +08:00
Chun-wei Fan
1a122a4367 gtk/gtkspinbutton.c: Remove lingering ';'
...so that C89 compilers will not complain
2011-12-30 17:25:47 +08:00
Yaron Shahrabani
42bf233d59 Updated Hebrew translation. 2011-12-30 11:12:58 +02:00
Chun-wei Fan
24e476caab gtk/Makefile.am: Update VS projects completion
Take the sources in gtk/deprecated/ into account-VS does not like '/'
in file paths.
2011-12-30 16:44:55 +08:00
Chun-wei Fan
f166cddeb4 Update Visual C++ projects
-Update include paths for the GTK+ main projects to be consistent across
 the board
-Update demo projects to add a new demo source file, transparent.c
2011-12-30 16:40:06 +08:00
Chun-wei Fan
bdb98fdfcc Update gdk/gdkconfig.h.win32
Apparently the deprecation warning macros are placed into gdkconfig.h
during the configure stage, so put these in the pre-configured
gdkconfig.h.win32 as well, as their definitions are needed for all builds.
2011-12-30 16:21:38 +08:00
Matthias Clasen
2637240abe Remove an unnecessary warning
Don't warn if there's more than one mnemonic label for a widget,
and skip invisible labels.

Bug 665015
2011-12-30 02:01:15 -05:00
Matthias Clasen
d7e8388e9d Add a Since tag
gtk_css_provider_to_string is a post-3.0 addition.
Fixes bug 659516
2011-12-30 00:38:06 -05:00
Matthias Clasen
08c89c11d1 Drop -uninstalled.pc files
This has already been done in GLib, so follow suit here.
2011-12-30 00:28:15 -05:00
Matthias Clasen
ebd28de588 XIM: gracefully deal with non-X backends
Patch by Young-Ho Cha, bug 660309.
2011-12-29 23:43:51 -05:00
Matthias Clasen
3c70a12785 GtkImContextSimple: fix tentative match handling
When switching to the compact table format, we inadvertedly lost
the 'tentative match' handling which allows to complete longer
compose sequences even if a prefix is a complete sequence.
This was pointed out in bug 666710.
2011-12-29 23:42:03 -05:00
Matthias Clasen
694bbf4ac0 Cosmetic changes to comments 2011-12-29 23:42:03 -05:00
Piotr Drąg
849770ac54 Updated POTFILES.skip 2011-12-29 17:49:58 +01:00
Benjamin Otte
45161fbb55 settings: Cache style properties
This way we don't need to compute them every lookup. (That's not the
real reason though - the real reason is that I want to add new APIs that
require the caching because they return consts).
2011-12-29 10:10:32 +01:00
Benjamin Otte
524938aa53 modifierstyle: Move Private typedef to public header 2011-12-29 10:10:22 +01:00
Benjamin Otte
84c061b861 reftests: Add test for empty grid with spacing
This used to crash.

https://bugzilla.gnome.org/show_bug.cgi?id=660139
2011-12-29 10:03:59 +01:00
Matthias Clasen
01320e5773 Fix problems with sticky handling
Reading a card32 property into a long may lead to undefined high
bits, so mask them off. Also, make the conditions for setting and
unsetting the stick flag opposites, to avoid unintended changes.
Patch by John Lindgren, bug 666842
2011-12-28 11:20:47 -05:00
Matthias Clasen
19b47b931e Update various EWMH interactions
The current EWMH has added 'source indication' fields to a number
of client messages. Set these to 1 to indicate a regular client.
Also fill the button field of _NET_WM_MOVERESIZE.
2011-12-28 11:16:54 -05:00
Javier Jardón
465301c64f tests/testgtk: Do not use GdkColor-based api 2011-12-26 17:12:20 +01:00
Daniel Mustieles
deeac44abb Updated Spanish translation 2011-12-26 11:10:17 +01:00
Ignacio Casal Quinteiro
1abf7618c0 gtktextlayout: use g_slice for GtkTextLineDisplay 2011-12-25 18:13:51 +01:00
Ignacio Casal Quinteiro
359d8c9856 gtktextbtree: use g_slice 2011-12-25 17:49:03 +01:00
Benjamin Otte
ab1699510e themingbackground: Avoid erroring cairo context 2011-12-23 22:30:45 +01:00
Benjamin Otte
396ae8f1de tests: Make widget-factory close when window is closed 2011-12-23 22:30:45 +01:00
Benjamin Otte
58d553c604 cssprovider: Fix leak
Thanks to the heroic valgrinding efforts of Olivier Sessnik, another
leak could be plugged.
2011-12-23 22:30:45 +01:00
Matthias Clasen
fbc3db8ba9 Fix scroll_offset handling
scroll_offset can be negative here, so replace a > 0 test
by != 0.
2011-12-23 00:36:20 -05:00
Matthias Clasen
f1bfdda3fd Only push the menu in if the position function said so 2011-12-23 00:36:20 -05:00
Matthias Clasen
a553cb50ab Use gtk_widget_get_allocated_width/height where it makes sense 2011-12-23 00:36:20 -05:00
Matthias Clasen
53ce519b1f Remove an unneeded variable 2011-12-23 00:36:20 -05:00
Matthias Clasen
547baf0e5f Remove an unused struct 2011-12-23 00:36:19 -05:00
Benjamin Otte
9707d964f7 combobox: Don't allow an individual cell to cheat
Make sure we only set sensitive when the cell is sensitive and visible.
Also avoid invalid memory accesses if no cells existed.
2011-12-23 00:15:59 +01:00
Benjamin Otte
8a83f0c2d1 widget: Print a g_warning() when a cairo_t is invalid
Only print the warning on internal code, so we aren't too verbose.
2011-12-23 00:15:59 +01:00
Benjamin Otte
d1c92c38df styleproperties: Move private struct declaration into public header 2011-12-23 00:15:59 +01:00
Benjamin Otte
a61ba41167 x11: Don't handle focus events for NULL windows
The check was accidentally removed in the refactoring of
2ea328dfbc.
2011-12-23 00:15:59 +01:00
Matthias Clasen
18406b7b04 Revert "x11: Avoid spurious focus events on grabs"
This reverts commit db4a6040af.

This is causing bad focus confusion e.g. in gnome-terminal.
2011-12-22 16:03:56 +00:00
Javier Jardón
a3abc18858 Deprecate all the public API that is using GdkColor struct 2011-12-22 02:59:39 +00:00
Javier Jardón
115d92aa11 gtkappchooserwidget: Use g_object_clear() 2011-12-22 02:57:35 +00:00
Ryan Lortie
182fbba2bf GtkModelMenu: drop extra & added by mistake 2011-12-21 17:15:16 -05:00
Cosimo Cecchi
157d9271fa application: don't unconditionally unref the GMenuModel in getters
Both the app-menu and menubar models can be NULL, so we shouldn't
blindly unref them, since g_object_unref() doesn't cope with NULL
pointers.
2011-12-21 12:20:15 +01:00
Cosimo Cecchi
72c04c064a application: mark menu/menubar getters as (transfer none)
Since they do not return a reference to the underlying GMenuModel.
2011-12-21 12:19:31 +01:00
Cosimo Cecchi
9ae0ffb9cb application: use the same variable names in definitions and declarations
gobject-introspection will be confused and mark the methods as not
introspectable otherwise.
2011-12-21 11:29:39 +01:00
Colin Walters
06307dd774 GtkAction: Hold a reference to proxy widgets
Previously we expect that a proxy widget holds a reference to the
action via gtk_activatable_do_set_related_action().  However, it
is possible for the widget to still be in a floating state when
it adds itself to the the action.

This is a problem when gtk_action_get_proxies() gets called, because
we return floating objects back to the user.  And language bindings
aren't going to be expecting that.

Fix this by calling ref_sink() and unref().

https://bugzilla.gnome.org/show_bug.cgi?id=657367
2011-12-20 15:36:48 -05:00
Matthias Clasen
b5577781d1 GtkApplicationWindow: fix a typo
And add a link to the screenshots.
2011-12-20 14:10:39 -05:00
Javier Jardón
325142fba7 tests/testcombo.c: Use GdkRGBA instead GdkColor 2011-12-20 18:32:15 +00:00
Javier Jardón
f84c124e53 gtk/gtkcellview.c: Use new GdkRGBA api instead GdkColor one 2011-12-20 18:32:15 +00:00
Javier Jardón
e24634537e gtk/gtktrayicon-x11.c: Use new GdkRGBA api instead GDKColor one 2011-12-20 18:32:15 +00:00
Cosimo Cecchi
2827cd4518 button: deprecate the inner-border style property
Since we allocate the standard CSS border to the button now, and center
the child accordingly, there's no need for an additional inner-border
style property. Deprecate it and ignore its values.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Cosimo Cecchi
0021ef19fa button: add CSS borders to the size request
And allocate the button children according to it as well.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Cosimo Cecchi
fe59c5f954 button: add a border param to gtk_button_get_props()
We'll use it later to compute the child offsets.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Javier Jardón
9635759548 tests/testgtk.c: Remove death code 2011-12-20 17:51:59 +00:00
Ryan Lortie
bac58abec3 gtkmodelmenuitem: don't crash on missing action 2011-12-20 10:51:58 -05:00
Daniel Mustieles
8f5e8b2d0b Updated Spanish translation 2011-12-20 14:45:14 +01:00
Cosimo Cecchi
13f5706488 treeview: fix an uninitialised variable warning 2011-12-20 11:41:46 +01:00
Matthias Clasen
e65a8d0d40 Bump version 2011-12-19 18:41:10 -05:00
556 changed files with 76535 additions and 39582 deletions

View File

@@ -63,10 +63,6 @@ gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc gdk-waylan
rm -f $@ && \
cp gdk-3.0.pc $@
gtk+-*-3.0-uninstalled.pc: gtk+-3.0-uninstalled.pc
rm -f $@ && \
cp gtk+-3.0-uninstalled.pc $@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gdk-3.0.pc gtk+-3.0.pc gail-3.0.pc
@@ -84,8 +80,6 @@ DISTCLEANFILES = \
gdk-3.0.pc \
gdk-x11-3.0.pc \
gail-3.0.pc \
gtk+-3.0-uninstalled.pc \
gail-3.0-uninstalled.pc \
config.lt
distclean-local:

View File

@@ -10,7 +10,7 @@ TEST_PROGS =
### testing rules
# Xvfb based test rules
XVFB = Xvfb -ac -noreset -screen 0 800x600x16
XVFB = Xvfb -ac -noreset -screen 0 1024x768x16
XIDS = 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 \
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 \
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 \
@@ -29,7 +29,7 @@ endif
XVFB_START = \
${XVFB} -help 2>/dev/null 1>&2 \
&& XID=`for id in $(XIDS) ; do test -e /tmp/.X$$id-lock || { echo $$id; exit 0; }; done; exit 1` \
&& { ${XVFB} :$$XID -screen 0 800x600x16 -nolisten tcp -auth /dev/null >/dev/null 2>&1 & \
&& { ${XVFB} :$$XID -nolisten tcp -auth /dev/null >/dev/null 2>&1 & \
trap "kill -15 $$! " 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } \
|| { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } \
&& DISPLAY=:$$XID && export DISPLAY

143
NEWS
View File

@@ -1,3 +1,146 @@
Overview of Changes in GTK+ 3.3.14
==================================
* Theming
- Fixes for border handling in GtkEntry,
GtkCellRendererText, GtkComboBox
- Parse values more carefully, supporting
percentages, angles
- Implement CSS linear-gradient syntax
- Support background-size
- Support a gtk.gresource file in themes
* Bugs fixed
543520 Cups custom options are not sent properly
649121 Crash in GtkAppChooserDialog packagekit button
669176 Regression: atk-add-key-event-listener doesn't work
* Updated translations
Galician
Norwegian bokmål
Spanish
Overview of Changes in GTK+ 3.3.10
==================================
* GtkApplication:
- Move application menu handling over from GIO
- Fix resize grip positioning in GtkApplicationWindow
* Wayland:
- Make combo boxes work
- Make key modifiers work like on X11
- Make mouse buttons work correctly
* Quartz:
- Make key modifiers work more like they do on X11
* Printing:
- Fix handling of custom cups options
* Accessibility:
- Bring key snooping support back for now
* Translation updates:
Spanish
Overview of Changes in GTK+ 3.3.8
=================================
* GtkApplication:
- Supports logout notification and inhibiting
- Buttons, toolbuttons and switches can now be connected
to GActions
* GtkSpinButton no longer allows to change the value
when not editable
* GtkLabel link support has been rewritten to be be
more robust
* GtkBuilder:
- Supports the 'id' in GtkComboBoxText
- Can parse GVariant-valued properties
- Support loading from a GResource
* GtkImage:
- Support loading from a GResource
* GtkUIManager:
- Support loading from a GResource
* Accessibility:
- key snooping support has been removed
* Wayland backend:
- Cursor handling updates
- Look for cursors in the 'weston' directory
- Make resize grips work
- Implement device grabs
- Implement window geometry hints
- Set surface type based on window type hint
- Add basic clipboard and selection implementations
- Implement client-side keyboard repeat
- Update GdkWindow focus state to match reality
* Theming:
- Improved CSS compliance for selector matching
- Improved CSS compliance for value resolution,
including full support for 'inherit', 'initial',
'currentColor', 'none'
- Support border-style properties
- 'window-unfocused' has been renamed to 'backdrop'
* New deprecations:
- GdkColor
- GtkButton::inner-border
* Miscellaneous:
- Turn default theme css files and dnd cursors into
GResources
* Bugs fixed:
543520 Cups custom options are not sent properly
612396 ...default of entry-text-column for GtkComboBoxText
613728 Rationalize GtkTreeView focus
620240 GNOME Drag & Drop broken for remote X sessions
629878 Missing "Back" and "Forward" icons for Firefox
631414 Add symbolic constants for event emission control
639875 crashes when unparenting a tab from a window...
657367 GtkAction: Hold a reference to proxy widgets
659516 gtk_css_provider_to_string lacks "since" tag
660139 GtkGrid gives Gtk-Warnings about negative sizes when empty
660309 check x11 backend when create xim module
663479 "Finishing" ("Completion") and "Advanced" tabs are empty
665015 "Widget (%s) has more than one label" unwanted warnings
666103 Should be able to match the parent where a dropdown menu...
666600 allocate the CSS border and deprecate GtkButton-inner-border
666685 SIGSEGV in _gtk_tree_selection_internal_select_node
666710 Fix compose sequences disabling other sequences
666842 [patch] "sticky" window state reported wrongly on X11
667018 Fix compilation on Windows
667229 gtkspinbutton: Respect value of inherited 'editable' property
667394 Gtk(Tool)Button: add an 'action-name' property
667473 gdk_rgba_free (NULL)
667485 gdk_rgba_parse error checking
667534 Non-XInput2 build fix
667546 GApplication doc mentions g_application_set_app_menu
667628 GtkWindow:application property should have G_PARAM_CONSTRUCT
667695 GAction leaked in examples/plugman.c
667705 fix up GtkApplication on OS X
666921 Fix the _NET_SUPPORTING_WM_CHECK window fetch to be spec...
* Translation updates:
Arabic
Bulgarian
Finnish
Hebrew
Norwegian bokmål
Spanish
Overview of Changes in GTK+ 3.3.6
=================================

View File

@@ -27,6 +27,11 @@ Installation
See the file 'INSTALL'
Release notes for 3.4
=====================
* The -uninstalled variants of the pkg-config files have been dropped.
Release notes for 3.2
=====================

View File

@@ -565,7 +565,9 @@ mkdir $(CopyDir)\share\glib-2.0\schemas
copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas
echo "Compiling gsettings XML File(s)..."
copy ..\..\..\gtk\org.gtk.WindowState.gschema.xml $(CopyDir)\share\glib-2.0\schemas
echo "Compiling gsettings XML Files..."
$(CopyDir)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas

View File

@@ -69,7 +69,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;G_ENABLE_DEBUG;$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -91,7 +91,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
@@ -114,7 +114,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;G_ENABLE_DEBUG;$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -136,7 +136,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>

View File

@@ -202,6 +202,7 @@
<ClCompile Include="..\..\..\demos\gtk-demo\textscroll.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\textview.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\toolpalette.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\transparent.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\tree_store.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\ui_manager.c" />
</ItemGroup>

View File

@@ -125,6 +125,9 @@
<ClCompile Include="..\..\..\demos\gtk-demo\toolpalette.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\demos\gtk-demo\transparent.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\demos\gtk-demo\tree_store.c">
<Filter>Source Files</Filter>
</ClCompile>

View File

@@ -339,7 +339,8 @@ copy $(ConfigurationName)\$(PlatformName)\bin\gailutil.lib $(OutDir)\lib&#x0D;&#
mkdir $(OutDir)\share\glib-2.0\schemas&#x0D;&#x0A;
copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(OutDir)\share\glib-2.0\schemas&#x0D;&#x0A;
echo &quot;Compiling gsettings XML File(s)...&quot;&#x0D;&#x0A;
copy ..\..\..\gtk\org.gtk.WindowState.gschema.xml $(OutDir)\share\glib-2.0\schemas&#x0D;&#x0A;
echo &quot;Compiling gsettings XML Files...&quot;&#x0D;&#x0A;
$(OutDir)\bin\glib-compile-schemas.exe $(OutDir)\share\glib-2.0\schemas&#x0D;&#x0A;
"
/>

View File

@@ -31,7 +31,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gtk"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
PreprocessorDefinitions="_DEBUG;G_ENABLE_DEBUG;$(GtkDefines)"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -63,7 +63,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
PreprocessorDefinitions="$(GtkDefines)"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
@@ -96,7 +96,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
PreprocessorDefinitions="_DEBUG;G_ENABLE_DEBUG;$(GtkDefines)"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -128,7 +128,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
PreprocessorDefinitions="$(GtkDefines)"
RuntimeLibrary="2"
UsePrecompiledHeader="0"

View File

@@ -198,6 +198,7 @@
<File RelativePath="..\..\..\demos\gtk-demo\textscroll.c" />
<File RelativePath="..\..\..\demos\gtk-demo\textview.c" />
<File RelativePath="..\..\..\demos\gtk-demo\toolpalette.c" />
<File RelativePath="..\..\..\demos\gtk-demo\transparent.c" />
<File RelativePath="..\..\..\demos\gtk-demo\tree_store.c" />
<File RelativePath="..\..\..\demos\gtk-demo\ui_manager.c" />
</Filter>

View File

@@ -10,7 +10,7 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [3])
m4_define([gtk_micro_version], [6])
m4_define([gtk_micro_version], [15])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
@@ -39,11 +39,11 @@ AC_CONFIG_AUX_DIR([build-aux])
m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_version], [2.31.6])
m4_define([glib_required_version], [2.31.14])
m4_define([pango_required_version], [1.29.0])
m4_define([atk_required_version], [2.1.5])
m4_define([cairo_required_version], [1.10.0])
m4_define([gdk_pixbuf_required_version], [2.23.5])
m4_define([gdk_pixbuf_required_version], [2.25.2])
m4_define([introspection_required_version], [0.10.1])
GLIB_REQUIRED_VERSION=glib_required_version
PANGO_REQUIRED_VERSION=pango_required_version
@@ -935,7 +935,7 @@ if test "x$enable_x11_backend" = xyes; then
have_base_x_pc=true
X_PACKAGES="$X_PACKAGES x11 xext"
x_libs="`$PKG_CONFIG --libs x11 xext`"
X_CFLAGS="`$PKG_CONFIG --cflags x11 xext`"
X_CFLAGS="`$PKG_CONFIG --cflags x11 xext` -DXINPUT2_1_USE_UNSTABLE_PROTOCOL -DXINPUT2_2_USE_UNSTABLE_PROTOCOL"
# Strip out any .la files that pkg-config might give us (this happens
# with -uninstalled.pc files)
@@ -1126,6 +1126,10 @@ if test "x$enable_x11_backend" = xyes; then
AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]),
X_EXTENSIONS="$X_EXTENSIONS XInput")
gtk_save_LIBS="$LIBS"
LIBS="$LIBS -lXi"
AC_CHECK_FUNC(XIAllowTouchEvents, AC_DEFINE(XINPUT_2_2, 1, [Define to 1 if XInput 2.2 is available]))
LIBS="$gtk_save_LIBS"
else
AC_DEFINE(XINPUT_NONE, 1,
[Define to 1 if no XInput should be used])
@@ -1529,6 +1533,13 @@ fi
GLIB_GSETTINGS
#############
# Resources #
#############
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
AC_SUBST(GLIB_COMPILE_RESOURCES)
##################################################
# GObject introspection
##################################################
@@ -1734,8 +1745,6 @@ gdk-3.0.pc
gtk+-3.0.pc
gtk+-unix-print-3.0.pc
gail-3.0.pc
gtk+-3.0-uninstalled.pc
gail-3.0-uninstalled.pc
m4macros/Makefile
po/Makefile.in
po-properties/Makefile.in
@@ -1743,12 +1752,14 @@ demos/Makefile
demos/gtk-demo/Makefile
demos/gtk-demo/geninclude.pl
demos/pixbuf-demo/Makefile
demos/widget-factory/Makefile
examples/Makefile
tests/Makefile
tests/a11y/Makefile
tests/css/Makefile
tests/css/parser/Makefile
tests/reftests/Makefile
tests/visuals/Makefile
docs/Makefile
docs/reference/Makefile
docs/reference/gdk/Makefile

18
debian/README.debian vendored
View File

@@ -1,18 +0,0 @@
libgtk1 for Debian
----------------------
The GIMP Tool Kit (gtk) is a set of widgets to help you program
programs for the X Windowing System easily and powerfully.
gtk is the moving force behind The GNU Image Manipulation Program (The
GIMP) -- the number one freely-available image editing and creation
program available.
gtk is rapidly under development, and the source tree has officially
been separated from The GIMP now, as other teams of programmers
are beginning to write software using its great widget set -- like
GNOME, a desktop interface for X, and gzilla, a freely available
web browser for X.
Ben Gertzfield <che@debian.org>, Mon, 29 Sep 1997 13:11:45 -0700

62
debian/build vendored
View File

@@ -1,62 +0,0 @@
#!/usr/bin/perl -w
# Adjust debian/changelog and build a new
# Debian package of a CVS archive.
# Written 17 November 1998 by Ben Gertzfield
# <che@debian.org>
# This work is released under the GNU
# General Public License, version 2 or
# later.
use strict;
use diagnostics;
use File::Copy;
my $maintainer = 'Ben Gertzfield <che@debian.org>';
my @date = localtime;
my $datestr = sprintf("%d%.2d%.2d", $date[5] + 1900, $date[4] + 1, $date[3]);
my $revision = '01';
open (CHANGELOG, 'debian/changelog') or die "Couldn't open debian/changelog: $!\n";
$_ = <CHANGELOG>;
chomp;
close CHANGELOG;
my ($package, $last_date, $last_revision) = /^(.*?) \((.*?)\.(.*)?\)/;
if ($last_date eq $datestr) {
$revision = sprintf("%.2d", $last_revision + 1);
}
my $new_version = "$datestr.$revision";
copy('debian/changelog', 'debian/changelog.old') or die "Couldn't copy debian/changelog to debian/changelog.old: $!\n";
open(NEWCHANGELOG, ">debian/changelog") or die "Couldn't open debian/changelog for writing: $!\n";
print NEWCHANGELOG "$package ($new_version) unstable; urgency=low\n\n * CVS snapshot build at " . scalar localtime() . "\n\n -- $maintainer " . `date -R` . "\n";
open(OLDCHANGELOG, "debian/changelog.old") or die "Couldn't open debian/changelog.old: $!\n";
while (<OLDCHANGELOG>) {
print NEWCHANGELOG;
}
close OLDCHANGELOG;
close NEWCHANGELOG;
unlink('debian/changelog.old') or die "Couldn't unlink debian/changelog.old: $!\n";
open(NEWVERSION, '>debian/version') or die "Couldn't open debian/version for writing: $!\n";
print NEWVERSION "$new_version\n";
close NEWVERSION;
system('dpkg-buildpackage -b -rfakeroot -us -uc');
unlink 'debian/version' or die "Couldn't unlink debian/version: $!\n";

10
debian/changelog vendored
View File

@@ -1,10 +0,0 @@
gtk+-cvs (19981116.01) unstable; urgency=low
* First test build from CVS
-- Ben Gertzfield <che@debian.org> Tue, 17 Nov 1998 12:02:13 -0800
Local variables:
mode: debian-changelog
add-log-mailing-address: "che@debian.org"
End:

81
debian/control vendored
View File

@@ -1,81 +0,0 @@
Source: gtk+-cvs
Priority: extra
Section: libs
Maintainer: Ben Gertzfield <che@debian.org>
Standards-Version: 2.4.0.0
Package: libgtk-cvs-1.1
Architecture: any
Section: libs
Depends: ${shlibs:Depends}
Conflicts: libgtk-dev (<< 1:1.0.2), libgtk1.1
Description: CVS build of the GIMP Toolkit set of widgets for X
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
.
The GIMP Toolkit is a freely available set of widgets for X.
GTK is easy to use, and has been implemented in such projects as
The GNU Image Manipulation Program (The GIMP), GNOME, a GNU
desktop set of utilities for X, and gzilla, a GNU web-browser.
.
This is the unstable 1.1 branch of GTK. It is not intended for use
with stable projects!
Package: libgtk-cvs-dev
Architecture: any
Section: devel
Depends: libgtk-cvs-1.1 (=${Source-Version}), libglib-cvs-dev
Suggests: libgtk-cvs-doc
Provides: libgtk1.1-dev
Replaces: libgtk1.1-dev
Conflicts: libgtk-dev, libgtk1 (<< 1:1.0.4), libgtk1.1-dev
Description: CVS build of development files for the GIMP Toolkit
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
.
This package contains the header files and static libraries for the
GIMP Toolkit set of widgets for X.
.
This is the unstable, 1.1 branch of GTK+. This is not intended for
use with stable releases of programs!
.
Install this package if you wish to develop your own X programs using
the GIMP Toolkit 1.1, or if you wish to compile your own plug-ins for
The GIMP.
Package: libgtk-cvs-doc
Architecture: all
Section: doc
Conflicts: libgtk-dev (<< 1:0.99.4), libgtk-doc, libgtk1.1-doc
Description: CVS build of documentation for the GIMP Toolkit
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
.
This package contains lots of info-files, HTML docs, FAQs, and
other handy documentation about the GIMP Toolkit set of widgets
for X.
.
This package documents the unstable 1.1 release of the GIMP Toolkit.
.
Install this package if you want to have lots of info about the
GIMP toolkit when you're programming.
Package: libgtk-cvs-dbg
Architecture: any
Section: devel
Depends: libgtk-cvs-1.1 (= ${Source-Version}), libgtk-cvs-dev (= ${Source-Version})
Suggests: libgtk-cvs-doc
Conflicts: libgtk1.1-dbg
Description: CVS build of debugging files for the GIMP Toolkit
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
.
This package contains the debugging static libraries for the
GIMP Toolkit set of widgets for X.
.
This is the unstable, 1.1 branch of GTK+. This is not intended for
use with stable releases of programs!
.
Install this package if you wish to debug your own X programs using
the GIMP Toolkit 1.1, or if you wish to debug your own plug-ins for
The GIMP.

8
debian/copyright vendored
View File

@@ -1,8 +0,0 @@
This package was debianized by Ben Gertzfield <che@debian.org> on
Tue, 17 Nov 1998 12:07:17 -0800
It was produced from the CVS repository at cvs.gimp.org.
It may be redistributed under the terms of the GNU LGPL, Version 2 or
later, found on Debian systems in the file /usr/doc/copyright/LGPL.

View File

@@ -1,9 +0,0 @@
usr/lib/libgdk.so
usr/lib/libgdk.a
usr/lib/libgtk.so
usr/lib/libgtk.a
usr/include/gdk/
usr/include/gtk/
usr/bin/gtk-config
usr/man/man1/gtk-config.1
usr/share/aclocal/gtk.m4

View File

@@ -1,5 +0,0 @@
#!/bin/sh
set -e
#DEBHELPER#

View File

@@ -1,6 +0,0 @@
#!/bin/sh
set -e
install-info --quiet --remove gtk
#DEBHELPER#

View File

@@ -1,8 +0,0 @@
usr/info/gdk.info
usr/info/gtk.info
usr/info/gtk.info-1
usr/info/gtk.info-2
usr/info/gtk.info-3
usr/info/gtk.info-4
usr/info/gtk.info-5

View File

@@ -1,11 +0,0 @@
#!/bin/sh
set -e
install-info --quiet --description="The GIMP Toolkit." \
--section "The GIMP" "The GIMP" /usr/info/gtk.info.gz
install-info --quiet --description="The GIMP Drawing Kit." \
--section "The GIMP" "The GIMP" /usr/info/gdk.info.gz
#DEBHELPER#

View File

@@ -1,7 +0,0 @@
#!/bin/sh
set -e
install-info --quiet --remove gtk
install-info --quiet --remove gdk
#DEBHELPER#

7
debian/postinst vendored
View File

@@ -1,7 +0,0 @@
#!/bin/sh
set -e
ldconfig
#DEBHELPER#

160
debian/rules vendored
View File

@@ -1,160 +0,0 @@
#!/usr/bin/make -f
# debian/rules file for gtk+ Debian package
# written April 1998 by Ben Gertzfield <che@debian.org
build: build-stamp
build-stamp:
dh_testdir
./autogen.sh --prefix=/usr --with-xinput=xfree
$(MAKE)
cd docs && make distdocs
cd ..
touch build-stamp
build-dbg: build-dbg-stamp
build-dbg-stamp:
dh_testdir
./configure --prefix=/usr --with-xinput=xfree --enable-debug=yes
$(MAKE)
touch build-dbg-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp build-dbg-stamp install-stamp install-dbg-stamp
# Add here commands to clean up after the build process.
-$(MAKE) clean
cd docs
-$(MAKE) maintainer-clean
cd ..
-$(MAKE) distclean
find . -name '*.o' -o -name '_libs' -o -name '*.lo' -o -name '*.a' -o -name '.deps' | xargs rm -rf
dh_clean
clean-dbg:
dh_testdir
dh_testroot
rm -f build-stamp build-dbg-stamp install-stamp install-dbg-stamp
# Add here commands to clean up after the build process.
-$(MAKE) clean
cd docs
-$(MAKE) maintainer-clean
cd ..
-$(MAKE) distclean
find . -name '*.o' -o -name '_libs' -o -name '*.lo' -o -name '*.a' -o -name '.deps' | xargs rm -rf
dh_clean -k
install: install-stamp
install-stamp: build
dh_testdir
dh_testroot
dh_clean
$(MAKE) prefix=`pwd`/debian/tmp/usr install
touch install-stamp
install-dbg: install-dbg-stamp
install-dbg-stamp: build-dbg
dh_testdir
dh_testroot
dh_clean -k
$(MAKE) prefix=`pwd`/debian/libgtk-cvs-dbg/usr install
touch install-dbg-stamp
# Build architecture-independent files here.
binary-indep: build install libgtk-cvs-doc
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install libgtk-cvs-dev libgtk-cvs-1.1 libgtk-cvs-dbg
libgtk-cvs-1.1: build
dh_testdir -plibgtk-cvs-1.1
dh_testroot -plibgtk-cvs-1.1
dh_installdirs -plibgtk-cvs-1.1
# Add here commands to install the files into debian/tmp
rm -rf debian/tmp/usr/bin debian/tmp/usr/include debian/tmp/usr/info debian/tmp/usr/lib/glib debian/tmp/usr/share/aclocal debian/tmp/usr/man debian/tmp/usr/lib/*.la
dh_installdocs -plibgtk-cvs-1.1
dh_installchangelogs -plibgtk-cvs-1.1
dh_strip -plibgtk-cvs-1.1
dh_compress -plibgtk-cvs-1.1
dh_fixperms -plibgtk-cvs-1.1
dh_installdeb -plibgtk-cvs-1.1
dh_shlibdeps -plibgtk-cvs-1.1
dh_gencontrol -plibgtk-cvs-1.1
dh_makeshlibs -plibgtk-cvs-1.1 -V 'libgtk-cvs-1.1 (='`cat debian/version`')'
dh_md5sums -plibgtk-cvs-1.1
dh_builddeb -plibgtk-cvs-1.1
libgtk-cvs-dev: build
dh_testdir -plibgtk-cvs-dev
dh_testroot -plibgtk-cvs-dev
dh_clean -plibgtk-cvs-dev -k
dh_installdirs -plibgtk-cvs-dev
# Add here commands to install the files into debian/tmp
dh_movefiles -plibgtk-cvs-dev
cp gtk-config debian/tmp/usr/bin
dh_installdocs -plibgtk-cvs-dev
dh_installchangelogs -plibgtk-cvs-dev
dh_strip -plibgtk-cvs-dev
dh_compress -plibgtk-cvs-dev
dh_fixperms -plibgtk-cvs-dev
dh_installdeb -plibgtk-cvs-dev
dh_shlibdeps -plibgtk-cvs-dev
dh_gencontrol -plibgtk-cvs-dev
dh_md5sums -plibgtk-cvs-dev
dh_builddeb -plibgtk-cvs-dev
libgtk-cvs-doc:
dh_testdir -plibgtk-cvs-doc
dh_testroot -plibgtk-cvs-doc
dh_clean -plibgtk-cvs-doc -k
dh_installdirs -plibgtk-cvs-doc usr/doc/libgtk-cvs-doc/faq-html \
usr/doc/libgtk-cvs-doc/tutorial-html usr/doc/libgtk-cvs-doc/italian-tutorial-html usr/doc/libgtk-cvs-doc/french-tutorial-html usr/doc/libgtk-cvs-doc/gdk-html
dh_movefiles -plibgtk-cvs-doc
cp docs/html/gtkfaq*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/faq-html
cp docs/html/gtk_tut-*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/tutorial-html
cp docs/html/*.gif debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/tutorial-html
cp docs/html/gtk_tut.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/tutorial-html
cp docs/html/gtk_tut_it*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/italian-tutorial-html
cp docs/html/*.gif debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/italian-tutorial-html
cp docs/html/gtk_tut_fr*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/french-tutorial-html
cp docs/html/*.gif debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/french-tutorial-html
cp docs/html/gdk* debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/gdk-html
cp docs/text/*.txt debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/
dh_installdocs -plibgtk-cvs-doc docs/{debugging,developers,styles,text_widget,widget_system,gtk-config,refcounting}.txt TODO NEWS
dh_installchangelogs -plibgtk-cvs-doc
dh_strip -plibgtk-cvs-doc
dh_compress -plibgtk-cvs-doc
dh_fixperms -plibgtk-cvs-doc
dh_installdeb -plibgtk-cvs-doc
dh_shlibdeps -plibgtk-cvs-doc
dh_gencontrol -plibgtk-cvs-doc
dh_md5sums -plibgtk-cvs-doc
dh_builddeb -plibgtk-cvs-doc
libgtk-cvs-dbg: clean-dbg install-dbg
dh_testdir -plibgtk-cvs-dbg
dh_testroot -plibgtk-cvs-dbg
dh_installdirs -plibgtk-cvs-dbg
# Add here commands to install the files into debian/libgtk-cvs-dbg
rm -rf debian/libgtk-cvs-dbg/usr/bin debian/libgtk-cvs-dbg/usr/include debian/libgtk-cvs-dbg/usr/info debian/libgtk-cvs-dbg/usr/lib/glib debian/libgtk-cvs-dbg/usr/man debian/libgtk-cvs-dbg/usr/share debian/libgtk-cvs-dbg/usr/lib/*.{la,so*}
for file in `find debian/libgtk-cvs-dbg/usr/lib -name '*.a'` ; do \
mv $$file debian/libgtk-cvs-dbg/usr/lib/`basename $$file .a`_g.a; \
done
dh_installdocs -plibgtk-cvs-dbg
dh_installchangelogs -plibgtk-cvs-dbg
dh_compress -plibgtk-cvs-dbg
dh_fixperms -plibgtk-cvs-dbg
dh_installdeb -plibgtk-cvs-dbg
dh_shlibdeps -plibgtk-cvs-dbg
dh_gencontrol -plibgtk-cvs-dbg
dh_md5sums -plibgtk-cvs-dbg
dh_builddeb -plibgtk-cvs-dbg
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary

View File

@@ -1,6 +1,6 @@
## Makefile.am for gtk+/demos
include $(top_srcdir)/Makefile.decl
SUBDIRS = gtk-demo pixbuf-demo
SUBDIRS = gtk-demo widget-factory pixbuf-demo
-include $(top_srcdir)/git.mk

View File

@@ -6,6 +6,7 @@ democodedir=$(datadir)/gtk-$(GTK_API_VERSION)/demo
## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename
demos = \
application.c \
appwindow.c \
assistant.c \
builder.c \
@@ -28,6 +29,7 @@ demos = \
links.c \
list_store.c \
menus.c \
multitouch.c \
offscreen_window.c \
offscreen_window2.c \
overlay.c \
@@ -65,13 +67,24 @@ LDADDS = \
$(GTK_DEP_LIBS) \
-lm
bin_PROGRAMS = gtk3-demo
bin_PROGRAMS = gtk3-demo gtk3-demo-application
BUILT_SOURCES = demos.h
BUILT_SOURCES = demos.h application_resources.c
EXTRA_DIST += \
$(IMAGEFILES) \
demo.ui
EXTRA_DIST += \
$(IMAGEFILES) \
demo.ui \
application.gresource.xml \
application.ui \
menus.ui \
gtk-logo-24.png \
gtk-logo-48.png \
org.gtk.Demo.gschema.xml
gsettings_SCHEMAS = \
org.gtk.Demo.gschema.xml
@GSETTINGS_RULES@
demos.h: @REBUILD@ $(demos) geninclude.pl
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
@@ -86,8 +99,17 @@ gtk3_demo_DEPENDENCIES = $(DEPS)
gtk3_demo_LDADD = $(LDADDS)
gtk3_demo_LDFLAGS = -export-dynamic
gtk3_demo_application_SOURCES = \
application-standalone.c \
application_resources.c
gtk3_demo_application_LDADD = $(LDADDS)
application_resources.c: application.gresource.xml gtk-logo-24.png gtk-logo-48.png application.ui menus.ui
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $(srcdir)/application.gresource.xml
IMAGEFILES= alphatest.png \
apple-red.png \
apple-red.png \
background.jpg \
floppybuddy.gif \
gnome-applets.png \

View File

@@ -0,0 +1,3 @@
#define STANDALONE
#include "application.c"

View File

@@ -0,0 +1,479 @@
/* Application class
*
* Demonstrates a simple application.
*
* This examples uses GtkApplication, GtkApplicationWindow, GtkBuilder
* as well as GMenu and GResource. Due to the way GtkApplication is structured,
* it is run as a separate process.
*/
#include "config.h"
#include <gtk/gtk.h>
#ifdef STANDALONE
static void
show_action_dialog (GSimpleAction *action)
{
const gchar *name;
GtkWidget *dialog;
name = g_action_get_name (G_ACTION (action));
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"You activated action: \"%s\"",
name);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
}
static void
show_action_infobar (GSimpleAction *action,
GVariant *parameter,
gpointer window)
{
GtkWidget *infobar;
GtkWidget *message;
gchar *text;
const gchar *name;
const gchar *value;
name = g_action_get_name (G_ACTION (action));
value = g_variant_get_string (parameter, NULL);
message = g_object_get_data (G_OBJECT (window), "message");
infobar = g_object_get_data (G_OBJECT (window), "infobar");
text = g_strdup_printf ("You activated radio action: \"%s\".\n"
"Current value: %s", name, value);
gtk_label_set_text (GTK_LABEL (message), text);
gtk_widget_show (infobar);
g_free (text);
}
static void
activate_action (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
show_action_dialog (action);
}
static void
activate_toggle (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GVariant *state;
show_action_dialog (action);
state = g_action_get_state (G_ACTION (action));
g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
g_variant_unref (state);
}
static void
activate_radio (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
show_action_infobar (action, parameter, user_data);
g_action_change_state (G_ACTION (action), parameter);
}
static void
activate_about (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkWidget *window = user_data;
GdkPixbuf *pixbuf;
const gchar *authors[] = {
"Peter Mattis",
"Spencer Kimball",
"Josh MacDonald",
"and many more...",
NULL
};
const gchar *documentors[] = {
"Owen Taylor",
"Tony Gale",
"Matthias Clasen <mclasen@redhat.com>",
"and many more...",
NULL
};
pixbuf = gdk_pixbuf_new_from_resource ("/logos/gtk-logo-48.png", NULL);
gtk_show_about_dialog (GTK_WINDOW (window),
"program-name", "GTK+ Code Demos",
"version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
PACKAGE_VERSION,
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ()),
"copyright", "(C) 1997-2009 The GTK+ Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK+ functions.",
"authors", authors,
"documenters", documentors,
"logo", pixbuf,
"title", "About GTK+ Code Demos",
NULL);
g_object_unref (pixbuf);
}
static void
activate_quit (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkApplication *app = user_data;
GtkWidget *win;
GList *list, *next;
list = gtk_application_get_windows (app);
while (list)
{
win = list->data;
next = list->next;
gtk_widget_destroy (GTK_WIDGET (win));
list = next;
}
}
static void
register_stock_icons (void)
{
static gboolean registered = FALSE;
if (!registered)
{
GdkPixbuf *pixbuf;
GtkIconFactory *factory;
GtkIconSet *icon_set;
static GtkStockItem items[] = {
{ "demo-gtk-logo", "_GTK!", 0, 0, NULL }
};
registered = TRUE;
gtk_stock_add (items, G_N_ELEMENTS (items));
factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (factory);
pixbuf = gdk_pixbuf_new_from_resource ("/logos/gtk-logo-24.png", NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
gtk_icon_set_unref (icon_set);
g_object_unref (pixbuf);
/* Drop our reference to the factory, GTK will hold a reference. */
g_object_unref (factory);
}
}
static void
update_statusbar (GtkTextBuffer *buffer,
GtkStatusbar *statusbar)
{
gchar *msg;
gint row, col;
gint count;
GtkTextIter iter;
/* clear any previous message, underflow is allowed */
gtk_statusbar_pop (statusbar, 0);
count = gtk_text_buffer_get_char_count (buffer);
gtk_text_buffer_get_iter_at_mark (buffer,
&iter,
gtk_text_buffer_get_insert (buffer));
row = gtk_text_iter_get_line (&iter);
col = gtk_text_iter_get_line_offset (&iter);
msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
row, col, count);
gtk_statusbar_push (statusbar, 0, msg);
g_free (msg);
}
static void
mark_set_callback (GtkTextBuffer *buffer,
const GtkTextIter *new_location,
GtkTextMark *mark,
gpointer data)
{
update_statusbar (buffer, GTK_STATUSBAR (data));
}
static void
change_theme_state (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GtkSettings *settings = gtk_settings_get_default ();
g_object_set (G_OBJECT (settings),
"gtk-application-prefer-dark-theme",
g_variant_get_boolean (state),
NULL);
g_simple_action_set_state (action, state);
}
static void
change_titlebar_state (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GtkWindow *window = user_data;
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window),
g_variant_get_boolean (state));
g_simple_action_set_state (action, state);
}
static void
change_radio_state (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
g_simple_action_set_state (action, state);
}
static GActionEntry app_entries[] = {
{ "new", activate_action, NULL, NULL, NULL },
{ "open", activate_action, NULL, NULL, NULL },
{ "save", activate_action, NULL, NULL, NULL },
{ "save-as", activate_action, NULL, NULL, NULL },
{ "quit", activate_quit, NULL, NULL, NULL },
{ "dark", activate_toggle, NULL, "false", change_theme_state }
};
static GActionEntry win_entries[] = {
{ "titlebar", activate_toggle, NULL, "false", change_titlebar_state },
{ "shape", activate_radio, "s", "'oval'", change_radio_state },
{ "bold", activate_toggle, NULL, "false", NULL },
{ "about", activate_about, NULL, NULL, NULL },
{ "file1", activate_action, NULL, NULL, NULL },
{ "logo", activate_action, NULL, NULL, NULL }
};
static void
clicked_cb (GtkWidget *widget, GtkWidget *info)
{
gtk_widget_hide (info);
}
static void
startup (GApplication *app)
{
GtkBuilder *builder;
GMenuModel *appmenu;
GMenuModel *menubar;
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/ui/menus.ui", NULL);
appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");
menubar = (GMenuModel *)gtk_builder_get_object (builder, "menubar");
gtk_application_set_app_menu (GTK_APPLICATION (app), appmenu);
gtk_application_set_menubar (GTK_APPLICATION (app), menubar);
g_object_unref (builder);
}
static void
activate (GApplication *app)
{
GtkBuilder *builder;
GtkWidget *window;
GtkWidget *grid;
GtkWidget *contents;
GtkWidget *status;
GtkWidget *message;
GtkWidget *button;
GtkWidget *infobar;
GtkWidget *menutool;
GMenuModel *toolmenu;
GtkTextBuffer *buffer;
window = gtk_application_window_new (GTK_APPLICATION (app));
gtk_window_set_title (GTK_WINDOW (window), "Application Class");
gtk_window_set_icon_name (GTK_WINDOW (window), "document-open");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
g_action_map_add_action_entries (G_ACTION_MAP (window),
win_entries, G_N_ELEMENTS (win_entries),
window);
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/ui/application.ui", NULL);
grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
contents = (GtkWidget *)gtk_builder_get_object (builder, "contents");
status = (GtkWidget *)gtk_builder_get_object (builder, "status");
message = (GtkWidget *)gtk_builder_get_object (builder, "message");
button = (GtkWidget *)gtk_builder_get_object (builder, "button");
infobar = (GtkWidget *)gtk_builder_get_object (builder, "infobar");
menutool = (GtkWidget *)gtk_builder_get_object (builder, "menutool");
toolmenu = (GMenuModel *)gtk_builder_get_object (builder, "toolmenu");
g_object_set_data (G_OBJECT (window), "message", message);
g_object_set_data (G_OBJECT (window), "infobar", infobar);
gtk_container_add (GTK_CONTAINER (window), grid);
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (menutool),
gtk_menu_new_from_model (toolmenu));
gtk_widget_grab_focus (contents);
g_signal_connect (button, "clicked", G_CALLBACK (clicked_cb), infobar);
/* Show text widget info in the statusbar */
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
g_signal_connect_object (buffer, "changed",
G_CALLBACK (update_statusbar), status, 0);
g_signal_connect_object (buffer, "mark-set",
G_CALLBACK (mark_set_callback), status, 0);
update_statusbar (buffer, GTK_STATUSBAR (status));
gtk_widget_show_all (window);
g_object_unref (builder);
}
int
main (int argc, char *argv[])
{
GtkApplication *app;
GSettings *settings;
GAction *action;
gtk_init (NULL, NULL);
register_stock_icons ();
app = gtk_application_new ("org.gtk.Demo", 0);
settings = g_settings_new ("org.gtk.Demo");
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries, G_N_ELEMENTS (app_entries),
app);
action = g_settings_create_action (settings, "color");
g_action_map_add_action (G_ACTION_MAP (app), action);
g_signal_connect (app, "startup", G_CALLBACK (startup), NULL);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
g_application_run (G_APPLICATION (app), 0, NULL);
return 0;
}
#else /* !STANDALONE */
static gboolean name_seen;
static GtkWidget *placeholder;
static void
on_name_appeared (GDBusConnection *connection,
const gchar *name,
const gchar *name_owner,
gpointer user_data)
{
name_seen = TRUE;
}
static void
on_name_vanished (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
if (!name_seen)
return;
if (placeholder)
{
gtk_widget_destroy (placeholder);
g_object_unref (placeholder);
placeholder = NULL;
}
}
GtkWidget *
do_application (GtkWidget *toplevel)
{
static guint watch = 0;
if (watch == 0)
watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
"org.gtk.Demo",
0,
on_name_appeared,
on_name_vanished,
NULL, NULL);
if (placeholder == NULL)
{
const gchar *command;
GError *error = NULL;
if (g_file_test ("./gtk3-demo-application", G_FILE_TEST_IS_EXECUTABLE))
command = "./gtk3-demo-application";
else
command = "gtk3-demo-application";
if (!g_spawn_command_line_async (command, &error))
{
g_warning ("%s", error->message);
g_error_free (error);
}
placeholder = gtk_label_new ("");
g_object_ref_sink (placeholder);
}
else
{
g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
"org.gtk.Demo",
"/org/gtk/Demo",
"org.gtk.Actions",
"Activate",
g_variant_new ("(sava{sv})", "quit", NULL, NULL),
NULL,
0,
G_MAXINT,
NULL, NULL);
}
return placeholder;
}
#endif

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/logos">
<file preprocess="to-pixdata">gtk-logo-24.png</file>
<file preprocess="to-pixdata">gtk-logo-48.png</file>
</gresource>
<gresource prefix="/ui">
<file preprocess="xml-stripblanks">application.ui</file>
<file preprocess="xml-stripblanks">menus.ui</file>
</gresource>
</gresources>

View File

@@ -0,0 +1,104 @@
<?xml version="1.0"?>
<interface>
<object class="GtkGrid" id="grid">
<child>
<object class="GtkToolbar" id="toolbar">
<property name="orientation">horizontal</property>
<property name="halign">fill</property>
<property name="hexpand">True</property>
<child>
<object class="GtkMenuToolButton" id="menutool">
<property name="stock-id">gtk-open</property>
</object>
</child>
<child>
<object class="GtkToolButton" id="quit">
<property name="stock-id">gtk-quit</property>
<property name="action-name">app.quit</property>
</object>
</child>
<child>
<object class="GtkSeparatorToolItem" id="sep"/>
</child>
<child>
<object class="GtkToolButton" id="logo">
<property name="stock-id">demo-gtk-logo</property>
<property name="action-name">win.logo</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="no-show-all">True</property>
<property name="halign">fill</property>
<property name="hexpand">True</property>
<child internal-child="content_area">
<object class="GtkBox" id="content_area">
<child>
<object class="GtkLabel" id="message">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="halign">fill</property>
</object>
</child>
</object>
</child>
<child internal-child="action_area">
<object class="GtkBox" id="action_area">
<child>
<object class="GtkButton" id="button">
<property name="visible">True</property>
<property name="valign">center</property>
<property name="label">gtk-ok</property>
<property name="use-stock">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="sw">
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView" id="contents">
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkStatusbar" id="status">
<property name="halign">fill</property>
<property name="hexpand">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
</object>
<menu id="toolmenu">
<item>
<attribute name="label">File1</attribute>
<attribute name="action">win.file1</attribute>
</item>
</menu>
</interface>

View File

@@ -1,6 +1,8 @@
/* Application main window
/* Application window
*
* Demonstrates a typical application window with menubar, toolbar, statusbar.
*
* This example uses GtkUIManager and GtkActionGroup.
*/
#include <gtk/gtk.h>

View File

@@ -23,14 +23,14 @@ apply_changes_gradually (gpointer data)
if (fraction < 1.0)
{
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), fraction);
return TRUE;
return G_SOURCE_CONTINUE;
}
else
{
/* Close automatically once changes are fully applied. */
gtk_widget_destroy (assistant);
assistant = NULL;
return FALSE;
return G_SOURCE_REMOVE;
}
}

View File

@@ -172,7 +172,7 @@ button_press (GtkWidget *widget,
GtkWidget *menu;
GtkWidget *item;
if (button->button != 3)
if (button->button != GDK_BUTTON_SECONDARY)
return FALSE;
menu = gtk_menu_new ();

View File

@@ -36,26 +36,17 @@ change_color_callback (GtkWidget *button,
{
GtkWidget *dialog;
GtkColorSelection *colorsel;
GtkColorSelectionDialog *selection_dialog;
GtkColorChooserDialog *selection_dialog;
gint response;
dialog = gtk_color_selection_dialog_new ("Changing color");
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
selection_dialog = GTK_COLOR_SELECTION_DIALOG (dialog);
colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (selection_dialog));
gtk_color_selection_set_previous_rgba (colorsel, &color);
gtk_color_selection_set_current_rgba (colorsel, &color);
gtk_color_selection_set_has_palette (colorsel, TRUE);
dialog = gtk_color_chooser_dialog_new ("Changing color", GTK_WINDOW (window));
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &color);
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response == GTK_RESPONSE_OK)
{
gtk_color_selection_get_current_rgba (colorsel, &color);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog), &color);
gtk_widget_override_background_color (da, 0, &color);
}

View File

@@ -97,7 +97,7 @@ scribble_button_press_event (GtkWidget *widget,
if (surface == NULL)
return FALSE; /* paranoia check, in case we haven't gotten a configure event */
if (event->button == 1)
if (event->button == GDK_BUTTON_PRIMARY)
draw_brush (widget, event->x, event->y);
/* We've handled the event, stop processing */

View File

@@ -116,7 +116,7 @@ if (defined @child_arrays) {
}
# toplevel
print "\nDemo testgtk_demos[] = {\n";
print "\nDemo gtk_demos[] = {\n";
$first = 1;
foreach $href (@demos) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -144,7 +144,7 @@ event_after (GtkWidget *text_view,
event = (GdkEventButton *)ev;
if (event->button != 1)
if (event->button != GDK_BUTTON_PRIMARY)
return FALSE;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));

View File

@@ -63,7 +63,13 @@ do_links (GtkWidget *do_widget)
label = gtk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\""
"title=\"plain text\">text</a> may be marked up\n"
"as hyperlinks, which can be clicked\n"
"or activated via <a href=\"keynav\">keynav</a>");
"or activated via <a href=\"keynav\">keynav</a>\n"
"and they work fine with other markup, like when\n"
"searching on <a href=\"http://www.google.com/\">"
"<span color=\"#0266C8\">G</span><span color=\"#F90101\">o</span>"
"<span color=\"#F2B50F\">o</span><span color=\"#0266C8\">g</span>"
"<span color=\"#00933B\">l</span><span color=\"#F90101\">e</span>"
"</a>.");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL);
gtk_container_add (GTK_CONTAINER (window), label);

View File

@@ -60,7 +60,7 @@ spinner_timeout (gpointer data)
guint pulse;
if (model == NULL)
return FALSE;
return G_SOURCE_REMOVE;
gtk_tree_model_get_iter_first (model, &iter);
gtk_tree_model_get (model, &iter,
@@ -77,7 +77,7 @@ spinner_timeout (gpointer data)
COLUMN_ACTIVE, TRUE,
-1);
return TRUE;
return G_SOURCE_CONTINUE;
}
static GtkTreeModel *

View File

@@ -782,7 +782,7 @@ create_tree (void)
GtkTreeIter iter;
GtkWidget *box, *label, *scrolled_window;
Demo *d = testgtk_demos;
Demo *d = gtk_demos;
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INT);
tree_view = gtk_tree_view_new ();
@@ -936,10 +936,8 @@ main (int argc, char **argv)
* these few lines, which are just a hack so gtk-demo will work
* in the GTK tree without installing it.
*/
if (g_file_test ("../../gdk-pixbuf/libpixbufloader-pnm.la",
G_FILE_TEST_EXISTS))
if (g_file_test ("../../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
{
g_setenv ("GDK_PIXBUF_MODULE_FILE", "../../gdk-pixbuf/loaders.cache", TRUE);
g_setenv ("GTK_IM_MODULE_FILE", "../../modules/input/immodules.cache", TRUE);
}
/* -- End of hack -- */
@@ -1002,7 +1000,7 @@ main (int argc, char **argv)
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
gtk_widget_show_all (window);
load_file (testgtk_demos[0].filename);
load_file (gtk_demos[0].filename);
gtk_main ();

107
demos/gtk-demo/menus.ui Normal file
View File

@@ -0,0 +1,107 @@
<?xml version="1.0"?>
<interface>
<menu id="appmenu">
<section>
<item>
<attribute name="label" translatable="yes">_New</attribute>
<attribute name="action">app.new</attribute>
<attribute name="accel">&lt;Primary&gt;n</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Open</attribute>
<attribute name="action">app.open</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Save</attribute>
<attribute name="action">app.save</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save _As...</attribute>
<attribute name="action">app.save-as</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
<menu id="menubar">
<submenu>
<attribute name="label" translatable="yes">_Preferences</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
<attribute name="action">app.dark</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Hide Titlebar when maximized</attribute>
<attribute name="action">win.titlebar</attribute>
</item>
<submenu>
<attribute name="label" translatable="yes">_Color</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Red</attribute>
<attribute name="action">app.color</attribute>
<attribute name="target">red</attribute>
<attribute name="accel">&lt;Primary&gt;r</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Green</attribute>
<attribute name="action">app.color</attribute>
<attribute name="target">green</attribute>
<attribute name="accel">&lt;Primary&gt;g</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Blue</attribute>
<attribute name="action">app.color</attribute>
<attribute name="target">blue</attribute>
<attribute name="accel">&lt;Primary&gt;b</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Shape</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Square</attribute>
<attribute name="action">win.shape</attribute>
<attribute name="target">square</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Rectangle</attribute>
<attribute name="action">win.shape</attribute>
<attribute name="target">rectangle</attribute>
<attribute name="accel">&lt;Primary&gt;r</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Oval</attribute>
<attribute name="action">win.shape</attribute>
<attribute name="target">oval</attribute>
<attribute name="accel">&lt;Primary&gt;o</attribute>
</item>
</section>
</submenu>
<item>
<attribute name="label" translatable="yes">_Bold</attribute>
<attribute name="action">win.bold</attribute>
<attribute name="accel">&lt;Primary&gt;b</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Help</attribute>
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">win.about</attribute>
<attribute name="accel">&lt;Primary&gt;a</attribute>
</item>
</submenu>
</menu>
</interface>

698
demos/gtk-demo/multitouch.c Normal file
View File

@@ -0,0 +1,698 @@
/* Multitouch
*
* Demonstrates some general multitouch event handling,
* using GdkTouchCluster in order to get grouped motion
* events for the touches within a cluster. Each of the
* created rectangles has one of those GdkTouchCluster
* objects.
*
* Touch events are also enabled on additional widgets,
* enabling simultaneous touch interaction on those. Not
* all widgets are prepared for multitouch interaction,
* as there are constraints that not all widgets may
* apply to.
*/
#include <math.h>
#include <gtk/gtk.h>
#include "demo-common.h"
#define RECT_BORDER_WIDTH 6
static GtkWidget *window = NULL;
static GtkWidget *area = NULL;
static GtkWidget *red = NULL;
static GtkWidget *green = NULL;
static GtkWidget *blue = NULL;
static GtkWidget *alpha = NULL;
static GQueue *shapes = NULL;
typedef struct {
GdkTouchCluster *cluster;
GdkRGBA color;
gdouble angle;
gdouble zoom;
gdouble center_x;
gdouble center_y;
gdouble x;
gdouble y;
gdouble width;
gdouble height;
gdouble base_zoom;
gdouble base_angle;
gdouble initial_distance;
gdouble initial_angle;
GdkPoint points[4];
} ShapeInfo;
static void
calculate_rotated_point (gdouble angle,
gdouble zoom,
gdouble center_x,
gdouble center_y,
gdouble point_x,
gdouble point_y,
gdouble *ret_x,
gdouble *ret_y)
{
gdouble distance, xd, yd, ang;
if (angle == 0)
{
*ret_x = point_x;
*ret_y = point_y;
return;
}
xd = center_x - point_x;
yd = center_y - point_y;
if (xd == 0 && yd == 0)
{
*ret_x = center_x;
*ret_y = center_y;
return;
}
distance = sqrt ((xd * xd) + (yd * yd));
distance *= zoom;
ang = atan2 (xd, yd);
/* Invert angle */
ang = (2 * G_PI) - ang;
/* Shift it 270° */
ang += 3 * (G_PI / 2);
/* And constraint it to 0°-360° */
ang = fmod (ang, 2 * G_PI);
ang += angle;
*ret_x = center_x + (distance * cos (ang));
*ret_y = center_y + (distance * sin (ang));
}
static void
shape_info_allocate_input_rect (ShapeInfo *info)
{
gint width, height, i;
width = info->width;
height = info->height;
/* Top/left */
info->points[0].x = info->x - info->center_x;
info->points[0].y = info->y - info->center_y;
/* Top/right */
info->points[1].x = info->x - info->center_x + width;
info->points[1].y = info->y - info->center_y;
/* Bottom/right */
info->points[2].x = info->x - info->center_x + width;
info->points[2].y = info->y - info->center_y + height;
/* Bottom/left */
info->points[3].x = info->x - info->center_x;
info->points[3].y = info->y - info->center_y + height;
for (i = 0; i < 4; i++)
{
gdouble ret_x, ret_y;
calculate_rotated_point (info->angle,
info->zoom,
info->x,
info->y,
(gdouble) info->points[i].x,
(gdouble) info->points[i].y,
&ret_x,
&ret_y);
info->points[i].x = (gint) ret_x;
info->points[i].y = (gint) ret_y;
}
}
static void
shape_info_bounding_rect (ShapeInfo *info,
GdkRectangle *rect)
{
gint i, left, right, top, bottom;
left = top = G_MAXINT;
right = bottom = 0;
for (i = 0; i < 4; i++)
{
if (info->points[i].x < left)
left = info->points[i].x;
if (info->points[i].x > right)
right = info->points[i].x;
if (info->points[i].y < top)
top = info->points[i].y;
if (info->points[i].y > bottom)
bottom = info->points[i].y;
}
rect->x = left - 20;
rect->y = top - 20;
rect->width = right - left + 40;
rect->height = bottom - top + 40;
}
static gboolean
shape_info_point_in (ShapeInfo *info,
gint x,
gint y)
{
GdkPoint *left, *right, *top, *bottom;
gint i;
left = right = top = bottom = NULL;
for (i = 0; i < 4; i++)
{
GdkPoint *p = &info->points[i];
if (!left ||
p->x < left->x ||
(p->x == left->x && p->y > left->y))
left = p;
if (!right ||
p->x > right->x ||
(p->x == right->x && p->y < right->y))
right = p;
}
for (i = 0; i < 4; i++)
{
GdkPoint *p = &info->points[i];
if (p == left || p == right)
continue;
if (!top ||
p->y < top->y)
top = p;
if (!bottom ||
p->y > bottom->y)
bottom = p;
}
g_assert (left && right && top && bottom);
if (x < left->x ||
x > right->x ||
y < top->y ||
y > bottom->y)
return FALSE;
/* Check whether point is above the sides
* between leftmost and topmost, and
* topmost and rightmost corners.
*/
if (x <= top->x)
{
if (left->y - ((left->y - top->y) * (((gdouble) x - left->x) / (top->x - left->x))) > y)
return FALSE;
}
else
{
if (top->y + ((right->y - top->y) * (((gdouble) x - top->x) / (right->x - top->x))) > y)
return FALSE;
}
/* Check whether point is below the sides
* between leftmost and bottom, and
* bottom and rightmost corners.
*/
if (x <= bottom->x)
{
if (left->y + ((bottom->y - left->y) * (((gdouble) x - left->x) / (bottom->x - left->x))) < y)
return FALSE;
}
else
{
if (bottom->y - ((bottom->y - right->y) * (((gdouble) x - bottom->x) / (right->x - bottom->x))) < y)
return FALSE;
}
return TRUE;
}
static ShapeInfo *
shape_info_new (gdouble x,
gdouble y,
gdouble width,
gdouble height,
GdkRGBA *color)
{
ShapeInfo *info;
info = g_slice_new0 (ShapeInfo);
info->cluster = NULL;
info->color = *color;
info->x = x;
info->y = y;
info->width = width;
info->height = height;
info->angle = 0;
info->zoom = 1;
info->base_zoom = 1;
info->base_angle = 0;
info->initial_distance = 0;
info->initial_angle = 0;
shape_info_allocate_input_rect (info);
g_queue_push_tail (shapes, info);
return info;
}
static void
shape_info_free (ShapeInfo *info)
{
g_slice_free (ShapeInfo, info);
}
static void
shape_info_draw (cairo_t *cr,
ShapeInfo *info)
{
cairo_save (cr);
cairo_translate (cr,
info->points[0].x + RECT_BORDER_WIDTH / 2,
info->points[0].y + RECT_BORDER_WIDTH / 2);
cairo_scale (cr, info->zoom, info->zoom);
cairo_rotate (cr, info->angle);
cairo_rectangle (cr, 0, 0,
info->width - RECT_BORDER_WIDTH,
info->height - RECT_BORDER_WIDTH);
gdk_cairo_set_source_rgba (cr, &info->color);
cairo_fill_preserve (cr);
cairo_set_line_width (cr, RECT_BORDER_WIDTH);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_stroke (cr);
cairo_restore (cr);
}
static void
shape_update_scales (ShapeInfo *info)
{
gtk_range_set_value (GTK_RANGE (red), info->color.red);
gtk_range_set_value (GTK_RANGE (green), info->color.green);
gtk_range_set_value (GTK_RANGE (blue), info->color.blue);
gtk_range_set_value (GTK_RANGE (alpha), info->color.alpha);
}
static void
range_value_changed_cb (GtkRange *range,
gpointer user_data)
{
GtkWidget *widget;
GdkRectangle rect;
ShapeInfo *shape;
gdouble value;
widget = GTK_WIDGET (range);
shape = g_queue_peek_head (shapes);
if (!shape)
return;
value = gtk_range_get_value (range);
if (widget == red)
shape->color.red = value;
else if (widget == green)
shape->color.green = value;
else if (widget == blue)
shape->color.blue = value;
else if (widget == alpha)
shape->color.alpha = value;
shape_info_bounding_rect (shape, &rect);
gdk_window_invalidate_rect (gtk_widget_get_window (area),
&rect, FALSE);
}
static gboolean
draw_cb (GtkWidget *widget,
cairo_t *cr,
gpointer user_data)
{
GList *l;
cairo_save (cr);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
for (l = shapes->tail; l; l = l->prev)
shape_info_draw (cr, l->data);
cairo_restore (cr);
return FALSE;
}
static gboolean
button_press_cb (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
ShapeInfo *shape = NULL;
guint touch_id;
if (gdk_event_get_touch_id (event, &touch_id))
{
GList *l;
for (l = shapes->tail; l; l = l->prev)
{
ShapeInfo *info = l->data;
if (shape_info_point_in (info,
(gint) event->button.x,
(gint) event->button.y))
shape = info;
}
if (!shape)
return FALSE;
/* Put on top */
g_queue_remove (shapes, shape);
g_queue_push_head (shapes, shape);
shape_update_scales (shape);
if (!shape->cluster)
shape->cluster = gdk_window_create_touch_cluster (gtk_widget_get_window (widget),
gdk_event_get_device (event));
else if (gdk_touch_cluster_get_n_touches (shape->cluster) == 0)
{
/* Only change cluster device if there were no touches */
gdk_touch_cluster_set_device (shape->cluster,
gdk_event_get_device (event));
}
gdk_touch_cluster_add_touch (shape->cluster, touch_id);
return TRUE;
}
return FALSE;
}
static gboolean
multitouch_cb (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
ShapeInfo *info = NULL;
gboolean new_center = FALSE;
gboolean new_position = FALSE;
gdouble event_x, event_y;
cairo_region_t *region;
GdkRectangle rect;
GList *l;
for (l = shapes->head; l; l = l->next)
{
ShapeInfo *shape = l->data;
if (event->multitouch.group == shape->cluster)
{
info = shape;
break;
}
}
if (!info)
return FALSE;
shape_info_bounding_rect (info, &rect);
region = cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rect);
if (event->multitouch.n_events == 1)
{
/* Update center if we just got to
* this situation from either way */
if (event->type == GDK_MULTITOUCH_ADDED ||
event->type == GDK_MULTITOUCH_REMOVED)
new_center = TRUE;
event_x = event->multitouch.events[0]->x;
event_y = event->multitouch.events[0]->y;
new_position = TRUE;
}
else if (event->multitouch.n_events == 2)
{
gdouble distance, angle;
gdk_events_get_center ((GdkEvent *) event->multitouch.events[0],
(GdkEvent *) event->multitouch.events[1],
&event_x, &event_y);
gdk_events_get_distance ((GdkEvent *) event->multitouch.events[0],
(GdkEvent *) event->multitouch.events[1],
&distance);
gdk_events_get_angle ((GdkEvent *) event->multitouch.events[0],
(GdkEvent *) event->multitouch.events[1],
&angle);
if (event->type == GDK_MULTITOUCH_ADDED)
{
/* Second touch was just added, update base zoom/angle */
info->base_zoom = info->zoom;
info->base_angle = info->angle;
info->initial_angle = angle;
info->initial_distance = distance;
new_center = TRUE;
}
info->zoom = MAX (info->base_zoom * (distance / info->initial_distance), 1.0);
info->angle = info->base_angle + (angle - info->initial_angle);
new_position = TRUE;
}
if (new_center)
{
gdouble origin_x, origin_y;
origin_x = info->x - info->center_x;
origin_y = info->y - info->center_y;
calculate_rotated_point (- info->angle,
1 / info->zoom,
info->x - origin_x,
info->y - origin_y,
event_x - origin_x,
event_y - origin_y,
&info->center_x,
&info->center_y);
}
if (new_position)
{
info->x = event_x;
info->y = event_y;
}
shape_info_allocate_input_rect (info);
shape_info_bounding_rect (info, &rect);
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rect);
gdk_window_invalidate_region (gtk_widget_get_window (widget), region, FALSE);
return TRUE;
}
static void
window_destroyed_cb (GtkWidget *widget,
gpointer user_data)
{
g_queue_foreach (shapes, (GFunc) shape_info_free, NULL);
g_queue_free (shapes);
shapes = NULL;
window = NULL;
}
static void
new_rectangle_clicked_cb (GtkButton *button,
gpointer user_data)
{
GdkRectangle rect;
ShapeInfo *info;
GdkRGBA color;
color.red = color.green = color.blue = color.alpha = 0.5;
info = shape_info_new (0, 0, 100, 150, &color);
shape_info_bounding_rect (info, &rect);
gdk_window_invalidate_rect (gtk_widget_get_window (area), &rect, FALSE);
}
GtkWidget *
create_drawing_area (void)
{
area = gtk_drawing_area_new ();
gtk_widget_add_events (area,
GDK_TOUCH_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK);
gtk_widget_set_size_request (area, 600, 600);
g_signal_connect (area, "draw",
G_CALLBACK (draw_cb), NULL);
g_signal_connect (area, "button-press-event",
G_CALLBACK (button_press_cb), NULL);
g_signal_connect (area, "multitouch-event",
G_CALLBACK (multitouch_cb), NULL);
return area;
}
GtkWidget *
create_scale (void)
{
GtkWidget *scale;
scale = gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL, 0, 1, 0.01);
gtk_range_set_inverted (GTK_RANGE (scale), TRUE);
gtk_widget_set_vexpand (scale, TRUE);
gtk_widget_set_margin_left (scale, 15);
gtk_widget_set_margin_right (scale, 15);
gtk_widget_add_events (scale, GDK_TOUCH_MASK);
g_signal_connect (scale, "value-changed",
G_CALLBACK (range_value_changed_cb), NULL);
return scale;
}
GtkWidget *
create_window (void)
{
GtkWidget *grid, *label, *button;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Multitouch demo");
g_signal_connect (window, "destroy",
G_CALLBACK (window_destroyed_cb), NULL);
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
area = create_drawing_area ();
gtk_grid_attach (GTK_GRID (grid),
area, 0, 0, 1, 3);
gtk_widget_set_hexpand (area, TRUE);
gtk_widget_set_vexpand (area, TRUE);
/* "red" label/scale */
label = gtk_label_new ("Red");
gtk_widget_set_vexpand (label, FALSE);
gtk_grid_attach (GTK_GRID (grid),
label, 1, 0, 1, 1);
red = create_scale ();
gtk_grid_attach (GTK_GRID (grid),
red, 1, 1, 1, 1);
/* "green" label/scale */
label = gtk_label_new ("Green");
gtk_widget_set_vexpand (label, FALSE);
gtk_grid_attach (GTK_GRID (grid),
label, 2, 0, 1, 1);
green = create_scale ();
gtk_grid_attach (GTK_GRID (grid),
green, 2, 1, 1, 1);
/* "blue" label/scale */
label = gtk_label_new ("Blue");
gtk_widget_set_vexpand (label, FALSE);
gtk_grid_attach (GTK_GRID (grid),
label, 3, 0, 1, 1);
blue = create_scale ();
gtk_grid_attach (GTK_GRID (grid),
blue, 3, 1, 1, 1);
/* "alpha" label/scale */
label = gtk_label_new ("Alpha");
gtk_widget_set_vexpand (label, FALSE);
gtk_grid_attach (GTK_GRID (grid),
label, 4, 0, 1, 1);
alpha = create_scale ();
gtk_grid_attach (GTK_GRID (grid),
alpha, 4, 1, 1, 1);
/* button */
button = gtk_button_new_from_stock (GTK_STOCK_NEW);
gtk_widget_add_events (button, GDK_TOUCH_MASK);
gtk_grid_attach (GTK_GRID (grid),
button, 1, 2, 4, 1);
gtk_widget_set_vexpand (button, FALSE);
g_signal_connect (button, "clicked",
G_CALLBACK (new_rectangle_clicked_cb), NULL);
gtk_widget_show_all (grid);
return window;
}
GtkWidget *
do_multitouch (GtkWidget *do_widget)
{
if (!shapes)
shapes = g_queue_new ();
if (!window)
window = create_window ();
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
{
gtk_widget_destroy (window);
window = NULL;
g_queue_foreach (shapes, (GFunc) shape_info_free, NULL);
g_queue_free (shapes);
shapes = NULL;
}
return window;
}

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<enum id='org.gtk.Demo.Color'>
<value nick='red' value='0'/>
<value nick='green' value='1'/>
<value nick='blue' value='2'/>
</enum>
<schema id='org.gtk.Demo' path='/org/gtk/Demo/'>
<key name='color' enum='org.gtk.Demo.Color'>
<default>'red'</default>
</key>
</schema>
</schemalist>

View File

@@ -180,7 +180,7 @@ timeout (gpointer data)
GDK_THREADS_LEAVE ();
frame_num++;
return TRUE;
return G_SOURCE_CONTINUE;
}
static guint timeout_id;

View File

@@ -29,8 +29,7 @@ static gboolean
search_progress (gpointer data)
{
gtk_entry_progress_pulse (GTK_ENTRY (data));
return TRUE;
return G_SOURCE_CONTINUE;
}
static void

View File

@@ -49,7 +49,7 @@ scroll_to_end (GtkTextView *textview)
if (count > 150)
count = 0;
return TRUE;
return G_SOURCE_CONTINUE;
}
/* Scroll to the bottom of the buffer.
@@ -100,7 +100,7 @@ scroll_to_bottom (GtkTextView *textview)
if (count > 40)
count = 0;
return TRUE;
return G_SOURCE_CONTINUE;
}
static guint

View File

@@ -350,7 +350,7 @@ interactive_canvas_real_drag_leave (gpointer data)
gtk_widget_queue_draw (widget);
}
return FALSE;
return G_SOURCE_REMOVE;
}
static void

View File

@@ -0,0 +1,31 @@
include $(top_srcdir)/Makefile.decl
bin_PROGRAMS = gtk3-widget-factory
gtk3_widget_factory_SOURCES = \
widget-factory.c \
widget_factory_resources.c
BUILT_SOURCES = \
widget_factory_resources.c
gtk3_widget_factory_DEPENDENCIES = \
$(top_builddir)/gtk/libgtk-3.la
gtk3_widget_factory_CPPFLAGS = \
-I$(top_srcdir) \
$(GTK_DEBUG_FLAGS) \
$(GTK_DEP_CFLAGS)
gtk3_widget_factory_LDADD = \
$(top_builddir)/gdk/libgdk-3.la \
$(top_builddir)/gtk/libgtk-3.la \
$(GTK_DEP_LIBS)
widget_factory_resources.c: widget-factory.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies $(srcdir)/widget-factory.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $<
EXTRA_DIST += \
widget-factory.ui \
widget-factory.gresource.xml \
gtk-logo-256.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -22,6 +22,7 @@
*
*/
#include "config.h"
#include <gtk/gtk.h>
static void
@@ -35,6 +36,37 @@ dark_toggled (GtkCheckMenuItem *item, gpointer data)
NULL);
}
static void
show_about (GtkMenuItem *item, GtkWidget *window)
{
GdkPixbuf *pixbuf;
const gchar *authors[] = {
"Andrea Cimitan",
"Cosimo Cecchi",
NULL
};
pixbuf = gdk_pixbuf_new_from_resource ("/logos/gtk-logo-256.png", NULL);
gtk_show_about_dialog (GTK_WINDOW (window),
"program-name", "GTK+ Widget Factory",
"version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
PACKAGE_VERSION,
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ()),
"copyright", "(C) 1997-2009 The GTK+ Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK+ themes and widgets",
"authors", authors,
"logo", pixbuf,
"title", "About GTK+ Widget Factory",
NULL);
g_object_unref (pixbuf);
}
int
main (int argc, char *argv[])
{
@@ -49,7 +81,7 @@ main (int argc, char *argv[])
dark = TRUE;
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, "./widget-factory.ui", NULL);
gtk_builder_add_from_resource (builder, "/ui/widget-factory.ui", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_builder_connect_signals (builder, NULL);
@@ -58,6 +90,9 @@ main (int argc, char *argv[])
g_signal_connect (widget, "toggled", G_CALLBACK (dark_toggled), NULL);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), dark);
widget = (GtkWidget*) gtk_builder_get_object (builder, "aboutmenuitem");
g_signal_connect (widget, "activate", G_CALLBACK (show_about), window);
g_object_unref (G_OBJECT (builder));
gtk_widget_show (window);

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/logos">
<file>gtk-logo-256.png</file>
</gresource>
<gresource prefix="/ui">
<file preprocess="xml-stripblanks">widget-factory.ui</file>
</gresource>
</gresources>

View File

@@ -54,6 +54,9 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<property name="title">GTK+ Widget Factory</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<signal name="delete-event" handler="gtk_false" swapped="no"/>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
@@ -129,6 +132,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="gtk_main_quit" swapped="no"/>
</object>
</child>
</object>
@@ -387,7 +391,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem10">
<object class="GtkImageMenuItem" id="aboutmenuitem">
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -524,10 +528,14 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry">
<property name="can_focus">False</property>
<property name="text" translatable="yes">comboboxentry</property>
</object>
</child>
<items>
<item>Donald Duck</item>
<item>Mickey Mouse</item>
<item>Jet McQuack</item>
</items>
</object>
<packing>
<property name="expand">False</property>
@@ -630,6 +638,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<property name="sensitive">False</property>
</object>
<packing>
<property name="expand">False</property>

View File

@@ -33,6 +33,7 @@
<xi:include href="xml/windows.xml" />
<xi:include href="xml/events.xml" />
<xi:include href="xml/event_structs.xml" />
<xi:include href="xml/touchcluster.xml" />
<xi:include href="xml/keys.xml" />
<xi:include href="xml/selections.xml" />
<xi:include href="xml/dnd.xml" />

View File

@@ -757,6 +757,11 @@ GdkEventMask
GDK_CURRENT_TIME
GDK_PRIORITY_EVENTS
GDK_PRIORITY_REDRAW
GDK_EVENT_PROPAGATE
GDK_EVENT_STOP
GDK_BUTTON_PRIMARY
GDK_BUTTON_MIDDLE
GDK_BUTTON_SECONDARY
<SUBSECTION>
gdk_events_pending
@@ -776,11 +781,13 @@ gdk_event_get_root_coords
gdk_event_get_scroll_direction
gdk_event_get_state
gdk_event_get_time
gdk_event_get_touch_id
gdk_event_request_motions
gdk_events_get_angle
gdk_events_get_center
gdk_events_get_distance
gdk_event_triggers_context_menu
gdk_event_get_touch_id
<SUBSECTION>
gdk_event_handler_set
@@ -828,6 +835,7 @@ GdkEventWindowState
GdkEventSetting
GdkEventOwnerChange
GdkEventGrabBroken
GdkEventMultiTouch
<SUBSECTION>
GdkScrollDirection
@@ -855,6 +863,29 @@ gdk_event_get_type
gdk_owner_change_get_type
</SECTION>
<SECTION>
<TITLE>Multitouch</TITLE>
<FILE>touchcluster</FILE>
GdkTouchCluster
gdk_touch_cluster_add_touch
gdk_touch_cluster_remove_touch
gdk_touch_cluster_remove_all
gdk_touch_cluster_set_device
gdk_touch_cluster_get_device
gdk_touch_cluster_get_touches
<SUBSECTION>
gdk_window_create_touch_cluster
gdk_window_remove_touch_cluster
<SUBSECTION Standard>
GDK_TYPE_TOUCH_CLUSTER
<SUBSECTION Private>
gdk_touch_cluster_get_type
</SECTION>
<SECTION>
<TITLE>Cursors</TITLE>
<FILE>cursors</FILE>

View File

@@ -9,5 +9,6 @@ gdk_display_manager_get_type
gdk_drag_context_get_type
gdk_keymap_get_type
gdk_screen_get_type
gdk_touch_cluster_get_type
gdk_visual_get_type
gdk_window_get_type

View File

@@ -119,11 +119,13 @@ content_files = \
running.sgml \
building.sgml \
compiling.sgml \
device-interaction-patterns.xml \
drawing-model.xml \
glossary.xml \
migrating-2to3.xml \
migrating-checklist.sgml \
migrating-GtkApplication.xml \
migrating-unique-GtkApplication.xml \
migrating-smclient-GtkApplication.xml \
migrating-GtkGrid.xml \
migrating-GtkStyleContext.xml \
objects_grouped.sgml \
@@ -141,12 +143,14 @@ content_files = \
overview.xml
expand_content_files = \
device-interaction-patterns.xml \
drawing-model.xml \
getting_started.xml \
glossary.xml \
migrating-2to3.xml \
migrating-checklist.sgml \
migrating-GtkApplication.xml \
migrating-unique-GtkApplication.xml \
migrating-smclient-GtkApplication.xml \
migrating-GtkGrid.xml \
migrating-GtkStyleContext.xml \
question_index.sgml \
@@ -285,6 +289,7 @@ HTML_IMAGES = \
$(srcdir)/images/check-button.png \
$(srcdir)/images/color-button.png \
$(srcdir)/images/colorsel.png \
$(srcdir)/images/colorchooser.png \
$(srcdir)/images/combo-box.png \
$(srcdir)/images/combo-box-entry.png \
$(srcdir)/images/entry.png \
@@ -294,6 +299,7 @@ HTML_IMAGES = \
$(srcdir)/images/filechooser.png \
$(srcdir)/images/font-button.png \
$(srcdir)/images/fontsel.png \
$(srcdir)/images/fontchooser.png \
$(srcdir)/images/frame.png \
$(srcdir)/images/icon-view.png \
$(srcdir)/images/image.png \

View File

@@ -0,0 +1,578 @@
<?xml version="1.0"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="gtk-device-interaction-patterns">
<title>Multitouch and other device interaction patterns</title>
<para>
Depending on the platform, GTK+ is able to handle a wide range of input
devices. Those are offered to applications in a 2-level hierarchy, with
virtual devices (or master devices) representing the visual cursors
displayed in the screen, which are each controlled by a number of physical
devices (or slave devices). Those devices can respectively be retrieved
from an input event with gdk_event_get_device() and
gdk_event_get_source_device().
</para>
<para>
In X11, GTK+ uses XInput2 for input events, which caters for a fully dynamic
device hierarchy, and support for multiple virtual pointer/keyboard pairs.
</para>
<example>
<title>Listing and modifying the device hierarchy</title>
<programlisting>
carlos@sacarino:~$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Wacom ISDv4 E6 Pen stylus id=10 [slave pointer (2)]
⎜ ↳ Wacom ISDv4 E6 Finger touch id=11 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
⎜ ↳ TPPS/2 IBM TrackPoint id=14 [slave pointer (2)]
⎜ ↳ Wacom ISDv4 E6 Pen eraser id=16 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Integrated Camera id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
↳ ThinkPad Extra Buttons id=15 [slave keyboard (3)]
carlos@sacarino:~$ xinput create-master eek
carlos@sacarino:~$ xinput list
...
⎡ eek pointer id=17 [master pointer (18)]
⎜ ↳ eek XTEST pointer id=19 [slave pointer (17)]
⎣ eek keyboard id=18 [master keyboard (17)]
↳ eek XTEST keyboard id=20 [slave keyboard (18)]
carlos@sacarino:~$ xinput reattach 10 17
carlos@sacarino:~$ xinput list
...
⎡ eek pointer id=17 [master pointer (18)]
⎜ ↳ Wacom ISDv4 E6 Pen stylus id=10 [slave pointer (17)]
⎜ ↳ eek XTEST pointer id=19 [slave pointer (17)]
⎣ eek keyboard id=18 [master keyboard (17)]
↳ eek XTEST keyboard id=20 [slave keyboard (18)]
</programlisting>
</example>
<para>
Anytime a virtual device is added or removed, or a physical device
is attached to another virtual device, or left floating (detached
from any virtual device), #GdkDeviceManager will emit the corresponding
#GdkDeviceManager::device-added, #GdkDeviceManager::device-removed, or
#GdkDeviceManager::device-changed signals.
</para>
<section id="gtk-device-patterns-client-pointer">
<title>The client pointer</title>
<para>
In X11, Under the presence of multiple virtual pointers, GDK and XInput2
use the "client pointer" principle to allow several legacy applications
to interact simultaneously with different virtual pointer/keyboard pairs,
it would be usually set by the window manager for a focused window, so
different application windows could operate on different client pointers.
gdk_device_manager_get_client_pointer() may be called to get the client
pointer #GdkDevice
</para>
<para>
Under the hood, X11 uses the client pointer (or its paired keyboard) to
satisfy core calls such as XGrabPointer/Keyboard, XQueryPointer and
others that have been superseded by XInput2.
</para>
<para>
In platforms without multidevice features, gdk_device_manager_get_client_pointer()
will return the only virtual pointer available.
</para>
</section>
<section id="gtk-device-patterns-simple">
<title>Simple device handling</title>
<para>
There are applications that could have little gain in knowing about
multiple devices, although there are situations where a device could
be needed (i.e. popping up a menu on the pointer coordinates).
</para>
<para>
For such applications, the client pointer may be a good enough
approximation for these operations. Under the presence of multiple
device pairs, this gives a behavior that is most similar to that
of legacy applications (i.e. gtk+2).
</para>
<example>
<title>Getting the client pointer and keyboard</title>
<programlisting>
GdkDisplay *display;
GdkDeviceManager *device_manager;
GdkDevice *client_pointer, client_keyboard;
display = gdk_display_get_default ();
device_manager = gdk_display_get_device_manager (display);
client_pointer = gdk_device_manager_get_client_pointer (device_manager);
/* Or if we need a keyboard too */
client_keyboard = gdk_device_get_associated_device (client_pointer);
</programlisting>
</example>
</section>
<section id="gtk-device-patterns-multiple-devices">
<title>Dealing with multiple devices</title>
<para>
There may be several usecases to deal with multiple devices, including,
but not limited to:
</para>
<orderedlist>
<listitem>
Retrieving advanced information from an input device: i.e. stylus pressure/tilt
in drawing applications.
</listitem>
<listitem>
Receiving events from a dedicated input device: i.e. joysticks in games.
</listitem>
<listitem>
Collaborative interfaces, handling simultaneous input from multiple users.
</listitem>
</orderedlist>
<para>
However, the patterns to make them work are very similar.
</para>
<section>
<title>Event handling</title>
<para>
Each device will emit its own event stream, this means
that you will need to check the GdkEvent you get in
your event handlers
</para>
<example>
<title>Reacting differently to devices</title>
<programlisting>
static gboolean
my_widget_motion_notify (GtkWidget *widget,
GdkEventMotion *event)
{
GdkDevice *device, *source_device;
device = gdk_event_get_device ((GdkEvent *) event);
source_device = gdk_event_get_source_device ((GdkEvent *) event);
g_print ("Motion event by '%s', coming from HW device '%s'\n",
gdk_device_get_name (device),
gdk_device_get_name (source_device));
/* Handle touch devices differently */
if (gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
{
...
}
else
{
...
}
return TRUE;
}
</programlisting>
</example>
<para>
The mechanism above could also be used for fine grained event discarding
(i.e. so rubberband selection doesn't jump to another pointer entering
the widget for example)
</para>
<example>
<title>Reacting differently to devices</title>
<programlisting>
static gboolean
my_widget_button_press (Gtkwidget *widget,
GdkEventButton *event)
{
GET_PRIV(widget)->current_pointer = gdk_event_get_device ((GdkEvent *) event);
...
}
static gboolean
my_widget_button_release (Gtkwidget *widget,
GdkEventButton *event)
{
GET_PRIV(widget)->current_pointer = NULL;
...
}
static gboolean
my_widget_motion_notify (Gtkwidget *widget,
GdkEventMotion *event)
{
if (gdk_event_get_device (event) !=
GET_PRIV(widget)->current_pointer)
return FALSE;
...
}
</programlisting>
</example>
</section>
<section>
<title>Grabs</title>
<para>
Grabs are a mechanism to coerce a device into sending events to
a window, but with multidevice there's an other side of the coin,
how other devices are supposed to interact while the grab is in
effect.
</para>
<para>
The GdkGrabOwnership enum passed to gdk_device_grab() may be used
to block other devices' interaction. %GDK_OWNERSHIP_NONE applies
no restrictions, allowing other devices to interact, even with
the grab window. %GDK_OWNERSHIP_WINDOW blocks other devices from
interacting with the grab window, but they'll still be able to
interact with the rest of the application, whereas
%GDK_OWNERSHIP_APPLICATION will render the whole application
insensitive to input from other devices. Different devices may
have simultaneous grabs on the same or different windows.
</para>
<example>
<title>Grabbing as a result of an input event</title>
<programlisting>
gboolean
my_widget_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GdkDevice *pointer, *keyboard;
pointer = gdk_event_get_device ((GdkEvent *) event);
keyboard = gdk_device_get_associated_device (pointer);
/* Grab both keyboard/pointer, other devices will be
* unable to interact with the widget window meanwhile
*/
gdk_device_grab (pointer,
gtk_widget_get_window (widget),
GDK_OWNERSHIP_WINDOW,
...);
gdk_device_grab (keyboard,
gtk_widget_get_window (widget),
GDK_OWNERSHIP_WINDOW,
...);
return FALSE;
}
</programlisting>
</example>
<para>
For GTK+ grabs, there's only a boolean value, equivalent to
%GDK_OWNERSHIP_NONE and %GDK_OWNERSHIP_WINDOW, but the mechanism
is quite similar.
</para>
<para>
Once the device is grabbed, there may be different situations
that could break the grabs, so the widget needs to listen to
#GdkGrabBrokenEvent and the #GtkWidget::grab-notify signal to
handle these situations.
</para>
<example>
<title>Handling broken grabs</title>
<programlisting>
static gboolean
my_widget_grab_broken (GtkWidget *widget,
GdkEventGrabBroken *event)
{
MyWidgetPrivate *priv = GET_PRIV (widget);
if (gdk_event_get_device (event) == priv->grab_pointer)
{
/* Undo state */
...
priv->grab_pointer = NULL;
return TRUE;
}
return FALSE;
}
static void
my_widget_grab_notify (GtkWidget *widget,
gboolean was_grabbed)
{
MyWidgetPrivate *priv = GET_PRIV (widget);
if (gtk_widget_device_is_shadowed (widget, priv->grab_device))
{
/* Device was "shadowed" by another widget's grab,
* release and undo state
*/
...
priv->grab_pointer = NULL;
}
}
</programlisting>
</example>
</section>
<section>
<title>Handling multipointer</title>
<para>
Widgets do react by default to every virtual device, although
by default they are set in a compatibility mode that makes them
behave better with multiple pointers, without necessarily
being multipointer aware.
</para>
<para>
This compatibility mode most notably disables per-device
enter/leave events, so these are stacked, and the crossing
events are only emitted when the first pointer enters the
window, and after the last pointer leaves it. This behavior
is controlled through gtk_widget_set_support_multidevice()
</para>
</section>
<section>
<title>Reading device axis values</title>
<para>
Button and motion events provide further information about
the device axes' current state. Note the device axes are
hardware and driver dependent, therefore the set of axes
is not set in stone, although there are a few more common ones.
</para>
<example>
<title>Getting to know the axes provided by a device</title>
<programlisting>
carlos@sacarino:~$ xinput list "Wacom ISDv4 E6 Pen stylus" |grep "Label"
Label: Abs X
Label: Abs Y
Label: Abs Pressure
Label: Abs Tilt X
Label: Abs Tilt Y
Label: Abs Wheel
</programlisting>
</example>
<example>
<title>Getting an axis value</title>
<programlisting>
gboolean
my_widget_motion_notify (GtkWidget *widget,
GdkEventMotion *event)
{
GdkAtom *label_atom;
gdouble pressure;
label_atom = gdk_atom_intern_static_string ("Abs Pressure");
gdk_device_get_axis_value (gdk_event_get_device ((GdkEvent *) event),
event->axes, label_atom, &amp;pressure);
/* Do something with pressure */
...
return TRUE;
}
</programlisting>
</example>
<para>
All pointer devices report axes information, master and slave. to
achieve this, master pointers modify their list of axes at runtime
to reflect those of the currently routed slave, emitting
#GdkDevice::changed as the routed slave device changes.
</para>
</section>
<section>
<title>Dealing with slave (or floating) devices</title>
<para>
By default, GTK+ listens to all master devices, and typically
all slave devices will be attached to a master device. so
gdk_event_get_source_device() is the recommended way to deal
with the physical device triggering the event.
</para>
<para>
In more specialized setups, some devices could be floating
(i.e. tablets that don't route events through any virtual
pointer, but are expected to interact with drawing applications).
In that case, such specialized applications could want to interact
directly with the device. To do so, the device must be enabled,
and the widget wanting its events needs to add the event mask.
</para>
<example>
<title>Enabling events for a slave device</title>
<programlisting>
GdkDevice *device;
/* Gets the first device found with the given GdkInputSource */
device = get_device (gtk_widget_get_display (widget),
GDK_SOURCE_PEN);
gdk_device_set_mode (device, GDK_MODE_SCREEN);
gtk_widget_add_device_events (widget, device,
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK);
</programlisting>
</example>
<para>
After these calls, the widget would specifically receive events
from the physical device, regardless of it being floating or
connected to a master device. In this second case, and if you
want exclusive control of the device, you can temporarily detach
the stylus device from its master by doing a GDK grab on it.
</para>
<para>
For events coming directly from slave devices, both
gdk_event_get_device() and gdk_event_get_source_device() will
return the same device of type %GDK_DEVICE_TYPE_SLAVE or
%GDK_DEVICE_TYPE_FLOATING.
</para>
<note>
This is less useful than it used to be in GTK+2/XInput1, at least
for attached slaves, as there is gdk_event_get_source_device(),
and master devices' events provide axes information.
</note>
</section>
</section>
<section id="gtk-device-patterns-multitouch-widgets">
<title>Multitouch in GTK+ widgets</title>
<para>
Since version 3.4, GTK+ offers support for multitouch devices through a new
set of events and higher level tools like #GdkTouchCluster and
#GtkGesturesInterpreter.
</para>
<para>
If the widget does not have %GDK_TOUCH_MASK set in the event mask, it will
only be allowed to interact with the touch emulating pointer events, and will
only receive pointer events.
</para>
<para>
If the widget does have %GDK_TOUCH_MASK enabled, it will be able to receive
events of type %GDK_TOUCH_PRESS, %GDK_TOUCH_RELEASE and %GDK_TOUCH_MOTION,
which will be respectively emitted through the #GtkWidget::button-press-event,
#GtkWidget::button-release-event and #GtkWidget::motion-notify-event signals.
There may be multiple, simultaneous sequences of events, those will be
recognized and referenced by their touch ID. See gdk_event_get_touch_id().
</para>
<para>
#GtkWidget<!-- -->s may create GdkTouchCluster<!-- -->s via
gdk_window_create_touch_cluster(), those may be used to group
touch events together, which are notified through #GdkEventMultitouch,
this event will be emitted in #GtkWidget<!-- -->s through the
#GtkWidget::multitouch-event signal.
</para>
<para>
Widgets may also handle gestures being performed on them,
gtk_widget_enable_gesture() and gtk_widget_disable_gesture() are
provided as a simple API, although widgets may also create a
#GtkGesturesInterpreter and feed it events directly.
</para>
</section>
<section id="gtk-device-patterns-multitouch">
<title>Multitouch across a widget hierarchy</title>
<para>
Fully touch driven applications might not want to confine multitouch
operations within a single widget, but rather offer simultaneous
interaction with multiple widgets.
</para>
<para>
GTK+ is able to provide such experience, although it does not enable
%GDK_TOUCH_MASK by default on its stock widgets. If a widget meets the
following requirements, it is ready to be used in a multitouch UI:
</para>
<orderedlist>
<listitem>
The widget handles #GtkWidget::button-press-event, #GtkWidget::button-release-event
and #GtkWidget::motion-notify-event, and does something meaningful while the button 1
is pressed. If any explicit check on the event type being %GDK_BUTTON_PRESS,
%GDK_BUTTON_RELEASE or %GDK_MOTION_NOTIFY is performed, the event types
%GDK_TOUCH_PRESS, %GDK_TOUCH_RELEASE or %GDK_TOUCH_MOTION also need to be handled.
</listitem>
<listitem>
The widget relies on the implicit grab as long as the button press/touch is active,
GDK or GTK+ grabs would break the implicit grabs other touch sequences may have on
other widgets.
</listitem>
<listitem>
The widget does not require (or opts out) keyboard interaction while a touch is
active on it. Touch interaction does not necessarily bring the keyboard focus with it.
</listitem>
<listitem>
If the widget is only meant to interact with one touch sequence at a time (i.e.
buttons), it has to be able to discern and reject operations on any later touch
sequence as long as the touch it is interacting with remains active.
</listitem>
</orderedlist>
<para>
If a widget meets those requirements, enabling %GDK_TOUCH_MASK on it will suffice
to make it handle multitouch events in a way that doesn't disrupt other touch
operations.
</para>
<example>
<title>Enabling touch events on a widget</title>
<programlisting>
gtk_widget_add_events (widget, GDK_TOUCH_MASK);
</programlisting>
</example>
<note>
Not all GTK+ stock widgets are immediately suitable for handling touch
events, there could be even design reasons on some of those which render
them unsuitable.
</note>
</section>
<section id="gtk-device-patterns-recommendations">
<title>Recommendations</title>
<orderedlist>
<listitem>
Device operations often come up as a result of input events, favor
gdk_event_get_device() and gtk_get_current_event_device() before
gdk_device_manager_get_client_pointer().
</listitem>
<listitem>
Store the devices the widget is currently interacting with, handle
GdkEventGrabBroken and #GtkWidget::grab-notify to undo/nullify these.
</listitem>
</orderedlist>
</section>
</chapter>

View File

@@ -68,6 +68,12 @@
<xi:include href="xml/gtkstyle.xml" />
</part>
<part id="multitouch-and-multidevice">
<title>Interacting with input devices</title>
<xi:include href="xml/device-interaction-patterns.xml" />
<xi:include href="xml/gtkgesturesinterpreter.xml" />
</part>
<part id="gtkobjects">
<title>GTK+ Widgets and Objects</title>
@@ -209,18 +215,22 @@
<chapter id="SelectorWidgets">
<title>Selectors (Color/File/Font)</title>
<xi:include href="xml/gtkcolorchooser.xml" />
<xi:include href="xml/gtkcolorbutton.xml" />
<xi:include href="xml/gtkcolorseldlg.xml" />
<xi:include href="xml/gtkcolorchooserwidget.xml" />
<xi:include href="xml/gtkcolorchooserdialog.xml" />
<xi:include href="xml/gtkcolorsel.xml" />
<xi:include href="xml/gtkcolorseldlg.xml" />
<xi:include href="xml/gtkhsv.xml" />
<xi:include href="xml/gtkfilechooser.xml" />
<xi:include href="xml/gtkfilechooserbutton.xml" />
<xi:include href="xml/gtkfilechooserdialog.xml" />
<xi:include href="xml/gtkfilechooserwidget.xml" />
<xi:include href="xml/gtkfilefilter.xml" />
<xi:include href="xml/gtkfontbutton.xml" />
<xi:include href="xml/gtkfontchooser.xml" />
<xi:include href="xml/gtkfontchooserdlg.xml" />
<xi:include href="xml/gtkfontbutton.xml" />
<xi:include href="xml/gtkfontchooserwidget.xml" />
<xi:include href="xml/gtkfontchooserdialog.xml" />
<xi:include href="xml/gtkfontsel.xml" />
<xi:include href="xml/gtkfontseldlg.xml" />
</chapter>
@@ -339,6 +349,7 @@
<title>Application support</title>
<xi:include href="xml/gtkapplication.xml" />
<xi:include href="xml/gtkapplicationwindow.xml" />
<xi:include href="xml/gtkactionable.xml" />
</chapter>
</part>
@@ -355,11 +366,12 @@
</para>
</partintro>
<xi:include href="xml/migrating-checklist.sgml" />
<xi:include href="xml/migrating-2to3.xml" />
<xi:include href="xml/migrating-GtkStyleContext.xml" />
<xi:include href="xml/migrating-GtkApplication.xml" />
<xi:include href="xml/migrating-unique-GtkApplication.xml" />
<xi:include href="xml/migrating-smclient-GtkApplication.xml" />
<xi:include href="xml/migrating-GtkGrid.xml" />
<xi:include href="xml/migrating-checklist.sgml" />
</part>
<part>

View File

@@ -37,6 +37,7 @@ gtk_about_dialog_get_logo
gtk_about_dialog_set_logo
gtk_about_dialog_get_logo_icon_name
gtk_about_dialog_set_logo_icon_name
gtk_about_dialog_add_credit_section
gtk_show_about_dialog
<SUBSECTION Standard>
GTK_ABOUT_DIALOG
@@ -1534,7 +1535,7 @@ gtk_font_chooser_widget_get_type
</SECTION>
<SECTION>
<FILE>gtkfontchooserdlg</FILE>
<FILE>gtkfontchooserdialog</FILE>
<TITLE>GtkFontChooserDialog</TITLE>
GtkFontChooserDialog
gtk_font_chooser_dialog_new
@@ -1578,6 +1579,51 @@ GtkFramePrivate
gtk_frame_get_type
</SECTION>
<SECTION>
<FILE>gtkgesturesinterpreter</FILE>
<TITLE>GtkGesturesInterpreter</TITLE>
GtkGesturesInterpreter
GtkGestureType
gtk_gestures_interpreter_new
gtk_gestures_interpreter_add_gesture
gtk_gestures_interpreter_remove_gesture
gtk_gestures_interpreter_feed_event
gtk_gestures_interpreter_finish
gtk_gestures_interpreter_get_n_active_strokes
<SUBSECTION Gestures>
GtkGestureStroke
gtk_gesture_stroke_new
gtk_gesture_stroke_copy
gtk_gesture_stroke_free
gtk_gesture_stroke_append_vector
gtk_gesture_stroke_get_n_vectors
gtk_gesture_stroke_get_vector
GtkGesture
GtkGestureFlags
gtk_gesture_new
gtk_gesture_copy
gtk_gesture_free
gtk_gesture_add_stroke
gtk_gesture_get_n_strokes
gtk_gesture_get_stroke
gtk_gesture_get_flags
gtk_gesture_register
gtk_gesture_register_static
gtk_gesture_lookup
<SUBSECTION Standard>
GTK_GESTURES_INTERPRETER
GTK_IS_GESTURES_INTERPRETER
GTK_TYPE_GESTURES_INTERPRETER
GTK_IS_GESTURES_INTERPRETER_CLASS
GTK_GESTURES_INTERPRETER_GET_CLASS
<SUBSECTION Private>
gtk_gestures_interpreter_get_type
gtk_gesture_stroke_get_type
gtk_gesture_get_type
</SECTION>
<SECTION>
<FILE>gtkhandlebox</FILE>
<TITLE>GtkHandleBox</TITLE>
@@ -2059,6 +2105,7 @@ gtk_link_button_get_type
<TITLE>GtkMenu</TITLE>
GtkMenu
gtk_menu_new
gtk_menu_new_from_model
gtk_menu_set_screen
gtk_menu_reorder_child
gtk_menu_attach
@@ -2103,6 +2150,7 @@ gtk_menu_get_type
<TITLE>GtkMenuBar</TITLE>
GtkMenuBar
gtk_menu_bar_new
gtk_menu_bar_new_from_model
GtkPackDirection
gtk_menu_bar_set_pack_direction
gtk_menu_bar_get_pack_direction
@@ -2936,6 +2984,9 @@ gtk_scrolled_window_get_min_content_width
gtk_scrolled_window_set_min_content_width
gtk_scrolled_window_get_min_content_height
gtk_scrolled_window_set_min_content_height
GtkKineticScrollingFlags
gtk_scrolled_window_set_kinetic_scrolling
gtk_scrolled_window_get_kinetic_scrolling
<SUBSECTION Standard>
GTK_SCROLLED_WINDOW
@@ -5025,6 +5076,7 @@ GtkAllocation
GtkSelectionData
GtkWidgetAuxInfo
GtkWidgetHelpType
GtkCapturedEventFlags
gtk_widget_new
gtk_widget_destroy
gtk_widget_in_destruction
@@ -5210,6 +5262,7 @@ gtk_widget_get_mapped
gtk_widget_get_requisition
gtk_widget_device_is_shadowed
gtk_widget_get_modifier_mask
gtk_widget_release_captured_events
<SUBSECTION>
gtk_widget_get_path
@@ -5259,6 +5312,10 @@ gtk_widget_set_vexpand_set
gtk_widget_queue_compute_expand
gtk_widget_compute_expand
<SUBSECTION Gestures>
gtk_widget_enable_gesture
gtk_widget_disable_gesture
<SUBSECTION Standard>
GTK_WIDGET
GTK_IS_WIDGET
@@ -5294,6 +5351,7 @@ gtk_window_set_gravity
gtk_window_get_gravity
gtk_window_set_position
gtk_window_set_transient_for
gtk_window_set_attached_to
gtk_window_set_destroy_with_parent
gtk_window_set_hide_titlebar_when_maximized
gtk_window_set_screen
@@ -5352,6 +5410,7 @@ gtk_window_get_role
gtk_window_get_size
gtk_window_get_title
gtk_window_get_transient_for
gtk_window_get_attached_to
gtk_window_get_type_hint
gtk_window_get_skip_taskbar_hint
gtk_window_get_skip_pager_hint
@@ -5680,6 +5739,7 @@ gtk_style_context_add_provider_for_screen
gtk_style_context_get
gtk_style_context_get_direction
gtk_style_context_get_junction_sides
gtk_style_context_set_parent
gtk_style_context_get_path
gtk_style_context_get_property
gtk_style_context_get_screen
@@ -5688,6 +5748,7 @@ gtk_style_context_get_style
gtk_style_context_get_style_property
gtk_style_context_get_style_valist
gtk_style_context_get_valist
gtk_style_context_get_section
gtk_style_context_get_color
gtk_style_context_get_background_color
gtk_style_context_get_border_color
@@ -5712,6 +5773,7 @@ gtk_style_context_restore
gtk_style_context_save
gtk_style_context_set_direction
gtk_style_context_set_junction_sides
gtk_style_context_set_parent
gtk_style_context_set_path
gtk_style_context_add_class
gtk_style_context_remove_class
@@ -7006,6 +7068,14 @@ gtk_application_add_window
gtk_application_remove_window
gtk_application_get_windows
<SUBSECTION>
GtkApplicationInhibitFlags
gtk_application_inhibit
gtk_application_uninhibit
gtk_application_is_inhibited
GtkApplicationEndSessionStyle
gtk_application_end_session
<SUBSECTION>
gtk_application_get_app_menu
gtk_application_set_app_menu
@@ -7047,6 +7117,32 @@ gtk_application_window_get_type
GtkApplicationWindowPrivate
</SECTION>
<SECTION>
<FILE>gtkactionable</FILE>
<TITLE>GtkActionable</TITLE>
GtkActionable
GtkActionableInterface
<SUBSECTION>
gtk_actionable_get_action_name
gtk_actionable_set_action_name
<SUBSECTION>
gtk_actionable_get_action_target_value
gtk_actionable_set_action_target_value
gtk_actionable_set_action_target
<SUBSECTION>
gtk_actionable_set_detailed_action_name
<SUBSECTION Standard>
gtk_actionable_get_type
GTK_ACTIONABLE
GTK_ACTIONABLE_GET_IFACE
GTK_IS_ACTIONABLE
GTK_TYPE_ACTIONABLE
</SECTION>
<SECTION>
<FILE>gtkgrid</FILE>
<TITLE>GtkGrid</TITLE>
@@ -7256,3 +7352,61 @@ GtkOverlayClass
gtk_overlay_get_type
GtkOverlayPrivate
</SECTION>
<SECTION>
<FILE>gtkcolorchooser</FILE>
<TITLE>GtkColorChooser</TITLE>
GtkColorChooser
gtk_color_chooser_get_rgba
gtk_color_chooser_set_rgba
gtk_color_chooser_get_use_alpha
gtk_color_chooser_set_use_alpha
gtk_color_chooser_add_palette
<SUBSECTION Standard>
GTK_TYPE_COLOR_CHOOSER
GTK_COLOR_CHOOSER
GTK_IS_COLOR_CHOOSER
GTK_COLOR_CHOOSER_GET_IFACE
<SUBSECTION Private>
gtk_color_chooser_get_type
</SECTION>
<SECTION>
<FILE>gtkcolorchooserwidget</FILE>
<TITLE>GtkColorChooserWidget</TITLE>
GtkColorChooserWidget
gtk_color_chooser_widget_new
<SUBSECTION Standard>
GTK_TYPE_COLOR_CHOOSER_WIDGET
GTK_COLOR_CHOOSER_WIDGET
GTK_COLOR_CHOOSER_WIDGET_CLASS
GTK_IS_COLOR_CHOOSER_WIDGET
GTK_IS_COLOR_CHOOSER_WIDGET_CLASS
GTK_COLOR_CHOOSER_WIDGET_GET_CLASS
<SUBSECTION Private>
gtk_color_chooser_widget_get_type
GtkColorChooserWidgetPrivate
</SECTION>
<SECTION>
<FILE>gtkcolorchooserdialog</FILE>
<TITLE>GtkColorChooserDialog</TITLE>
GtkColorChooserDialog
gtk_color_chooser_dialog_new
<SUBSECTION Standard>
GTK_TYPE_COLOR_CHOOSER_DIALOG
GTK_COLOR_CHOOSER_DIALOG
GTK_COLOR_CHOOSER_DIALOG_CLASS
GTK_IS_COLOR_CHOOSER_DIALOG
GTK_IS_COLOR_CHOOSER_DIALOG_CLASS
GTK_COLOR_CHOOSER_DIALOG_GET_CLASS
<SUBSECTION Private>
GtkColorChooserDialogPrivate
gtk_color_chooser_dialog_get_type
</SECTION>

View File

@@ -6,6 +6,7 @@ gtk_accel_group_get_type
gtk_accel_label_get_type
gtk_accel_map_get_type
gtk_accessible_get_type
gtk_actionable_get_type
gtk_action_get_type
gtk_action_group_get_type
gtk_activatable_get_type
@@ -46,6 +47,9 @@ gtk_check_button_get_type
gtk_check_menu_item_get_type
gtk_clipboard_get_type
gtk_color_button_get_type
gtk_color_chooser_get_type
gtk_color_chooser_dialog_get_type
gtk_color_chooser_widget_get_type
gtk_color_selection_dialog_get_type
gtk_color_selection_get_type
gtk_combo_box_get_type
@@ -73,6 +77,7 @@ gtk_font_chooser_widget_get_type
gtk_font_selection_dialog_get_type
gtk_font_selection_get_type
gtk_frame_get_type
gtk_gestures_interpreter_get_type
gtk_grid_get_type
gtk_handle_box_get_type
gtk_hbox_get_type

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -3,10 +3,10 @@
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="gtk-migrating-checklist">
<title>Migration Checklist</title>
<title>Migration Details Checklist</title>
<para>
This chapter includes a checklist of things you need to do to
This chapter includes a checklist of smaller things you need to do to
ensure that your programs are good citizens in the GTK+ world. By
paying attention to the points in the checklist, you ensure that
many automatic features of GTK+ will work correctly in your

View File

@@ -0,0 +1,48 @@
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="gtk-migrating-smclient-GtkApplication">
<title>Migrating from EggSMClient to GtkApplication</title>
<para>
EggSMClient provides 'session management' support for applications.
This means a number of things:
<itemizedlist>
<listitem>logout notification and negotiation</listitem>
<listitem>application state saving</listitem>
<listitem>restarting of applications with saved state</listitem>
</itemizedlist>
EggSMClient supports this functionality to varying degrees on
Windows and OS X, as well as with XSMP and D-Bus based session
managers in X11.
</para>
<para>
Starting with GTK+ 3.4, #GtkApplication supports logout notification
and negotiation similar to EggSMClient.
</para>
<table>
<tgroup cols="2">
<title>EggSMClient to GtkApplication</title>
<thead>
<row><entry>EggSMClient</entry><entry>GtkApplication</entry></row>
</thead>
<tbody>
<row><entry>EggSMClient::quit-requested</entry><entry>instead of calling will_quit (FALSE,...) in response to this signal, install an inhibitor</entry></row>
<row><entry>EggSMClient::quit</entry><entry>the #GtkApplication::quit signal</entry></row>
<row><entry>EggSMClient::quit-cancelled</entry><entry></entry></row>
<row><entry>egg_sm_client_will_quit</entry><entry>instead of calling will_quit (FALSE,...), install an inhibitor</entry></row>
<row><entry>egg_sm_client_end_session</entry><entry>gtk_application_end_session()</entry></row>
</tbody>
</tgroup>
</table>
<para>
At this point, GtkApplication has no special support for state saving.
Applications can use GSettings or GKeyFile and save as much state as
they see fit in response to #GtkApplication::quit or whenever they
consider appropriate.
</para>
</chapter>

View File

@@ -2,7 +2,7 @@
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="gtk-migrating-GtkApplication">
<chapter id="gtk-migrating-unique-GtkApplication">
<title>Migrating from libunique to GApplication or GtkApplication</title>
@@ -20,7 +20,7 @@
<example><title>A unique application</title>
<para>Here is a simple application using libunique:
<programlisting>
<informalexample><programlisting>
int
main (int argc, char *argv[])
{
@@ -53,9 +53,9 @@ main (int argc, char *argv[])
return 0;
}
</programlisting>
</programlisting></informalexample>
The same application using GtkApplication:
<programlisting>
<informalexample><programlisting>
static void
activate (GtkApplication *app)
{
@@ -85,13 +85,13 @@ main (int argc, char *argv[])
app = gtk_application_new ("org.gtk.TestApplication", 0);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (app);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
</programlisting>
</programlisting></informalexample>
</para>
</example>
<section><title>Uniqueness</title>

View File

@@ -121,9 +121,9 @@ Here's a simple example:
do_small_part_of_task ();
if (task_complete)
return FALSE; /* removes the idle handler */
return G_SOURCE_REMOVE; /* removes the idle handler */
else
return TRUE; /* runs the idle handler again */
return G_SOURCE_CONTINUE; /* runs the idle handler again */
}
g_idle_add (my_idle_handler, NULL);

View File

@@ -135,4 +135,10 @@
<link linkend="GtkSwitch">
<inlinegraphic fileref="switch.png" format="PNG"></inlinegraphic>
</link>
<link linkend="GtkColorChooserDialog">
<inlinegraphic fileref="colorchooser.png" format="PNG"></inlinegraphic>
</link>
<link linkend="GtkFontChooserDialog">
<inlinegraphic fileref="fontchooser.png" format="PNG"></inlinegraphic>
</link>
</para>

View File

@@ -1154,6 +1154,33 @@ create_appchooserdialog (void)
return info;
}
static WidgetInfo *
create_fontchooserdialog (void)
{
WidgetInfo *info;
GtkWidget *widget;
widget = gtk_font_chooser_dialog_new ("Font Chooser Dialog", NULL);
gtk_window_set_default_size (GTK_WINDOW (widget), 200, 300);
info = new_widget_info ("fontchooser", widget, ASIS);
info->include_decorations = TRUE;
return info;
}
static WidgetInfo *
create_colorchooserdialog (void)
{
WidgetInfo *info;
GtkWidget *widget;
widget = gtk_color_chooser_dialog_new ("Color Chooser Dialog", NULL);
info = new_widget_info ("colorchooser", widget, ASIS);
info->include_decorations = TRUE;
return info;
}
GList *
get_all_widgets (void)
{
@@ -1204,6 +1231,8 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_appchooserbutton ());
retval = g_list_prepend (retval, create_appchooserdialog ());
retval = g_list_prepend (retval, create_lockbutton ());
retval = g_list_prepend (retval, create_fontchooserdialog ());
retval = g_list_prepend (retval, create_colorchooserdialog ());
return retval;
}

View File

@@ -13,6 +13,14 @@ activate_toggle (GSimpleAction *action,
g_variant_unref (state);
}
static void
activate_radio (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
g_action_change_state (G_ACTION (action), parameter);
}
static void
change_fullscreen_state (GSimpleAction *action,
GVariant *state,
@@ -26,6 +34,29 @@ change_fullscreen_state (GSimpleAction *action,
g_simple_action_set_state (action, state);
}
static void
change_justify_state (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GtkTextView *text = g_object_get_data (user_data, "bloatpad-text");
const gchar *str;
str = g_variant_get_string (state, NULL);
if (g_str_equal (str, "left"))
gtk_text_view_set_justification (text, GTK_JUSTIFY_LEFT);
else if (g_str_equal (str, "center"))
gtk_text_view_set_justification (text, GTK_JUSTIFY_CENTER);
else if (g_str_equal (str, "right"))
gtk_text_view_set_justification (text, GTK_JUSTIFY_RIGHT);
else
/* ignore this attempted change */
return;
g_simple_action_set_state (action, state);
}
static GtkClipboard *
get_clipboard (GtkWidget *widget)
{
@@ -62,7 +93,8 @@ window_paste (GSimpleAction *action,
static GActionEntry win_entries[] = {
{ "copy", window_copy, NULL, NULL, NULL },
{ "paste", window_paste, NULL, NULL, NULL },
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state }
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state },
{ "justify", activate_radio, "s", "'left'", change_justify_state }
};
static void
@@ -70,6 +102,9 @@ new_window (GApplication *app,
GFile *file)
{
GtkWidget *window, *grid, *scrolled, *view;
GtkWidget *toolbar;
GtkToolItem *button;
GtkWidget *sw, *box, *label;
window = gtk_application_window_new (GTK_APPLICATION (app));
gtk_window_set_default_size ((GtkWindow*)window, 640, 480);
@@ -79,6 +114,36 @@ new_window (GApplication *app,
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
toolbar = gtk_toolbar_new ();
button = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_JUSTIFY_LEFT);
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::left");
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
button = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_JUSTIFY_CENTER);
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::center");
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
button = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_JUSTIFY_RIGHT);
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::right");
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
button = gtk_separator_tool_item_new ();
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (button), FALSE);
gtk_tool_item_set_expand (GTK_TOOL_ITEM (button), TRUE);
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
button = gtk_tool_item_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (button), box);
label = gtk_label_new ("Fullscreen:");
gtk_container_add (GTK_CONTAINER (box), label);
sw = gtk_switch_new ();
gtk_actionable_set_action_name (GTK_ACTIONABLE (sw), "win.fullscreen");
gtk_container_add (GTK_CONTAINER (box), sw);
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_hexpand (scrolled, TRUE);
gtk_widget_set_vexpand (scrolled, TRUE);
@@ -88,7 +153,7 @@ new_window (GApplication *app,
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 0, 1, 1);
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 1, 1, 1);
if (file != NULL)
{
@@ -142,13 +207,15 @@ new_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
g_application_activate (user_data);
GApplication *app = user_data;
g_application_activate (app);
}
static void
show_about (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
about_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
gtk_show_about_dialog (NULL,
"program-name", "Bloatpad",
@@ -158,16 +225,14 @@ show_about (GSimpleAction *action,
}
static void
quit_app (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
quit_app (GtkApplication *app)
{
GList *list, *next;
GtkWindow *win;
g_print ("Going down...\n");
list = gtk_application_get_windows (GTK_APPLICATION (g_application_get_default ()));
list = gtk_application_get_windows (app);
while (list)
{
win = list->data;
@@ -179,10 +244,20 @@ quit_app (GSimpleAction *action,
}
}
static void
quit_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkApplication *app = user_data;
quit_app (app);
}
static GActionEntry app_entries[] = {
{ "new", new_activated, NULL, NULL, NULL },
{ "about", show_about, NULL, NULL, NULL },
{ "quit", quit_app, NULL, NULL, NULL },
{ "about", about_activated, NULL, NULL, NULL },
{ "quit", quit_activated, NULL, NULL, NULL },
};
static void
@@ -200,25 +275,50 @@ bloat_pad_startup (GApplication *application)
"<interface>"
" <menu id='app-menu'>"
" <section>"
" <item label='_New Window' action='app.new' accel='<Primary>n'/>"
" <item>"
" <attribute name='label' translatable='yes'>_New Window</attribute>"
" <attribute name='action'>app.new</attribute>"
" <attribute name='accel'>&lt;Primary&gt;n</attribute>"
" </item>"
" </section>"
" <section>"
" <item label='_About Bloatpad' action='app.about'/>"
" <item>"
" <attribute name='label' translatable='yes'>_About Bloatpad</attribute>"
" <attribute name='action'>app.about</attribute>"
" </item>"
" </section>"
" <section>"
" <item label='_Quit' action='app.quit' accel='<Primary>q'/>"
" <item>"
" <attribute name='label' translatable='yes'>_Quit</attribute>"
" <attribute name='action'>app.quit</attribute>"
" <attribute name='accel'>&lt;Primary&gt;q</attribute>"
" </item>"
" </section>"
" </menu>"
" <menu id='menubar'>"
" <submenu label='_Edit'>"
" <submenu>"
" <attribute name='label' translatable='yes'>_Edit</attribute>"
" <section>"
" <item label='_Copy' action='win.copy' accel='<Primary>c'/>"
" <item label='_Paste' action='win.paste' accel='<Primary>v'/>"
" <item>"
" <attribute name='label' translatable='yes'>_Copy</attribute>"
" <attribute name='action'>win.copy</attribute>"
" <attribute name='accel'>&lt;Primary&gt;c</attribute>"
" </item>"
" <item>"
" <attribute name='label' translatable='yes'>_Parse</attribute>"
" <attribute name='action'>win.parse</attribute>"
" <attribute name='accel'>&lt;Primary&gt;v</attribute>"
" </item>"
" </section>"
" </submenu>"
" <submenu label='_View'>"
" <submenu>"
" <attribute name='label' translatable='yes'>_View</attribute>"
" <section>"
" <item label='_Fullscreen' action='win.fullscreen'/>"
" <item>"
" <attribute name='label' translatable='yes'>_Fullscreen</attribute>"
" <attribute name='action'>win.fullscreen</attribute>"
" <attribute name='accel'>F11</attribute>"
" </item>"
" </section>"
" </submenu>"
" </menu>"
@@ -247,15 +347,33 @@ bloat_pad_class_init (BloatPadClass *class)
}
static void
quit_cb (GtkApplication *app)
{
g_print ("Session manager to us to quit\n");
quit_app (app);
}
BloatPad *
bloat_pad_new (void)
{
GtkApplication *bloat_pad;
g_type_init ();
return g_object_new (bloat_pad_get_type (),
"application-id", "org.gtk.Test.bloatpad",
"flags", G_APPLICATION_HANDLES_OPEN,
NULL);
g_set_application_name ("Bloatpad");
bloat_pad = g_object_new (bloat_pad_get_type (),
"application-id", "org.gtk.Test.bloatpad",
"flags", G_APPLICATION_HANDLES_OPEN,
"inactivity-timeout", 30000,
"register-session", TRUE,
NULL);
g_signal_connect (bloat_pad, "quit", G_CALLBACK (quit_cb), NULL);
return bloat_pad;
}
int
@@ -265,9 +383,12 @@ main (int argc, char **argv)
int status;
bloat_pad = bloat_pad_new ();
gtk_application_add_accelerator (GTK_APPLICATION (bloat_pad),
"F11", "win.fullscreen", NULL);
status = g_application_run (G_APPLICATION (bloat_pad), argc, argv);
g_object_unref (bloat_pad);
return status;

View File

@@ -86,11 +86,11 @@ button_press_event_cb (GtkWidget *widget,
if (surface == NULL)
return FALSE;
if (event->button == 1)
if (event->button == GDK_BUTTON_PRIMARY)
{
draw_brush (widget, event->x, event->y);
}
else if (event->button == 3)
else if (event->button == GDK_BUTTON_SECONDARY)
{
clear_surface ();
gtk_widget_queue_draw (widget);

View File

@@ -223,6 +223,7 @@ enable_plugin (const gchar *name)
g_signal_connect (action, "activate", G_CALLBACK (plugin_action), (gpointer)name);
g_action_map_add_action (G_ACTION_MAP (g_application_get_default ()), action);
g_print ("Actions of '%s' plugin added\n", name);
g_object_unref (action);
plugin_menu = find_plugin_menu ();
if (plugin_menu)
@@ -230,14 +231,14 @@ enable_plugin (const gchar *name)
GMenu *section;
GMenuItem *item;
gchar *label;
gchar *action;
gchar *action_name;
section = g_menu_new ();
label = g_strdup_printf ("Turn text %s", name);
action = g_strconcat ("app.", name, NULL);
g_menu_insert (section, 0, label, action);
action_name = g_strconcat ("app.", name, NULL);
g_menu_insert (section, 0, label, action_name);
g_free (label);
g_free (action);
g_free (action_name);
item = g_menu_item_new_section (NULL, (GMenuModel*)section);
g_menu_item_set_attribute (item, "id", "s", name);
g_menu_append_item (G_MENU (plugin_menu), item);

View File

@@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Gail
Description: GNOME Accessibility Implementation Library
Version: @VERSION@
Requires: atk gtk+-3.0
Libs: ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail.la ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail-util/libgailutil.la
Cflags: -I${pc_top_builddir}/${pcfiledir}/modules/other/gail

View File

@@ -88,6 +88,7 @@ gdk_public_h_sources = \
gdkselection.h \
gdktestutils.h \
gdkthreads.h \
gdktouchcluster.h \
gdktypes.h \
gdkvisual.h \
gdkwindow.h
@@ -130,6 +131,7 @@ gdk_c_sources = \
gdkrgba.c \
gdkscreen.c \
gdkselection.c \
gdktouchcluster.c \
gdkvisual.c \
gdkwindow.c \
gdkwindowimpl.c

View File

@@ -362,7 +362,7 @@ parse_input (BroadwayInput *input)
gsize len, payload_len;
BroadwayWSOpCode code;
gboolean is_mask, fin;
guchar *buf, *data;
guchar *buf, *data, *mask;
buf = input->buffer->data;
len = input->buffer->len;
@@ -391,6 +391,16 @@ parse_input (BroadwayInput *input)
payload_len = GUINT64_FROM_BE( *(guint64 *) data );
data += 8;
}
mask = NULL;
if (is_mask)
{
if (data - buf + 4 > len)
return;
mask = data;
data += 4;
}
if (data - buf + payload_len > len)
return; /* wait to accumulate more */
@@ -398,8 +408,7 @@ parse_input (BroadwayInput *input)
{
gsize i;
for (i = 0; i < payload_len; i++)
data[i + 4] ^= data[i%4];
data += 4;
data[i] ^= mask[i%4];
}
switch (code) {
@@ -413,7 +422,11 @@ parse_input (BroadwayInput *input)
#endif
}
else
parse_input_message (input, (char *)data);
{
char *terminated = g_strndup((char *)data, payload_len);
parse_input_message (input, terminated);
g_free (terminated);
}
break;
case BROADWAY_WS_CNX_PING:
broadway_output_pong (broadway_display->output);
@@ -474,7 +487,7 @@ process_input_idle_cb (GdkBroadwayDisplay *display)
{
display->process_input_idle = 0;
process_input_messages (display);
return FALSE;
return G_SOURCE_REMOVE;
}
static void
@@ -1003,7 +1016,7 @@ got_http_request_line (GInputStream *stream,
/* Protect against overflow in request length */
if (request->request->len > 1024 * 5)
{
send_error (request, 400, "Request to long");
send_error (request, 400, "Request too long");
}
else
{
@@ -1213,8 +1226,7 @@ gdk_broadway_display_finalize (GObject *object)
_gdk_broadway_cursor_display_finalize (GDK_DISPLAY_OBJECT(broadway_display));
/* input GdkDevice list */
g_list_foreach (broadway_display->input_devices, (GFunc) g_object_unref, NULL);
g_list_free (broadway_display->input_devices);
g_list_free_full (broadway_display->input_devices, g_object_unref);
/* Free all GdkScreens */
g_object_unref (broadway_display->screens[0]);
g_free (broadway_display->screens);

View File

@@ -895,7 +895,7 @@ gdk_threads_add_idle (GSourceFunc function,
*
* self->timeout_id = 0;
*
* return FALSE;
* return G_SOURCE_REMOVE;
* }
*
* static void some_widget_do_stuff_later (SomeWidget *self)

View File

@@ -53,6 +53,7 @@
#include <gdk/gdkselection.h>
#include <gdk/gdktestutils.h>
#include <gdk/gdkthreads.h>
#include <gdk/gdktouchcluster.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkvisual.h>
#include <gdk/gdkwindow.h>

View File

@@ -168,6 +168,7 @@ gdk_event_get_scroll_direction
gdk_event_get_source_device
gdk_event_get_state
gdk_event_get_time
gdk_event_get_touch_id
gdk_event_get_type
gdk_event_handler_set
gdk_event_mask_get_type
@@ -327,6 +328,11 @@ gdk_threads_enter
gdk_threads_init
gdk_threads_leave
gdk_threads_set_lock_functions
gdk_touch_cluster_add_touch
gdk_touch_cluster_get_device
gdk_touch_cluster_get_type G_GNUC_CONST
gdk_touch_cluster_list_touches
gdk_touch_cluster_remove_touch
gdk_unicode_to_keyval
gdk_utf8_to_string_target
gdk_visibility_state_get_type

View File

@@ -38,6 +38,7 @@
* screen or workspace.
* <example>
* <title>Launching an application</title>
* <informalexample>
* <programlisting>
* GdkAppLaunchContext *context;
*
@@ -51,6 +52,7 @@
*
* g_object_unref (context);
* </programlisting>
* </informalexample>
* </example>
*/

View File

@@ -89,6 +89,8 @@ gdk_cairo_get_clip_rectangle (cairo_t *cr,
* Sets the specified #GdkColor as the source color of @cr.
*
* Since: 2.8
*
* Deprecated: 3.4: Use gdk_cairo_set_source_rgba() instead
*/
void
gdk_cairo_set_source_color (cairo_t *cr,

View File

@@ -35,8 +35,6 @@ cairo_t * gdk_cairo_create (GdkWindow *window);
gboolean gdk_cairo_get_clip_rectangle (cairo_t *cr,
GdkRectangle *rect);
void gdk_cairo_set_source_color (cairo_t *cr,
const GdkColor *color);
void gdk_cairo_set_source_rgba (cairo_t *cr,
const GdkRGBA *rgba);
void gdk_cairo_set_source_pixbuf (cairo_t *cr,
@@ -57,6 +55,10 @@ cairo_region_t *
gdk_cairo_region_create_from_surface
(cairo_surface_t *surface);
GDK_DEPRECATED_FOR(gdk_cairo_set_source_rgba)
void gdk_cairo_set_source_color (cairo_t *cr,
const GdkColor *color);
G_END_DECLS
#endif /* __GDK_CAIRO_H__ */

View File

@@ -14,6 +14,19 @@
G_BEGIN_DECLS
/* These macros are used to mark deprecated functions in GDK and
* GTK+ headers, and thus have to be exposed in installed headers.
* But please do *not* use them in other projects. Instead, use
* G_DEPRECATED or define your own wrappers around it.
*/
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
#define GDK_DEPRECATED
#define GDK_DEPRECATED_FOR(f)
#else
#define GDK_DEPRECATED G_DEPRECATED
#define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
#endif
#define GDK_WINDOWING_WIN32

View File

@@ -61,6 +61,7 @@ typedef enum
* of a stylus on a graphics tablet.
* @GDK_SOURCE_CURSOR: the device is a graphics tablet "puck" or similar device.
* @GDK_SOURCE_KEYBOARD: the device is a keyboard.
* @GDK_SOURCE_TOUCH: the device is a touch capable device.
*
* An enumeration describing the type of an input device in general terms.
*/
@@ -70,7 +71,8 @@ typedef enum
GDK_SOURCE_PEN,
GDK_SOURCE_ERASER,
GDK_SOURCE_CURSOR,
GDK_SOURCE_KEYBOARD
GDK_SOURCE_KEYBOARD,
GDK_SOURCE_TOUCH
} GdkInputSource;
/**

View File

@@ -154,8 +154,7 @@ free_device_grabs_foreach (gpointer key,
{
GList *list = value;
g_list_foreach (list, (GFunc) free_device_grab, NULL);
g_list_free (list);
g_list_free_full (list, (GDestroyNotify) free_device_grab);
return TRUE;
}
@@ -189,6 +188,7 @@ gdk_display_init (GdkDisplay *display)
display->double_click_time = 250;
display->double_click_distance = 5;
display->touch_implicit_grabs = g_array_new (FALSE, FALSE, sizeof (GdkTouchGrabInfo));
display->device_grabs = g_hash_table_new (NULL, NULL);
display->motion_hint_info = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) g_free);
@@ -211,8 +211,7 @@ gdk_display_dispose (GObject *object)
device_manager = gdk_display_get_device_manager (GDK_DISPLAY (object));
g_list_foreach (display->queued_events, (GFunc)gdk_event_free, NULL);
g_list_free (display->queued_events);
g_list_free_full (display->queued_events, (GDestroyNotify) gdk_event_free);
display->queued_events = NULL;
display->queued_tail = NULL;
@@ -238,6 +237,8 @@ gdk_display_finalize (GObject *object)
NULL);
g_hash_table_destroy (display->device_grabs);
g_array_free (display->touch_implicit_grabs, TRUE);
g_hash_table_destroy (display->motion_hint_info);
g_hash_table_destroy (display->pointers_info);
g_hash_table_destroy (display->multiple_click_info);
@@ -696,6 +697,81 @@ _gdk_display_add_device_grab (GdkDisplay *display,
return info;
}
static void
_gdk_display_break_touch_grabs (GdkDisplay *display,
GdkDevice *device,
GdkWindow *new_grab_window)
{
guint i = 0;
while (i < display->touch_implicit_grabs->len)
{
GdkTouchGrabInfo *info;
info = &g_array_index (display->touch_implicit_grabs,
GdkTouchGrabInfo, i);
if (info->device == device &&
info->window != new_grab_window)
{
generate_grab_broken_event (GDK_WINDOW (info->window),
device, TRUE, new_grab_window);
_gdk_window_finish_touch_id (info->window, device, info->touch_id);
g_array_remove_index_fast (display->touch_implicit_grabs, i);
}
else
i++;
}
}
void
_gdk_display_add_touch_grab (GdkDisplay *display,
GdkDevice *device,
guint touch_id,
GdkWindow *window,
GdkWindow *native_window,
GdkEventMask event_mask,
unsigned long serial,
guint32 time)
{
GdkTouchGrabInfo info;
info.device = device;
info.touch_id = touch_id;
info.window = g_object_ref (window);
info.native_window = g_object_ref (native_window);
info.serial = serial;
info.event_mask = event_mask;
info.time = time;
g_array_append_val (display->touch_implicit_grabs, info);
}
gboolean
_gdk_display_end_touch_grab (GdkDisplay *display,
GdkDevice *device,
guint touch_id)
{
guint i;
for (i = 0; i < display->touch_implicit_grabs->len; i++)
{
GdkTouchGrabInfo *info;
info = &g_array_index (display->touch_implicit_grabs,
GdkTouchGrabInfo, i);
if (info->device == device &&
info->touch_id == touch_id)
{
g_array_remove_index_fast (display->touch_implicit_grabs, i);
return TRUE;
}
}
return FALSE;
}
/* _gdk_synthesize_crossing_events only works inside one toplevel.
This function splits things into two calls if needed, converting the
coordinates to the right toplevel */
@@ -899,15 +975,25 @@ switch_to_pointer_grab (GdkDisplay *display,
if (grab == NULL) /* Ungrabbed, send events */
{
pointer_window = NULL;
if (new_toplevel)
{
/* Find (possibly virtual) child window */
pointer_window =
_gdk_window_find_descendant_at (new_toplevel,
x, y,
NULL, NULL);
}
/* If the source device is a touch device, do not
* propagate any enter event yet, until one is
* synthesized when needed.
*/
if (source_device &&
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
info->need_touch_press_enter = TRUE;
pointer_window = NULL;
if (new_toplevel &&
!info->need_touch_press_enter)
{
/* Find (possibly virtual) child window */
pointer_window =
_gdk_window_find_descendant_at (new_toplevel,
x, y,
NULL, NULL);
}
if (pointer_window != last_grab->window)
synthesize_crossing_events (display, device, source_device,
@@ -966,12 +1052,15 @@ _gdk_display_device_grab_update (GdkDisplay *display,
next_grab = NULL; /* Actually its not yet active */
}
if (next_grab)
_gdk_display_break_touch_grabs (display, device, next_grab->window);
if ((next_grab == NULL && current_grab->implicit_ungrab) ||
(next_grab != NULL && current_grab->window != next_grab->window))
generate_grab_broken_event (GDK_WINDOW (current_grab->window),
(next_grab != NULL && current_grab->window != next_grab->window))
generate_grab_broken_event (GDK_WINDOW (current_grab->window),
device,
current_grab->implicit,
next_grab? next_grab->window : NULL);
current_grab->implicit,
next_grab? next_grab->window : NULL);
/* Remove old grab */
grabs = g_list_delete_link (grabs, grabs);
@@ -1030,6 +1119,34 @@ _gdk_display_has_device_grab (GdkDisplay *display,
return NULL;
}
GdkTouchGrabInfo *
_gdk_display_has_touch_grab (GdkDisplay *display,
GdkDevice *device,
guint touch_id,
gulong serial)
{
guint i;
for (i = 0; i < display->touch_implicit_grabs->len; i++)
{
GdkTouchGrabInfo *info;
info = &g_array_index (display->touch_implicit_grabs,
GdkTouchGrabInfo, i);
if (info->device == device &&
info->touch_id == touch_id)
{
if (serial >= info->serial)
return info;
else
return NULL;
}
}
return NULL;
}
/* Returns true if last grab was ended
* If if_child is non-NULL, end the grab only if the grabbed
* window is the same as if_child or a descendant of it */
@@ -1122,6 +1239,9 @@ _gdk_display_get_pointer_info (GdkDisplay *display,
{
GdkPointerWindowInfo *info;
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
if (G_UNLIKELY (!device))
return NULL;

View File

@@ -60,6 +60,19 @@ typedef struct
guint implicit : 1;
} GdkDeviceGrabInfo;
/* Tracks information about a touch implicit grab on this display */
typedef struct
{
GdkDevice *device;
guint touch_id;
GdkWindow *window;
GdkWindow *native_window;
gulong serial;
guint event_mask;
guint32 time;
} GdkTouchGrabInfo;
/* Tracks information about which window and position the pointer last was in.
* This is useful when we need to synthesize events later.
* Note that we track toplevel_under_pointer using enter/leave events,
@@ -75,6 +88,8 @@ typedef struct
gdouble toplevel_x, toplevel_y;
guint32 state;
guint32 button;
GdkDevice *last_slave;
guint need_touch_press_enter : 1;
} GdkPointerWindowInfo;
typedef struct
@@ -103,6 +118,7 @@ struct _GdkDisplay
guint closed : 1; /* Whether this display has been closed */
guint ignore_core_events : 1; /* Don't send core motion and button event */
GArray *touch_implicit_grabs;
GHashTable *device_grabs;
GHashTable *motion_hint_info;
GdkDeviceManager *device_manager;
@@ -260,6 +276,21 @@ gboolean _gdk_display_end_device_grab (GdkDisplay *display
gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
GdkDevice *device,
gulong serial);
void _gdk_display_add_touch_grab (GdkDisplay *display,
GdkDevice *device,
guint touch_id,
GdkWindow *window,
GdkWindow *native_window,
GdkEventMask event_mask,
unsigned long serial_start,
guint32 time);
GdkTouchGrabInfo * _gdk_display_has_touch_grab (GdkDisplay *display,
GdkDevice *device,
guint touch_id,
gulong serial);
gboolean _gdk_display_end_touch_grab (GdkDisplay *display,
GdkDevice *device,
guint touch_id);
void _gdk_display_enable_motion_hints (GdkDisplay *display,
GdkDevice *device);
GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,

View File

@@ -445,6 +445,7 @@ gdk_event_new (GdkEventType type)
switch (type)
{
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
new_event->motion.x = 0.;
new_event->motion.y = 0.;
new_event->motion.x_root = 0.;
@@ -454,6 +455,8 @@ gdk_event_new (GdkEventType type)
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
new_event->button.x = 0.;
new_event->button.y = 0.;
new_event->button.x_root = 0.;
@@ -487,7 +490,31 @@ gdk_event_is_allocated (const GdkEvent *event)
return FALSE;
}
void
_gdk_event_set_pointer_emulated (GdkEvent *event,
gboolean emulated)
{
if (gdk_event_is_allocated (event))
{
GdkEventPrivate *private = (GdkEventPrivate *) event;
if (emulated)
private->flags |= GDK_EVENT_POINTER_EMULATED;
else
private->flags &= ~(GDK_EVENT_POINTER_EMULATED);
}
}
gboolean
_gdk_event_get_pointer_emulated (GdkEvent *event)
{
if (gdk_event_is_allocated (event))
return (((GdkEventPrivate *) event)->flags & GDK_EVENT_POINTER_EMULATED) != 0;
return FALSE;
}
/**
* gdk_event_copy:
* @event: a #GdkEvent
@@ -558,12 +585,15 @@ gdk_event_copy (const GdkEvent *event)
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
if (event->button.axes)
new_event->button.axes = g_memdup (event->button.axes,
sizeof (gdouble) * gdk_device_get_n_axes (event->button.device));
break;
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
if (event->motion.axes)
new_event->motion.axes = g_memdup (event->motion.axes,
sizeof (gdouble) * gdk_device_get_n_axes (event->motion.device));
@@ -583,6 +613,22 @@ gdk_event_copy (const GdkEvent *event)
g_object_ref (new_event->selection.requestor);
break;
case GDK_MULTITOUCH_ADDED:
case GDK_MULTITOUCH_REMOVED:
case GDK_MULTITOUCH_UPDATED:
{
GdkEventMotion **motion_events;
guint i;
motion_events = g_new0 (GdkEventMotion*, event->multitouch.n_events);
for (i = 0; i < event->multitouch.n_events; i++)
motion_events[i] = (GdkEventMotion *) gdk_event_copy ((GdkEvent *) event->multitouch.events[i]);
new_event->multitouch.events = motion_events;
}
break;
default:
break;
}
@@ -639,6 +685,8 @@ gdk_event_free (GdkEvent *event)
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
g_free (event->button.axes);
break;
@@ -649,6 +697,7 @@ gdk_event_free (GdkEvent *event)
break;
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
g_free (event->motion.axes);
break;
@@ -668,6 +717,20 @@ gdk_event_free (GdkEvent *event)
g_object_unref (event->selection.requestor);
break;
case GDK_MULTITOUCH_ADDED:
case GDK_MULTITOUCH_REMOVED:
case GDK_MULTITOUCH_UPDATED:
if (event->multitouch.events)
{
guint i;
for (i = 0; i < event->multitouch.n_events; i++)
gdk_event_free ((GdkEvent *) event->multitouch.events[i]);
g_free (event->multitouch.events);
}
break;
default:
break;
}
@@ -696,11 +759,14 @@ gdk_event_get_time (const GdkEvent *event)
switch (event->type)
{
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
return event->motion.time;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
return event->button.time;
case GDK_SCROLL:
return event->scroll.time;
@@ -726,6 +792,10 @@ gdk_event_get_time (const GdkEvent *event)
case GDK_DROP_START:
case GDK_DROP_FINISHED:
return event->dnd.time;
case GDK_MULTITOUCH_ADDED:
case GDK_MULTITOUCH_REMOVED:
case GDK_MULTITOUCH_UPDATED:
return event->multitouch.time;
case GDK_CLIENT_EVENT:
case GDK_VISIBILITY_NOTIFY:
case GDK_CONFIGURE:
@@ -771,12 +841,15 @@ gdk_event_get_state (const GdkEvent *event,
switch (event->type)
{
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
*state = event->motion.state;
return TRUE;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
*state = event->button.state;
return TRUE;
case GDK_SCROLL:
@@ -790,6 +863,11 @@ gdk_event_get_state (const GdkEvent *event,
case GDK_LEAVE_NOTIFY:
*state = event->crossing.state;
return TRUE;
case GDK_MULTITOUCH_ADDED:
case GDK_MULTITOUCH_REMOVED:
case GDK_MULTITOUCH_UPDATED:
*state = event->multitouch.state;
return TRUE;
case GDK_PROPERTY_NOTIFY:
case GDK_VISIBILITY_NOTIFY:
case GDK_CLIENT_EVENT:
@@ -865,10 +943,13 @@ gdk_event_get_coords (const GdkEvent *event,
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
x = event->button.x;
y = event->button.y;
break;
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
x = event->motion.x;
y = event->motion.y;
break;
@@ -908,6 +989,7 @@ gdk_event_get_root_coords (const GdkEvent *event,
switch (event->type)
{
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
x = event->motion.x_root;
y = event->motion.y_root;
break;
@@ -919,6 +1001,8 @@ gdk_event_get_root_coords (const GdkEvent *event,
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
x = event->button.x_root;
y = event->button.y_root;
break;
@@ -1162,7 +1246,8 @@ gdk_event_get_axis (const GdkEvent *event,
switch (event->type)
{
case GDK_MOTION_NOTIFY:
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
x = event->motion.x;
y = event->motion.y;
break;
@@ -1172,6 +1257,8 @@ gdk_event_get_axis (const GdkEvent *event,
break;
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
x = event->button.x;
y = event->button.y;
break;
@@ -1193,12 +1280,15 @@ gdk_event_get_axis (const GdkEvent *event,
return TRUE;
}
else if (event->type == GDK_BUTTON_PRESS ||
event->type == GDK_BUTTON_RELEASE)
event->type == GDK_BUTTON_RELEASE ||
event->type == GDK_TOUCH_PRESS ||
event->type == GDK_TOUCH_RELEASE)
{
device = event->button.device;
axes = event->button.axes;
}
else if (event->type == GDK_MOTION_NOTIFY)
else if (event->type == GDK_MOTION_NOTIFY ||
event->type == GDK_TOUCH_MOTION)
{
device = event->motion.device;
axes = event->motion.axes;
@@ -1235,12 +1325,15 @@ gdk_event_set_device (GdkEvent *event,
switch (event->type)
{
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
event->motion.device = device;
break;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
event->button.device = device;
break;
case GDK_SCROLL:
@@ -1250,6 +1343,10 @@ gdk_event_set_device (GdkEvent *event,
case GDK_PROXIMITY_OUT:
event->proximity.device = device;
break;
case GDK_MULTITOUCH_ADDED:
case GDK_MULTITOUCH_REMOVED:
case GDK_MULTITOUCH_UPDATED:
event->multitouch.device = device;
default:
break;
}
@@ -1282,17 +1379,24 @@ gdk_event_get_device (const GdkEvent *event)
switch (event->type)
{
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
return event->motion.device;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
return event->button.device;
case GDK_SCROLL:
return event->scroll.device;
case GDK_PROXIMITY_IN:
case GDK_PROXIMITY_OUT:
return event->proximity.device;
case GDK_MULTITOUCH_ADDED:
case GDK_MULTITOUCH_REMOVED:
case GDK_MULTITOUCH_UPDATED:
return event->multitouch.device;
default:
break;
}
@@ -1301,10 +1405,13 @@ gdk_event_get_device (const GdkEvent *event)
switch (event->type)
{
case GDK_MOTION_NOTIFY:
case GDK_TOUCH_MOTION:
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_TOUCH_PRESS:
case GDK_TOUCH_RELEASE:
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
case GDK_FOCUS_CHANGE:
@@ -1320,6 +1427,9 @@ gdk_event_get_device (const GdkEvent *event)
case GDK_GRAB_BROKEN:
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
case GDK_MULTITOUCH_ADDED:
case GDK_MULTITOUCH_REMOVED:
case GDK_MULTITOUCH_UPDATED:
{
GdkDisplay *display;
GdkDeviceManager *device_manager;
@@ -1460,7 +1570,7 @@ gdk_event_request_motions (const GdkEventMotion *event)
* also trigger a context menu if this modifier is pressed.
*
* This function should always be used instead of simply checking for
* event->button == 3.
* event->button == %GDK_BUTTON_SECONDARY.
*
* Returns: %TRUE if the event should trigger a context menu.
*
@@ -1479,7 +1589,7 @@ gdk_event_triggers_context_menu (const GdkEvent *event)
g_return_val_if_fail (GDK_IS_WINDOW (bevent->window), FALSE);
if (bevent->button == 3 &&
if (bevent->button == GDK_BUTTON_SECONDARY &&
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
return TRUE;
@@ -1489,7 +1599,7 @@ gdk_event_triggers_context_menu (const GdkEvent *event)
GDK_MODIFIER_INTENT_CONTEXT_MENU);
if (modifier != 0 &&
bevent->button == 1 &&
bevent->button == GDK_BUTTON_PRIMARY &&
! (bevent->state & (GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
(bevent->state & modifier))
return TRUE;
@@ -1686,6 +1796,138 @@ gdk_event_get_screen (const GdkEvent *event)
return NULL;
}
/**
* gdk_event_get_touch_id:
* @event: a #GdkEvent
* @touch_id: return location of the touch ID of a touch event
*
* If @event if of type %GDK_TOUCH_MOTION, %GDK_TOUCH_PRESS or
* %GDK_TOUCH_RELEASE, fills in @touch_id and returns %TRUE,
* else it returns %FALSE.
*
* Returns: %TRUE if the touch ID can be extracted from @event.
*
* Since: 3.4
**/
gboolean
gdk_event_get_touch_id (const GdkEvent *event,
guint *touch_id)
{
if (!event)
return FALSE;
if (event->type == GDK_TOUCH_MOTION)
{
if (touch_id)
*touch_id = event->motion.touch_id;
return TRUE;
}
else if (event->type == GDK_TOUCH_PRESS ||
event->type == GDK_TOUCH_RELEASE)
{
if (touch_id)
*touch_id = event->button.touch_id;
return TRUE;
}
else
{
if (touch_id)
*touch_id = 0;
return FALSE;
}
}
/**
* gdk_event_get_touch_area:
* @event: a #GdkEvent
*
* This function takes a #GdkEvent coming from a touch device
* (eg. gdk_event_get_source_device() returns a device of type
* %GDK_SOURCE_TOUCH), and returns the area covered by the touch
* as a #cairo_region_t. or %NULL if the device doesn't provide
* this information, or the touch area information couldn't be
* extracted from the event.
*
* <note><warning>Not all touch capable devices provide this
* information, so provide fallbacks to this function returning
* %NULL, even if the window receiving events is only meant
* to react to touch events.</warning></note>
*
* Returns: (transfer full): the touch region, or %NULL if unavailable
*
* Since: 3.4
**/
cairo_region_t *
gdk_event_get_touch_area (GdkEvent *event)
{
gdouble *axes, minor_axis, major_axis, orientation_axis;
GdkAtom major, minor, orientation;
GdkDevice *device;
g_return_val_if_fail (event != NULL, NULL);
device = gdk_event_get_source_device (event);
if (!device)
return NULL;
if (event->type == GDK_MOTION_NOTIFY ||
event->type == GDK_TOUCH_MOTION)
axes = event->motion.axes;
else if (event->type == GDK_BUTTON_PRESS ||
event->type == GDK_2BUTTON_PRESS ||
event->type == GDK_3BUTTON_PRESS ||
event->type == GDK_BUTTON_RELEASE)
axes = event->button.axes;
else
return NULL;
major = gdk_atom_intern_static_string ("Abs MT Touch Major");
minor = gdk_atom_intern_static_string ("Abs MT Touch Minor");
orientation = gdk_atom_intern_static_string ("Abs MT Orientation");
if (gdk_device_get_axis_value (device, axes, major, &major_axis) &&
gdk_device_get_axis_value (device, axes, minor, &minor_axis) &&
gdk_device_get_axis_value (device, axes, orientation, &orientation_axis))
{
cairo_rectangle_int_t rect;
GdkScreen *screen;
gdouble x, y;
/* FIXME: We're assuming the device is mapped to a single screen,
* could lead to stretched/shrinked shapes in multimonitor, although
* that'd be an unusual setup for touchscreens.
*/
screen = gdk_window_get_screen (event->any.window);
gdk_event_get_coords (event, &x, &y);
if (orientation_axis == 0)
{
/* Orientation is horizontal */
rect.width = (gint) gdk_screen_get_width (screen) * major_axis;
rect.height = (gint) gdk_screen_get_height (screen) * minor_axis;
}
else
{
/* Orientation is vertical */
rect.height = (gint) gdk_screen_get_height (screen) * major_axis;
rect.width = (gint) gdk_screen_get_width (screen) * minor_axis;
}
/* Something is wrong here */
if (rect.width == 0 ||
rect.height == 0)
return NULL;
rect.x = x - rect.width / 2;
rect.y = y - rect.height / 2;
return cairo_region_create_rectangle (&rect);
}
return NULL;
}
/**
* gdk_set_show_events:
* @show_events: %TRUE to output event debugging information.

View File

@@ -35,6 +35,7 @@
#include <gdk/gdktypes.h>
#include <gdk/gdkdnd.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdktouchcluster.h>
G_BEGIN_DECLS
@@ -74,6 +75,56 @@ G_BEGIN_DECLS
*/
#define GDK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
/**
* GDK_EVENT_PROPAGATE:
*
* Use this macro as the return value for continuing the propagation of
* an event handler.
*
* Since: 3.4
*/
#define GDK_EVENT_PROPAGATE (FALSE)
/**
* GDK_EVENT_STOP:
*
* Use this macro as the return value for stopping the propagation of
* an event handler.
*
* Since: 3.4
*/
#define GDK_EVENT_STOP (TRUE)
/**
* GDK_BUTTON_PRIMARY:
*
* The primary button. This is typically the left mouse button, or the
* right button in a left-handed setup.
*
* Since: 3.4
*/
#define GDK_BUTTON_PRIMARY (1)
/**
* GDK_BUTTON_MIDDLE:
*
* The middle button.
*
* Since: 3.4
*/
#define GDK_BUTTON_MIDDLE (2)
/**
* GDK_BUTTON_SECONDARY:
*
* The secondary button. This is typically the right mouse button, or the
* left button in a left-handed setup.
*
* Since: 3.4
*/
#define GDK_BUTTON_SECONDARY (3)
typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventExpose GdkEventExpose;
@@ -93,6 +144,7 @@ typedef struct _GdkEventDND GdkEventDND;
typedef struct _GdkEventWindowState GdkEventWindowState;
typedef struct _GdkEventSetting GdkEventSetting;
typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
typedef struct _GdkEventMultiTouch GdkEventMultiTouch;
typedef union _GdkEvent GdkEvent;
@@ -213,6 +265,18 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
* was added in 2.8.
* @GDK_DAMAGE: the content of the window has been changed. This event type
* was added in 2.14.
* @GDK_TOUCH_MOTION: A touch device has been updated. This event type was
* added in 3.4.
* @GDK_TOUCH_PRESS: A new touch stream has just started. This event type was
* added in 3.4.
* @GDK_TOUCH_RELEASE: A touch stream has finished. This event type was
* added in 3.4.
* @GDK_MULTITOUCH_ADDED: A touch ID was added to a #GdkTouchCluster. This
* event type was added in 3.4.
* @GDK_MULTITOUCH_UPDATED: A touch within a #GdkTouchCluster has been updated.
* This event type was added in 3.4.
* @GDK_MULTITOUCH_REMOVED: A touch ID was removed from a #GdkTouchCluster. This
* event type was added in 3.4.
* @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
*
* Specifies the type of the event.
@@ -260,6 +324,12 @@ typedef enum
GDK_OWNER_CHANGE = 34,
GDK_GRAB_BROKEN = 35,
GDK_DAMAGE = 36,
GDK_TOUCH_MOTION = 37,
GDK_TOUCH_PRESS = 38,
GDK_TOUCH_RELEASE = 39,
GDK_MULTITOUCH_ADDED = 40,
GDK_MULTITOUCH_UPDATED = 41,
GDK_MULTITOUCH_REMOVED = 42,
GDK_EVENT_LAST /* helper variable for decls */
} GdkEventType;
@@ -335,6 +405,13 @@ typedef enum
* @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
* @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
* state (e.g. sensitivity).
* @GDK_CROSSING_TOUCH_PRESS: crossing because a touch device was pressed,
* this event is synthetic as the pointer might have not left the window.
* @GDK_CROSSING_TOUCH_RELEASE: crossing because a touch device was released.
* this event is synthetic as the pointer might have not left the window.
* @GDK_CROSSING_DEVICE_SWITCH: crossing because of a device switch (i.e.
* a mouse taking control of the pointer after a touch device), this event
* is synthetic as the pointer didn't leave the window.
*
* Specifies the crossing mode for #GdkEventCrossing.
*/
@@ -345,7 +422,10 @@ typedef enum
GDK_CROSSING_UNGRAB,
GDK_CROSSING_GTK_GRAB,
GDK_CROSSING_GTK_UNGRAB,
GDK_CROSSING_STATE_CHANGED
GDK_CROSSING_STATE_CHANGED,
GDK_CROSSING_TOUCH_PRESS,
GDK_CROSSING_TOUCH_RELEASE,
GDK_CROSSING_DEVICE_SWITCH
} GdkCrossingMode;
/**
@@ -502,8 +582,13 @@ struct _GdkEventVisibility
* screen.
* @y_root: the y coordinate of the pointer relative to the root of the
* screen.
* @touch_id: touch ID, only meaningful if event is of type %GDK_TOUCH_MOTION.
*
* Generated when the pointer moves.
* Generated when the pointer/touch moves.
*
* If the event has a type of %GDK_TOUCH_MOTION, this event will
* pertain to a sequence identified by gdk_event_get_touch_id().
* With multitouch devices, there may be several ongoing sequences.
*/
struct _GdkEventMotion
{
@@ -518,12 +603,63 @@ struct _GdkEventMotion
gint16 is_hint;
GdkDevice *device;
gdouble x_root, y_root;
guint touch_id;
};
/**
* GdkEventMultiTouch:
* @type: the type of the event (%GDK_MULTITOUCH_ADDED, %GDK_MULTITOUCH_UPDATED
* or %GDK_MULTITOUCH_REMOVED).
* @window: the window which received the event.
* @send_event: %TRUE if the event was sent explicitly (e.g. using
* <function>XSendEvent</function>).
* @time: the time of the event in milliseconds.
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* @device: the device where the event originated.
* @group: the #GdkTouchCluster containing the touches that generated this event
* @events: an array of events of type %GDK_TOUCH_MOTION for the touches in @group
* @updated_touch_id: the touch ID that caused this event to be generated
* @n_events: the number of events in @events
* @n_updated_event: the index in @events of the event corresponding to
* @updated_touch_id, or -1 for %GDK_MULTITOUCH_REMOVED events.
*
* Used for multitouch events. The @type field will be one of
* %GDK_MULTITOUCH_ADDED, %GDK_MULTITOUCH_UPDATED or
* %GDK_MULTITOUCH_REMOVED.
*
* Multitouch events group the events from the touches in a
* #GdkTouchCluster, so one of these events is generated
* whenever a touch ID generates a new event, or a touch ID
* is added or removed.
*
* For any given touch ID, %GDK_MULTITOUCH_ADDED and
* %GDK_MULTITOUCH_REMOVED events are always paired,
* with any number of %GDK_MULTITOUCH_UPDATED
* events in between. The minimum event stream is an
* added/removed pair.
*/
struct _GdkEventMultiTouch
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
guint32 time;
guint state;
GdkDevice *device;
GdkTouchCluster *group;
GdkEventMotion **events;
guint updated_touch_id;
gint8 n_events;
gint8 n_updated_event;
};
/**
* GdkEventButton:
* @type: the type of the event (%GDK_BUTTON_PRESS, %GDK_2BUTTON_PRESS,
* %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE).
* %GDK_3BUTTON_PRESS, %GDK_BUTTON_RELEASE, %GDK_TOUCH_PRESS or
* %GDK_TOUCH_RELEASE).
* @window: the window which received the event.
* @send_event: %TRUE if the event was sent explicitly (e.g. using
* <function>XSendEvent</function>).
@@ -544,10 +680,13 @@ struct _GdkEventMotion
* screen.
* @y_root: the y coordinate of the pointer relative to the root of the
* screen.
* @touch_id: touch ID, only meaningful if event is of type %GDK_TOUCH_PRESS
* or %GDK_TOUCH_RELEASE.
*
* Used for button press and button release events. The
* @type field will be one of %GDK_BUTTON_PRESS,
* %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, and %GDK_BUTTON_RELEASE.
* %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, %GDK_BUTTON_RELEASE,
* %GDK_TOUCH_PRESS and %GDK_TOUCH_RELEASE.
*
* Double and triple-clicks result in a sequence of events being received.
* For double-clicks the order of events will be:
@@ -579,6 +718,11 @@ struct _GdkEventMotion
* For a double click to occur, the second button press must occur within
* 1/4 of a second of the first. For a triple click to occur, the third
* button press must also occur within 1/2 second of the first button press.
*
* If the event has a type of %GDK_TOUCH_PRESS or %GDK_TOUCH_RELEASE,
* this event will pertain to a sequence identified by
* gdk_event_get_touch_id(). With multitouch devices, there may be
* several ongoing sequences.
*/
struct _GdkEventButton
{
@@ -593,6 +737,7 @@ struct _GdkEventButton
guint button;
GdkDevice *device;
gdouble x_root, y_root;
guint touch_id;
};
/**
@@ -1036,6 +1181,7 @@ union _GdkEvent
GdkEventWindowState window_state;
GdkEventSetting setting;
GdkEventGrabBroken grab_broken;
GdkEventMultiTouch multitouch;
};
GType gdk_event_get_type (void) G_GNUC_CONST;
@@ -1100,6 +1246,10 @@ void gdk_event_set_screen (GdkEvent *event,
GdkScreen *screen);
GdkScreen *gdk_event_get_screen (const GdkEvent *event);
gboolean gdk_event_get_touch_id (const GdkEvent *event,
guint *touch_id);
cairo_region_t * gdk_event_get_touch_area (GdkEvent *event);
void gdk_set_show_events (gboolean show_events);
gboolean gdk_get_show_events (void);

View File

@@ -150,7 +150,13 @@ typedef enum
/* Following flag is set for events on the event queue during
* translation and cleared afterwards.
*/
GDK_EVENT_PENDING = 1 << 0
GDK_EVENT_PENDING = 1 << 0,
/* The following flag is set for:
* 1) touch events emulating pointer events
* 2) pointer events being emulated by a touch sequence.
*/
GDK_EVENT_POINTER_EMULATED = 1 << 1
} GdkEventFlags;
struct _GdkEventPrivate
@@ -260,6 +266,12 @@ struct _GdkWindow
gulong device_changed_handler_id;
guint num_offscreen_children;
/* Store of latest per-touch events, keys are
* GdkDevices, values are hashtables of touchID/info
*/
GHashTable *touch_event_tracker;
GList *touch_clusters;
};
#define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
@@ -275,6 +287,10 @@ GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
void _gdk_event_filter_unref (GdkWindow *window,
GdkEventFilter *filter);
void _gdk_event_set_pointer_emulated (GdkEvent *event,
gboolean emulated);
gboolean _gdk_event_get_pointer_emulated (GdkEvent *event);
void _gdk_event_emit (GdkEvent *event);
GList* _gdk_event_queue_find_first (GdkDisplay *display);
void _gdk_event_queue_remove_link (GdkDisplay *display,
@@ -318,6 +334,9 @@ gboolean _gdk_window_update_viewable (GdkWindow *window);
void _gdk_window_process_updates_recurse (GdkWindow *window,
cairo_region_t *expose_region);
gboolean _gdk_window_finish_touch_id (GdkWindow *window,
GdkDevice *device,
guint touch_id);
void _gdk_screen_close (GdkScreen *screen);

View File

@@ -145,19 +145,12 @@ _gdk_offscreen_window_create_surface (GdkWindow *offscreen,
{
cairo_surface_t *similar;
cairo_surface_t *surface;
cairo_content_t content = CAIRO_CONTENT_COLOR;
g_return_val_if_fail (GDK_IS_OFFSCREEN_WINDOW (offscreen->impl), NULL);
similar = _gdk_window_ref_cairo_surface (offscreen->parent);
if (gdk_window_get_visual (offscreen) ==
gdk_screen_get_rgba_visual (gdk_window_get_screen (offscreen)))
{
content = CAIRO_CONTENT_COLOR_ALPHA;
}
surface = cairo_surface_create_similar (similar, content, width, height);
surface = cairo_surface_create_similar (similar, CAIRO_CONTENT_COLOR_ALPHA, width, height);
cairo_surface_destroy (similar);

View File

@@ -27,6 +27,8 @@
#include "config.h"
#include "gdkrgba.h"
#include <string.h>
#include <errno.h>
#include <math.h>
/**
* SECTION:rgba_colors
@@ -71,15 +73,7 @@ G_DEFINE_BOXED_TYPE (GdkRGBA, gdk_rgba,
GdkRGBA *
gdk_rgba_copy (const GdkRGBA *rgba)
{
GdkRGBA *copy;
copy = g_slice_new (GdkRGBA);
copy->red = rgba->red;
copy->green = rgba->green;
copy->blue = rgba->blue;
copy->alpha = rgba->alpha;
return copy;
return g_slice_dup (GdkRGBA, rgba);
}
/**
@@ -109,14 +103,17 @@ gdk_rgba_free (GdkRGBA *rgba)
* - We accept mixed percentages and non-percentages in a single
* rgb() or rgba() specification.
*/
static double
parse_rgb_value (const char *str,
char **endp)
static gboolean
parse_rgb_value (const gchar *str,
gchar **endp,
gdouble *number)
{
double number;
const char *p;
number = g_ascii_strtod (str, endp);
*number = g_ascii_strtod (str, endp);
if (errno == ERANGE || *endp == str ||
isinf (*number) || isnan (*number))
return FALSE;
p = *endp;
@@ -125,12 +122,14 @@ parse_rgb_value (const char *str,
if (*p == '%')
{
*endp = (char *)(p + 1);
return CLAMP(number / 100., 0., 1.);
*number = CLAMP(*number / 100., 0., 1.);
}
else
{
return CLAMP(number / 255., 0., 1.);
*number = CLAMP(*number / 255., 0., 1.);
}
return TRUE;
}
/**
@@ -176,6 +175,7 @@ gdk_rgba_parse (GdkRGBA *rgba,
gboolean has_alpha;
gdouble r, g, b, a;
gchar *str = (gchar *) spec;
gchar *p;
if (strncmp (str, "rgba", 4) == 0)
{
@@ -220,7 +220,8 @@ gdk_rgba_parse (GdkRGBA *rgba,
/* Parse red */
SKIP_WHITESPACES (str);
r = parse_rgb_value (str, &str);
if (!parse_rgb_value (str, &str, &r))
return FALSE;
SKIP_WHITESPACES (str);
if (*str != ',')
@@ -230,7 +231,8 @@ gdk_rgba_parse (GdkRGBA *rgba,
/* Parse green */
SKIP_WHITESPACES (str);
g = parse_rgb_value (str, &str);
if (!parse_rgb_value (str, &str, &g))
return FALSE;
SKIP_WHITESPACES (str);
if (*str != ',')
@@ -240,7 +242,8 @@ gdk_rgba_parse (GdkRGBA *rgba,
/* Parse blue */
SKIP_WHITESPACES (str);
b = parse_rgb_value (str, &str);
if (!parse_rgb_value (str, &str, &b))
return FALSE;
SKIP_WHITESPACES (str);
if (has_alpha)
@@ -251,13 +254,24 @@ gdk_rgba_parse (GdkRGBA *rgba,
str++;
SKIP_WHITESPACES (str);
a = g_ascii_strtod (str, &str);
a = g_ascii_strtod (str, &p);
if (errno == ERANGE || p == str ||
isinf (a) || isnan (a))
return FALSE;
str = p;
SKIP_WHITESPACES (str);
}
if (*str != ')')
return FALSE;
str++;
SKIP_WHITESPACES (str);
if (*str != '\0')
return FALSE;
if (rgba)
{
rgba->red = CLAMP (r, 0, 1);

448
gdk/gdktouchcluster.c Normal file
View File

@@ -0,0 +1,448 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2011 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "gdktouchcluster.h"
#include "gdkintl.h"
/**
* SECTION:touchcluster
* @Short_description: Multitouch handling
* @Title: Multitouch
* @See_also: #GdkEventMultiTouch
*
* #GdkTouchCluster is an object that gathers touch IDs from a
* #GdkDevice, in order to send #GdkEventMultiTouch events
* whenever a touch ID that is contained in the cluster sends
* an event.
*
* #GdkTouchCluster<!-- -->s are always associated to a window,
* you need to create them through gdk_window_create_touch_cluster(),
* and free them through gdk_window_remove_touch_cluster().
*
* Touch IDs from devices can be obtained from %GDK_TOUCH_PRESS,
* %GDK_TOUCH_MOTION or %GDK_TOUCH_RELEASE events through
* gdk_event_get_touch_id(), and then be added via
* gdk_touch_cluster_add_touch(). Note that touch IDs are
* very transient, and they must be dealt with as such.
* touch IDs must not be stored after a GDK_TOUCH_RELEASE,
* and should always be retrieved from the events being
* currently received.
*
* <example>
* <title>Adding touch IDs to a cluster in a GTK+ widget</title>
* <programlisting>
* static gboolean
* widget_button_press (GtkWidget *widget,
* GdkEvent *event)
* {
* guint touch_id;
*
* if (gdk_event_get_touch_id (event, &touch_id))
* {
* /<!-- -->* It is a touch event, delegate processing
* * to the multitouch event handler
* *<!-- -->/
* gdk_touch_cluster_add_touch (priv->touch_cluster, touch_id);
* return TRUE;
* }
*
* /<!-- -->* Normal button processing *<!-- -->/
* ...
* }
* </programlisting>
* </example>
*
* Anytime a touch ID is within a cluster, no %GDK_TOUCH_PRESS,
* %GDK_TOUCH_MOTION or %GDK_TOUCH_RELEASE events will happen
* for the individual touch. The event will be available instead
* as part of the #GdkMultitouchEvent that will be emitted. This
* will hold true until gdk_touch_cluster_remove_touch() is
* called for it. Note that GTK+ will automatically take a
* touch ID out of any cluster if %GDK_TOUCH_RELEASE is gotten
* internally.
*
* <example>
* <title>Typical multitouch event handler</title>
* <programlisting>
* static gboolean
* widget_multitouch_event (GtkWidget *widget,
* GdkEvent *event)
* {
* if (event->type == GDK_MULTITOUCH_ADDED ||
* event->type == GDK_MULTITOUCH_REMOVED)
* {
* /<!-- -->* Update control mode based
* * on the current number of touches
* *<!-- -->/
* priv->control_mode = update_control_mode (event->multitouch.n_events);
* }
* else
* {
* /<!-- -->* A touch ID in the cluster has updated
* * its coordinates, update widget based on the
* * current control mode.
* *<!-- -->/
* update_view (widget, priv->control_mode,
* event->multitouch.events,
* event->multitouch.n_events);
* }
*
* return TRUE;
* }
* </programlisting>
* </example>
*/
typedef struct GdkTouchClusterPrivate GdkTouchClusterPrivate;
struct GdkTouchClusterPrivate
{
GdkDevice *device;
GArray *touches;
};
enum {
PROP_0,
PROP_DEVICE
};
enum {
TOUCH_ADDED,
TOUCH_REMOVED,
LAST_SIGNAL
};
static guint signals [LAST_SIGNAL] = { 0 };
static void gdk_touch_cluster_finalize (GObject *object);
static void gdk_touch_cluster_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gdk_touch_cluster_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
G_DEFINE_TYPE (GdkTouchCluster, gdk_touch_cluster, G_TYPE_OBJECT)
static void
gdk_touch_cluster_class_init (GdkTouchClusterClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gdk_touch_cluster_finalize;
object_class->get_property = gdk_touch_cluster_get_property;
object_class->set_property = gdk_touch_cluster_set_property;
g_object_class_install_property (object_class,
PROP_DEVICE,
g_param_spec_object ("device",
P_("Device"),
P_("Device attached to the cluster"),
GDK_TYPE_DEVICE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
signals[TOUCH_ADDED] =
g_signal_new (g_intern_static_string ("touch-added"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkTouchClusterClass, touch_added),
NULL, NULL,
g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
signals[TOUCH_REMOVED] =
g_signal_new (g_intern_static_string ("touch-removed"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkTouchClusterClass, touch_removed),
NULL, NULL,
g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
g_type_class_add_private (object_class, sizeof (GdkTouchClusterPrivate));
}
static void
gdk_touch_cluster_init (GdkTouchCluster *cluster)
{
GdkTouchClusterPrivate *priv;
priv = cluster->priv = G_TYPE_INSTANCE_GET_PRIVATE (cluster,
GDK_TYPE_TOUCH_CLUSTER,
GdkTouchClusterPrivate);
priv->touches = g_array_new (FALSE, FALSE, sizeof (guint));
}
static void
gdk_touch_cluster_finalize (GObject *object)
{
GdkTouchClusterPrivate *priv;
priv = GDK_TOUCH_CLUSTER (object)->priv;
g_array_free (priv->touches, TRUE);
G_OBJECT_CLASS (gdk_touch_cluster_parent_class)->finalize (object);
}
static void
gdk_touch_cluster_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_DEVICE:
gdk_touch_cluster_set_device (GDK_TOUCH_CLUSTER (object),
g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gdk_touch_cluster_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GdkTouchClusterPrivate *priv;
priv = GDK_TOUCH_CLUSTER (object)->priv;
switch (prop_id)
{
case PROP_DEVICE:
g_value_set_object (value, priv->device);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/**
* gdk_touch_cluster_add_touch:
* @cluster: a #GdkTouchCluster
* @touch_id: a touch ID from a touch event
*
* Adds a touch ID to @cluster, so it will generate a
* %GDK_MULTITOUCH_ADDED event, followed by %GDK_MULTITOUCH_UPDATED
* events whenever this touch ID is updated.
*
* If @touch_id already pertained to another #GdkTouchCluster, it
* will be removed from it, generating a %GDK_MULTITOUCH_REMOVED
* for that another cluster.
*
* Since: 3.4
**/
void
gdk_touch_cluster_add_touch (GdkTouchCluster *cluster,
guint touch_id)
{
GdkTouchClusterPrivate *priv;
gint i;
g_return_if_fail (GDK_IS_TOUCH_CLUSTER (cluster));
priv = cluster->priv;
for (i = 0; i < priv->touches->len; i++)
{
if (touch_id == g_array_index (priv->touches, guint, i))
return;
}
g_array_append_val (priv->touches, touch_id);
g_signal_emit (cluster, signals [TOUCH_ADDED], 0, touch_id);
}
/**
* gdk_touch_cluster_remove_touch:
* @cluster: a #GdkTouchCluster
* @touch_id: a touch ID from a touch event
*
* Removes a touch ID from @cluster, generating a %GDK_MULTITOUCH_REMOVED
* event for @cluster, and causing any further input from @touch_id
* to be reported trough %GDK_TOUCH_MOTION events.
*
* <note><para>
* Note that GTK+ automatically removes a touch ID from any cluster
* if a %GDK_TOUCH_RELEASE event is gotten internally.
* </para></note>
*
* Since: 3.4
**/
void
gdk_touch_cluster_remove_touch (GdkTouchCluster *cluster,
guint touch_id)
{
GdkTouchClusterPrivate *priv;
gint i;
g_return_if_fail (GDK_IS_TOUCH_CLUSTER (cluster));
priv = cluster->priv;
for (i = 0; i < priv->touches->len; i++)
{
if (touch_id == g_array_index (priv->touches, guint, i))
{
g_array_remove_index_fast (priv->touches, i);
g_signal_emit (cluster, signals [TOUCH_REMOVED], 0, touch_id);
return;
}
}
}
/**
* gdk_touch_cluster_remove_all:
* @cluster: a #GdkTouchCluster
*
* Removes all touch IDs from @cluster.
*
* Since: 3.4
**/
void
gdk_touch_cluster_remove_all (GdkTouchCluster *cluster)
{
GdkTouchClusterPrivate *priv;
guint touch_id;
gint i;
g_return_if_fail (GDK_IS_TOUCH_CLUSTER (cluster));
priv = cluster->priv;
for (i = priv->touches->len - 1; i >= 0; i--)
{
touch_id = g_array_index (priv->touches, guint, i);
g_signal_emit (cluster, signals [TOUCH_REMOVED], 0, touch_id);
g_array_remove_index_fast (priv->touches, i);
}
}
/**
* gdk_touch_cluster_get_touches:
* @cluster: a #GdkTouchCluster
* @length: return location for the number of touches returned
*
* Returns the list of touches as an array of @guint.
*
* Returns: (transfer full) (array zero-terminated=0 length=length) (element-type uint): A list of touch IDs.
*
* Since: 3.4
**/
guint *
gdk_touch_cluster_get_touches (GdkTouchCluster *cluster,
gint *len)
{
GdkTouchClusterPrivate *priv;
g_return_val_if_fail (GDK_IS_TOUCH_CLUSTER (cluster), NULL);
priv = cluster->priv;
if (len)
*len = (gint) priv->touches->len;
return g_memdup (priv->touches->data,
sizeof (guint) * priv->touches->len);
}
/**
* gdk_touch_cluster_get_n_touches:
* @cluster: a #GdkTouchCluster
*
* Returns the number of touches contained in @cluster.
*
* Returns: The number of touches.
*
* Since: 3.4
**/
gint
gdk_touch_cluster_get_n_touches (GdkTouchCluster *cluster)
{
GdkTouchClusterPrivate *priv;
g_return_val_if_fail (GDK_IS_TOUCH_CLUSTER (cluster), 0);
priv = cluster->priv;
return (gint) priv->touches->len;
}
/**
* gdk_touch_cluster_set_device:
* @cluster: a #GdkTouchCluster
* @device: a #GdkDevice
*
* Sets the current device associated to @cluster, all contained
* touch IDs must pertain to this device. As a consequence,
* gdk_touch_cluster_remove_all() will be called on @cluster
* if the current device changes.
*
* Since: 3.4
**/
void
gdk_touch_cluster_set_device (GdkTouchCluster *cluster,
GdkDevice *device)
{
GdkTouchClusterPrivate *priv;
g_return_if_fail (GDK_IS_TOUCH_CLUSTER (cluster));
g_return_if_fail (!device || GDK_IS_DEVICE (device));
priv = cluster->priv;
if (priv->device != device)
gdk_touch_cluster_remove_all (cluster);
priv->device = device;
}
/**
* gdk_touch_cluster_get_device:
* @cluster: a #GdkTouchCluster
*
* Returns the slave/floating device this touch cluster pertains to,
* only touch IDs from this device can be included in @cluster.
* the #GdkDevice will typically have the %GDK_SOURCE_TOUCH input source.
*
* Returns: (transfer none): The #GdkDevice generating the contained touch IDs
*
* Since: 3.4
**/
GdkDevice *
gdk_touch_cluster_get_device (GdkTouchCluster *cluster)
{
GdkTouchClusterPrivate *priv;
g_return_val_if_fail (GDK_IS_TOUCH_CLUSTER (cluster), NULL);
priv = cluster->priv;
return priv->device;
}

71
gdk/gdktouchcluster.h Normal file
View File

@@ -0,0 +1,71 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2011 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GDK_TOUCH_CLUSTER_H__
#define __GDK_TOUCH_CLUSTER_H__
#include <glib-object.h>
#include <gdk/gdkdevice.h>
G_BEGIN_DECLS
#define GDK_TYPE_TOUCH_CLUSTER (gdk_touch_cluster_get_type ())
#define GDK_TOUCH_CLUSTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_TOUCH_CLUSTER, GdkTouchCluster))
#define GDK_IS_TOUCH_CLUSTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_TOUCH_CLUSTER))
typedef struct _GdkTouchCluster GdkTouchCluster;
typedef struct _GdkTouchClusterClass GdkTouchClusterClass;
struct _GdkTouchCluster
{
GObject parent_instance;
gpointer priv;
};
struct _GdkTouchClusterClass
{
GObjectClass parent_class;
void (* touch_added) (GdkTouchCluster *cluster,
guint touch_id);
void (* touch_removed) (GdkTouchCluster *cluster,
guint touch_id);
gpointer padding[16];
};
GType gdk_touch_cluster_get_type (void) G_GNUC_CONST;
void gdk_touch_cluster_add_touch (GdkTouchCluster *cluster,
guint touch_id);
void gdk_touch_cluster_remove_touch (GdkTouchCluster *cluster,
guint touch_id);
void gdk_touch_cluster_remove_all (GdkTouchCluster *cluster);
guint * gdk_touch_cluster_get_touches (GdkTouchCluster *cluster,
gint *length);
gint gdk_touch_cluster_get_n_touches (GdkTouchCluster *cluster);
void gdk_touch_cluster_set_device (GdkTouchCluster *cluster,
GdkDevice *device);
GdkDevice * gdk_touch_cluster_get_device (GdkTouchCluster *cluster);
G_END_DECLS
#endif /* __GDK_TOUCH_CLUSTER_H__ */

View File

@@ -350,6 +350,7 @@ typedef enum
* @GDK_SUBSTRUCTURE_MASK: receive events about window configuration changes of
* child windows
* @GDK_SCROLL_MASK: receive scroll events
* @GDK_TOUCH_MASK: receive (multi)touch events
* @GDK_ALL_EVENTS_MASK: the combination of all the above event masks.
*
* A set of bit-flags to indicate which events a window is to receive.
@@ -365,6 +366,13 @@ typedef enum
* some of which are marked as a hint (the is_hint member is %TRUE).
* To receive more motion events after a motion hint event, the application
* needs to asks for more, by calling gdk_event_request_motions().
*
* If %GDK_TOUCH_MASK is enabled, the window will receive (multi)touch events
* from touch-enabled devices. Those will come as sequences #GdkEventMotion
* with type %GDK_TOUCH_MOTION, enclosed by 2 #GdkEventButton events with
* type %GDK_TOUCH_PRESS / %GDK_TOUCH_RELEASE. gdk_event_get_touch_id() will
* return the touch ID on those events, so different sequences may be
* distinguished.
*/
typedef enum
{
@@ -389,7 +397,8 @@ typedef enum
GDK_PROXIMITY_OUT_MASK = 1 << 19,
GDK_SUBSTRUCTURE_MASK = 1 << 20,
GDK_SCROLL_MASK = 1 << 21,
GDK_ALL_EVENTS_MASK = 0x3FFFFE
GDK_TOUCH_MASK = 1 << 22,
GDK_ALL_EVENTS_MASK = 0x3FFFFF
} GdkEventMask;
/**

File diff suppressed because it is too large Load Diff

View File

@@ -33,6 +33,7 @@
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdktouchcluster.h>
G_BEGIN_DECLS
@@ -657,6 +658,7 @@ void gdk_window_set_startup_id (GdkWindow *window,
const gchar *startup_id);
void gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent);
GDK_DEPRECATED_FOR(gdk_window_set_background_rgba)
void gdk_window_set_background (GdkWindow *window,
const GdkColor *color);
void gdk_window_set_background_rgba (GdkWindow *window,
@@ -877,6 +879,12 @@ void gdk_window_set_support_multidevice (GdkWindow *window,
gboolean support_multidevice);
gboolean gdk_window_get_support_multidevice (GdkWindow *window);
/* Multitouch support */
GdkTouchCluster * gdk_window_create_touch_cluster (GdkWindow *window,
GdkDevice *device);
void gdk_window_remove_touch_cluster (GdkWindow *window,
GdkTouchCluster *cluster);
G_END_DECLS
#endif /* __GDK_WINDOW_H__ */

View File

@@ -180,7 +180,7 @@ create_builtin_cursor (GdkCursorType cursor_type)
cursor = gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_CURSOR_IS_PIXMAP);
cached_xcursors[cursor_type] = gdk_cursor_ref (cursor);
cached_xcursors[cursor_type] = g_object_ref (cursor);
GDK_QUARTZ_RELEASE_POOL;
@@ -243,7 +243,7 @@ _gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
case GDK_BLANK_CURSOR:
return create_blank_cursor ();
default:
return gdk_cursor_ref (create_builtin_cursor (cursor_type));
return g_object_ref (create_builtin_cursor (cursor_type));
}
[nscursor retain];

View File

@@ -308,8 +308,7 @@ gdk_quartz_display_finalize (GObject *object)
{
GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (object);
g_list_foreach (display_quartz->input_devices, (GFunc) g_object_unref, NULL);
g_list_free (display_quartz->input_devices);
g_list_free_full (display_quartz->input_devices, g_object_unref);
G_OBJECT_CLASS (gdk_quartz_display_parent_class)->finalize (object);
}

View File

@@ -963,6 +963,13 @@ fill_key_event (GdkWindow *window,
event->key.state |= _gdk_quartz_events_get_current_mouse_modifiers ();
/* The X11 backend adds the first virtual modifier MOD2..MOD5 are
* mapped to. Since we only have one virtual modifier in the quartz
* backend, calling the standard function will do.
*/
gdk_keymap_add_virtual_modifiers (gdk_keymap_get_for_display (_gdk_display),
&event->key.state);
event->key.string = NULL;
/* Fill in ->string since apps depend on it, taken from the x11 backend. */

Some files were not shown because too many files have changed in this diff Show More