Compare commits

..

12 Commits

Author SHA1 Message Date
Matthias Clasen
e867944a5a Add a css style test for currentColor 2015-12-29 07:47:58 -05:00
Matthias Clasen
20eaea2b2d Add a css style test for inherit and initial 2015-12-29 07:47:58 -05:00
Matthias Clasen
79f383ab19 Add a css style test for :first/last/only-child 2015-12-29 07:47:58 -05:00
Matthias Clasen
ff9e589402 Add a css style test for font inheritance 2015-12-29 07:47:58 -05:00
Matthias Clasen
054e21afae Add a test framework for CSS styles
This uses the same function for dumping CSS nodes and styles
as the CSS node test. It can be used to test aspects of inheritance
and matching, as well as initial values.

No actual tests yet.
2015-12-29 07:46:31 -05:00
Matthias Clasen
9af17de76b Add CSS node tests for levelbars 2015-12-29 07:46:31 -05:00
Matthias Clasen
0f95ff74b8 Add CSS node test for progressbars 2015-12-29 07:46:30 -05:00
Matthias Clasen
fdd984f55c Add a CSS node test for buttons 2015-12-29 07:46:30 -05:00
Matthias Clasen
e13894396d Add a CSS node test for entries 2015-12-29 07:46:30 -05:00
Matthias Clasen
2fc7ecc3df Add a CSS node test for notebooks 2015-12-29 07:46:30 -05:00
Matthias Clasen
a3aeef3760 Add a test framework for CSS nodes
No actual tests yet.
2015-12-29 07:46:30 -05:00
Matthias Clasen
1535e22344 Add a function to dump CSS nodes and styles
Add a gtk_style_context_to_string function that can serialize
a CSS node or tree of nodes, optionally including CSS properties
as well.

This will be useful in writing tests.
2015-12-29 07:46:30 -05:00
1254 changed files with 134782 additions and 173606 deletions

719
NEWS
View File

@@ -1,719 +1,3 @@
Overview of Changes in GTK+ 3.20.7
==================================
* Bugs fixed:
118959 GtkScale value '-0'
674215 regression with updating tooltips
708148 gtk_tree_view_get_path_at_pos mistakenly identifies column of ini...
745622 Selected text not highlighted in GtkInfoBar
747206 gtktextview: note on how to get line spacing between two paragraphs
764060 opening a second nautilus while a delete operation is in progress...
764203 Default background color for the 'textview border' node
765924 Improve external drives detection
766120 Scale draw_value() align changed from centre/right (H/V) to lefti...
766122 Re-used filechooser displays $pwd half of the time when shown
766341 Do not rely on memfd as it requires a fairly recent kernel
766643 Frozen windows when unmapped with pending configure event
766782 OpenGL in broadway leads to segmentation fault
767058 GtkInfoBar: right-click/context menu all white
767468 Popover over a treeview cellrenderer is hidden immediately after ...
767705 GtkActionHelper: Change a message to a warning
767766 CUPS 2.X detected incorrectly by configure
767795 Warning when the "accelerator" property of GtkShortcutsShortcut ...
767848 crash in the window test
767851 Adwaita: popover arrows broken in some orientations
768016 [Wayland] Submenus often get closed after ~2 seconds
768025 entry.warning & entry.error broken
768082 wayland: copying from Wayland to NEdit (Xwayland/Motif) doesn't work
768142 Incorrect order of $(LIBS) and $(OBJS) in Makefile.example caused...
768177 CLIPBOARD target request after PRIMARY request times out. GDK_SEL...
768485 Change the priority of the window-close idle to G_PRIORITY_DEFAULT
768657 places-view: fix open action for locations without a mount or volume
768930 reftests: override GSETTINGS_SCHEMA_DIR when running tests
769003 Adwaita: GtkCalendar uses a confusing style for week of year
769047 GtkWidget <-> GtkStyleContext API not clear
* Translation updates:
Indonesian
Norwegian bokmål
Overview of Changes in GTK+ 3.20.6
==================================
* Bugs fixed:
766694 crash on save as in any gtk3 application starting 3.20.5...
766323 GTKPopover gives warnings if visible when reparented
766336 Crash when selecting rows with rubberbanding
766737 stack: Only map children when necessary
* Translation updates:
Arabic
Overview of Changes in GTK+ 3.20.5
==================================
* Bugs fixed:
763852 gdk/wayland: event source is not multi-thread aware
765973 GtkRevealer need to always send "child-revealed" signal...
766175 Translation of quotes may misinterpreted by GTK sidebar
766233 Crash when server does not support XI2
766440 Scale slider button has stopped discerning & rendering...
766442 Broken drag & drop between windows
* Translation updates:
Kazakh
Portuguese
Overview of Changes in GTK+ 3.20.4
==================================
* Bugs fixed:
573380 gtk_tree_model_iter_parent() fails if the same iterator is used for...
620065 Several problems related to recent files
693077 GtkRecentManager doesn't send "changed" when file is deleted
749405 GtkMenuSectionBox doesn't remove submenus when parent item is removed
761651 [Wayland] glade previewer is resizing windows until it crashes gnom...
762756 keyboard focus problem on dismiss of menus under wayland
763768 Wrong margin used for the sidebar separator
764395 nautilus crashed on double clicking 'other locations'
764424 `Super` keybindings trigger without Super, on Wayland
764585 Fix "format not a string literal" errors
764825 [WAYLAND] Fn key resets scrolling
764846 Code improvements in GtkApplication
765038 Adwaita & decorations
765065 Wayland: Hover state stuck after mouse leaving the toplevel
765066 GtkColorChooser looks like it can select multiple colors
765122 Duplicate/missing string in gtkprintbackendcups
765213 info bars nearly unreadable in backdrop state because of gray font ...
765238 gtktexthandle should avoid connecting to GtkWidget::draw
765261 listbox: Page up/Down don't do anything with large rows
765270 wayland: Leave existing mods on map_virtual_modifiers
765284 debug: reduce runtime overhead in debug builds
765471 CellRendererText shows edit entry in a wrong position for small cells
765474 Wayland: Dialogs without transient parent crash the inspector
765486 builtinicon: avoid calculating font-metrics in vast majority of cases
765493 kineticscrolling: avoid stutter at tail of kinetic deceleration
765496 Clean up gtklabel.c a bit
765565 Wayland: Inspector GtkLabel drag'n'drop crashes client
765567 wayland: avoid jitter in keyboard repeat
765592 frametimings: reuse previous frame timing in common case
765640 pixelcache: reuse existing timeout source when possible
765644 Widget sizing problems with GtkProgressBar
765742 GtkRedioButton and GtkCheckButton doesn't aligned right to left lan...
765790 W32: configure does not tell which cairo version to use
765907 [Wayland] Reversed scrolling GDK_SCROLL_UP/GDK_SCROLL_DOWN in Wayland
765922 GtkScale labels extend past edge of widget and overlap neighboring ...
765981 fts warning from tracker when searching for files with "-" in name
766166 key bindings in gtk.css are ignored
* Translation uypdates:
Brazilian Portuguese
Latvian
Polish
Traditional Chinese
Overview of Changes in GTK+ 3.20.3
==================================
* Bugs fixed:
764174 Configuration dialog is too small
764203 Default background color for the 'textview border' node
764204 Primary and secondary carets/cursors not distinguishable by default
764261 gtkplacesviewrow: untranslated "%s / %s available"
764374 Busy loop while "Displays" page is active
764378 gtk3-demo won't run without hicolor-icon-theme
764540 gtk_scrollable_get_border is missing annotations
764585 Fix "format not a string literal" errors
764686 build failure after "make distclean"
764710 GtkListBox row CSS nodes do not reflect visual order
764835 broadway: fix documentation, correct display port details
764664 Segfault when initializing WINTAB pressure-sensitive tablets
* Translation updates:
Bulgarian
Esperanto
Greek
Norwegian bokmål
Persian
Overview of Changes in GTK+ 3.20.2
==================================
* Fix blue background in Emacs windows
* Fix a performance issue with excessive redraws
* Bugs fixed:
763627 menu-traditional puts popover beneath the text editor widget
763783 GDK W32: Erase hidden layered windows before showing them
763851 GDK W32: show_window_menu() is not implemented
764022 Negative content width -200 (allocation -200, extents 0x0) while...
764170 [HighContrastInverse] “suqqested-action” is white on lightgrey
764210 Strange Background Color on Emacs
764321 window: Fix gtk_window_set_geometry_hints documentation
764376 UI glitch when entering keyboard shortcut
* Translation updates:
Dutch
German
Italian
Lithuanian
Serbian
Thai
Overview of Changes in GTK+ 3.20.1
==================================
* Active GtkSwitch widgets now use the :checked state, to match GtkToggleButton
* Bugs fixed:
641354 Look for themes in XDG folders
763350 drawing performance worse than X
763604 The search button of a GtkShortcutsWindow should have the image-button...
763659 DND Drop on root with Pixbuf leaves image behind
763731 Return GTK_PRINT_OPERATION_RESULT_ERROR even if error == NULL
763741 Wavy/squiggly underline not properly removed
763758 Do not use fixed values for widgets size in foreign drawing demo
763779 [PATCH] quartz: fix pixelated image surfaces in retina/hidpi mode
763802 [HighContrastInverse] the “ON” text of a GtkSwitch should be black (on...
763804 [HighContrastInverse] menuitem:hover colors
763808 .dnd styleclass still used
763859 gdkdevice-wayland.c cleanups
763900 stack: fix warnings during GtkStack size_allocate
764118 Glitches in menu scroll arrow rendering
* Translation updates:
Basque
Bulgarian
Danish
Galician
Greek
Russian
Slovak
Slovenian
Spanish
Swedish
Overview of Changes in GTK+ 3.20.0
==================================
* Themes:
- The HighContrast theme has been brought back up to par with Adwaita
- Adwaita has received detail fixes for many widgets
- Adwaita now transitions to backdrop
* Some recently publicized static analysis findings have been fixed
* Bugs fixed:
746490 [HighContrast] insensitive ToggleButtons are rendered similarly ac...
763609 [HighContrast] model-generated menu-like popovers are unthemed
763610 [HighContrast] GtkSearchEntrys “search” icon needs left&right pad...
763612 [HighContrast] “:selected .circular” should be visible
763613 [HighContrast] GtkScale is unreadable
763696 [HighContrast] spinbuttons broken
763706 [HighContrast] linked horizontal dropboxes broken
763707 [HighContrast] active and hover states for radios and checkboxes b...
763774 [HighContrast] GtkPlacesSidebar row need more top&bottom padding
763775 [HighContrast] the “enter server adress” entry in GtkPlacesView ha...
763777 [HighContrast] GtkMenuBar needs a bottom box-shadow
763781 [HighContrast] .app-notification border { border:none; }
763797 [HighContrast] scrollbars invisible (whity on white)
763823 [HighContrast] dnd on a vertical spinbutton does a weird resizing
763846 [HighContrast] spinbuttons in osd look bad
763955 treeview: inline editing shows old text as background
763796 excessive Gtk-WARNING **: State 0 for EMailShellSidebar doesn't ma...
763835 W32: Layered windows don't become minimized
763749 Nautilus desktop window is too small with gtk 3.19
* Translation updates
Brazilian Portuguese
Czech
Danish
Finnish
Hungarian
Italian
Kazakh
Korean
Latvian
Serbian
Serbian Latin
Swedish
Ukrainian
Overview of Changes in GTK+ 3.19.12
===================================
* GTK+ now respects default size even for windows that are not resizable
* GtkScale and GtkScrollbar have received multiple fixes for fallout from
the gadget port
* GtkStackSwitcher will now switch pages when hovered during drag-and-drop
* Inspector:
- The per-object CSS editor has been dropped; the global one is sufficient
- The sidebar has been replaced by a combo box
- Add a Show Layout option to the Visual tab
- CSS node tree and style properties are now on the same page
- The frame clock is shown in the Miscellaneous page
- Isolate the inspector from visual debugging effects
- Numerous smaller UI improvements
* Themes:
- Windows theme: handle spin buttons and switches
- Adwaita: Fixes for scales, combo boxes, info bars, action bars, radio and
check buttons, side bars, etc
- Adwaita has gained a new style of drop target highlighting
* Wayland:
- Synchronize key repeat with server
- Add a bell request to gtk_shell and use it to implement gdk_window_beep
- Add a focus request to gtk_shell and use it to implement gtk_window_present
- Dropping tabs to create new windows is now supported
* Windows:
- Use a custom drag-resize implementation
- Use layered windows
- Provide workarea information
* OS X:
- Native zoom and rotate gestures are now supported
* Bug fixes:
583780 gtk_toggle_button_set_mode() documentation should suggest when it is...
699891 Support for Primary keybinding in builder XML
720950 Default double-click interval should be increased
748872 W32: Use layered windows
756450 GTK file chooser completion dropdown sets cursor in wrong position
757942 Input event (e. g. typing on keyboard) is sent repeatedly during hig...
759899 W32: CSD is not enabled by default
760276 Quartz does not support GtkGesture Zoom and Rotate (NSEventTypeMagni...
761629 W32: WM window drag-resizing code does not work well with GTK
762397 GtkToolButton needs left & right padding and margin
762811 Adwaita: nonsquare image buttons
762820 Remove "core_pointer" from the GdkDisplay struct
762891 gdk: remove the display->list_devices vfunc
762902 GDK W32: Newly-opened windows (such as popups) have unthemed cursor
762907 gnome-shell crashes after undocking
762945 Wrong allignemet in some places
762974 GtkWindow: gtk_window_set_default_size() does not work with fixed si...
762996 Revealer doesn't reveal the entire width of a ListBox that has Revea...
763001 implement beeping
763012 GDK W32: No gdk_win32_screen_get_monitor_workarea()
763017 tooltip text is not shown
763023 Segfault in init_randr15()
763080 Layered Window crashes GDKGLWin32
763103 gtk-launch: add hack to close up dbus-daemon race
763216 GtkTextView's top-margin/bottom-margin don't work with non-scrolling...
763285 gdkwindow/Win32: Make update_style_bits() available across the GDK-W...
763287 GDK-Win32: GL area does not redraw on resize
763298 wayland: connection flooded when dragging
763351 [wayland] high cpu usage on open popover
763380 colorscale input popup difficult to use with a pointer
763387 Make window creation hooks in tab DnD work on wayland
763628 W32: Shortcuts window is gtk3-demo misplaced on multidisplay desktop
763650 window: stop stomping on resize-mode set by external API
* Translation updates:
Brazilian Portuguese
Catalan
Czech
Finnish
French
Galician
German
Greek
Hebrew
Hungarian
Japanese
Kazakh
Korean
Lithuanian
Polish
Russian
Serbian
Slovak
Slovenian
Spanish
Swedish
Overview of Changes in GTK+ 3.19.11
===================================
* GtkRange, GtkScale and GtkScrollbar have been ported to use gadgets
* Themes:
- Windows theme improvements
* Inspector:
- Show input device information
- Update monitor information when it changes
* Wayland:
- Implement primary selection (using a private protocol
with mutter for now)
* Bugs fixed:
756751 Keypad decimal point patch prevents entry of comma in german keypad...
760482 GtkFrame cuts off bottom 2 pixels of child
761767 gcc6: Don't return bool from a const gchar* function
762123 Frame Layouting issue in Quadrapassel
762561 Implement primary selection protocol
762593 Solid separator in gnome-tweak-tool header bar
762614 Commit 51af704 gadget: Be careful in geometry calculations breaks v...
762629 GDK W32: Wrong MINMAXINFO calculation
762677 gtkplacessidebar: avoid irresponsible UI while trashing
762713 [Wayland] GDK doesn't remember unmaximized or unfullscreen size
762720 Moving Epiphany tabs with keyboard shortcuts visually broken
762755 Epiphany, Eye of GNOME crash when run in gdkwindow-wayland.c buffer...
762820 Remove "core_pointer" from the GdkDisplay struct
762887 yelp crashes most of the time on startup with gtk+ 3.19.10
762891 gdk: remove the display->list_devices vfunc
761156 Setting a popover 'relative_to' a widget on an offscreen window cra...
761686 GtkTreeView theming problems
762468 wayland: Switching between fullscreen and unfullscreen too fast may...
* Translation updates:
Brazilian Portuguese
Catalan
French
Galician
Hungarian
Occitan
Polish
Swedish
Overview of Changes in GTK+ 3.19.10
===================================
* GTK+ will now list included backends when seeing the
environment variable GDK_BACKEND=help
* Themes
- Windows theme improvements
- Adwaita cleanups
* Wayland
- Implement startup notification
* Bugs fixed:
309300 Adjust the key binding for setting the spin box's value to the min...
723659 touchpad: please do not interpret tap and click as double-click
754743 Middle click on "Other Locations" doesn't open a new tab
756659 Nautilus's Connect to server wont honor remote path
760714 GtkWindow: CSS node documentation is not clear
761431 Document overlay help action name
761432 Document that GtkApplication loads menus from gtk/menus-common.ui
761760 Welcome graphic and heading is misaligned
762258 wayland: gtk3 apps segfault with plasma-wayland/kwin_wayland
762315 Assistant pages have no padding which looks weird
762319 issues with randr 1.5
762392 gtk_drag_source_set_icon_name with empty string puts widget in bad...
* Translation updates:
Brazilian Portuguese
Catalan
Chinese (Taiwan)
Galician
German
Polish
Punjabi
Serbian
Slovak
Spanish
Swedish
Thai
Overview of Changes in GTK+ 3.19.9
==================================
* gtk-builder-tool can now preview .ui files with custom CSS
* gtk3-demo now demonstrates saving window sizes in the application
example, and has many more widgets in the foreign drawing example.
* CSS changes:
- the rem unit is now supported
- calc() expressions are supported, too
* Themes:
- Many fixes to Adwaita
- The Windows theme is now included on all platforms
* Windows
- The Classic and XP themes have been dropped
- The remaining theme is being fixed to work with CSS nodes
- React to theme changes
* Quartz:
- Fix image retrieval from the clipboard
* Wayland:
- Fix a significant buffer leak
* Bugs fixed:
677329 Missing focus-in events
698652 Aero-snapped windows in Win7 or 8 gets restored to previous size...
754990 Missing (out) annotation for gdk_rgba_parse
759657 GtkSeparator can segfault from CSS settings
760996 background in notebooks (and other places?) now white
761209 FileChooser crashes when invoked from FileChooserButton
761309 Background missing for empty treeview
761312 memory leak
761332 Creating a GtkStyleContext crashes
761339 [PATCH] skip gtk_widget_path_iter_add_qclass from g-ir-scanner
761363 Unlabeled GtkCheckButton does not respect valign
761381 gtk_settings_reset_property does not always reset to correct value
761402 GtkRange doesn't reset in_drag flag correctly
761428 GtkLevelBar no longer expands vertically
761474 x11: Scaling factor is applied twice on screen work area
761476 Set _GTK_THEME_VARIANT property also for light theme variant
761484 Spinbuttons in headerbars are way too tall
761552 Warnings in filechooser when typing-to-search in Recent
761571 Opaque region incorrectly calculated for fullscreen windows
761686 GtkTreeView theming problems
761716 Notebook scroll arrows appear to be sensitive always
761757 Crash in GtkFileChooserWidget
761775 gtkmagnifier: Avoid a crash if the inspected widget is finalized
761778 GtkShortcutsWindow - key labels are grey, not vertically centered
761791 Places sidebar: row height is too low
761792 Connect to server bar is too tall (and has a big fat connect butt...
761826 double negative in drag drop documentation for drag-motion confus...
761828 add a menu demo to foreigndrawing
761829 undefined reference to `gdk_mir_display_get_type'
761838 Editing widgets may be drawn off the visible area if the column i...
761900 gtk-demo: add spinbutton and menubar foreign drawing examples
761903 gtk3-demo: paned widget can be moved by resizing
761954 Tab detach no longer works
762021 GtkPaned propagates draw to NULL child
762032 Titlebars of windows have become unacceptably large in 3.19.x
762036 Extra widgets sizing messed up
762067 Adwaita: half maximized unfocused window has rounded corners
762080 gtk-demo: add combobox, menu separator and menu check/radio examp...
753351 notifications about removable devices being safe to remove stay a...
762120 Black content when using testfilechooser auto completer
762165 Add translation contexts
* Translation updates:
Brazilian Portuguese
Chinese (Taiwan)
French
German
Hungarian
Kazakh
Polish
Slovak
Spanish
Swedish
Overview of Changes in GTK+ 3.19.8
==================================
* GtkEntry:
- Complete gadget conversion for entries and spin buttons
- Add a visual hint for scrolling ('undershoot')
* GtkStack:
- Turn into a no-window widget
* CSS changes:
- Allow loading svg imges
- Fix baseline handling
- -gtk-recolor() works properly with hi-dpi now
- image() can be used in CSS now
* Themes:
- new radio / check implementation
* Tools:
- gtk-builder-tool can now preview .ui files
* Bugs fixed:
464528 gdk_rectangle_union() and gdk_rectangle_intersect() should ign...
608865 The default value of the property 'max-position' should be 214...
688524 Expose gtk-primary-button-warps-slider as an X setting
690791 gtkwindow only sends startup notification once
727294 Gtk SpinButton Size Greater than Screen Width
754868 visual anomaly in gtk path bar
754990 Missing (out) annotation for gdk_rgba_parse
760522 gtk_misc_set_padding not used for size req
760714 GtkWindow: CSS node documentation is not clear
760754 gedit crashes detaching a tab
760881 file can't be saved if executable attribute is not set
760891 GtkTreeView Cannot expand/collapse rows by mouse
760897 A few clean ups to the shm handling code
760933 Make it possible to query the CSS opacity with gtk_style_conte...
760942 gitg drawing code broken
760967 notebook gadget allocation issue
761005 GtkColorChooser: make set_rgba work in editor mode
761095 wayland: use shm_open instead of open in tmpdir
761128 Selected text in password entry not drawn correctly
761254 GtkDialog exposes public action_box internal child
761026 File chooser: Make Escape close the dialog
761318 css: Support the image() notation
* Translation updates:
German
Hungarian
Overview of Changes in GTK+ 3.19.7
==================================
* GtkNotebook:
- Has been converted to use gadgets
- Style properties have been deprecated
* GtkTextView:
- Offers (some) control over cursor blinking
* CSS changes:
- Fix rendering of asymmetric borders
- Add CSS names to more widgets
- Support recoloring icons with -gtk-recolor
* Themes:
- Many Adwaita fixes
* GTK+ widget drawing scalability has been improved (for containers
with many children, like large list boxes or flow boxes).
* Drag-and-Drop has been rearchitected to move the input handling into
GDK, where different backends can handle it according to their needs
and capabilities. The new, 'managed' DND is currently implemented
for X11 and Wayland.
* Wayland:
- Support kinetic scrolling, using the new events in version 5 of the
wl_pointer interface
- Suppport DND actions and drag cancellation that were added in version
3 of the wl_data_offer interface
* Bugs fixed:
722727 Widget state CSS pseudoclasses should work with adjacent selectors
722937 problem rendering asymmetric borders with dotted style
748327 W32: GDK can be hypothetically stuck in time
756729 No kinetic scrolling on Wayland
757503 Selected text is white on white (invisible) - Evo / GTK+ 3.19.1
759785 GdkSeat: Suspected errors in documentation
759898 W32: There's a gap between tooltip window and its shadow
760350 Cast the return value of g_array_free to void* before casting to...
760388 MS lib files cannot be generated (with patch)
760416 broadwayd --help shows translated characters as question marks o...
760427 Adwaita: Separators in popovers shouldn't always have margins
760445 regression: openQA no longer able to press ctrl-alt-del to get t...
760509 GdkWindow positions/sizes include css margins
760524 linked comboboxes change size when clicked
760525 Labels in dialog buttons misaligned
760528 GtkFrame child should start below the label widget
760536 ship a mini icon theme for recolarable symbolic icon assets
760572 Inspector highlights "random" widgets
760596 epiphany middle click on link opens an invisible tab
760615 GTK FTBFS with MinGW-w64
760640 Crash in gtk_notebook_set_show_tabs when closing Epiphany
760663 Some labels on RTL in some menus dosn't shown
760668 box gadget: Implement cross-axis alignment
760680 Emitting "shutdown" signal twice leads to a crash
760748 GtkTextView should allow hooks for reseting blink time
760754 gedit crashes detaching a tab
756729 No kinetic scrolling on Wayland
760370 GDK-ify drag and drop
* Translation updates:
Brazilian Portuguese
Finnish
Japanese
Slovak
Overview of Changes in GTK+ 3.19.6
==================================
* CSS changes:
- CSS margins, border and padding are more consistently supported
- More widgets support min-width and min-height
- More style properties have been superseded by CSS properties
- Pseudo state names have been aligned with what CSS uses:
:disabled instead of :insensitive, :indeterminate instead of
:inconsistent and :drop(active) instead of :dnd. The old names
still work
- GTK+ specific CSS properties have been prefixed with -gtk-.
The old names still work
- The CSS syntax for Radial gradients is now supported
- CSS documentation has been rewritten and expanded
* Themes:
- GTK+ now includes a HighContrastInverse theme which is a dark
variant of the HighContrast theme
* Inspector:
- The inspector can now highlight widgets that are causing resizes,
which can be helpful in tracking down allocation loops
* Wayland:
- Prefer subsurfaces for temporary windows when possible, to fix
placement issues
- Improve handling of dialogs without transient parent
- Force a grab cursor while a popup is shown
* Bugs fixed:
728344 Collate setting in Print Dialog does not override PPD setting...
753520 Gtk potentially misses nullable in 166 functions
756618 GtkWindow CSD: gtk_window_resize() also includes client side ...
757147 gdk_pixbuf_get_from_window() doesn't honor device scale
757411 Reference GtkIconSize in argument/return documentation
759161 wayland: dialog stacking without parents (RFC)
759299 wayland: possible infinite loop in gdkwindow-wayland
759541 shortcuts: Make sure that hidden shortcuts stay hidden
759567 Treeview column header buttons are jumpy
759586 Add a way to highlight resizing widgets
759607 gtkdnd-quartz: fix gtk_drag_begin_internal
759664 Buttonbox broken in chess promotion dialog
759668 Drawing failures with GTK+ master
759670 GtkPaned doesn't react to mouse dragging in some cases
759705 Sidebar broken in GNOME Disks
759738 wayland: use a subsurface for GDK_WINDOW_TEMP if attached to ...
759764 gtkinspector crashes app when selecting 'cancel' on initial p...
759768 gtkinspector crashes app on termination, when selecting 'canc...
759771 GdkSeat: Missing G_BEGIN_DECLS and G_END_DECLS
759857 Signal name should not be translated
759905 Popover: Invisible to events when we set transparent backgrounds
759917 GtkStatusIcon: avoid criticals
760018 Separator Tool Items with draw=false still get drawn
760082 GtkBinding: Use correct CSS key in examples
760097 GtkShortcutsWindow: Gestures not shown correctly in search re...
760141 New gdk_cursor_new_from_name() fallback breaks behavior expec...
760148 Duplication of word in document
760169 GtkColorButton sensitive and insensitive appearances are bare...
760188 GDK's X11 backend leaks SyncCounters
760202 gtkbuilder: Install gettext ITS files
760213 wayland: gdk_seat_grab() set cursor not resilient
760238 Improve function documentation for gtk_css_provider_load_from...
760314 gtkimcontextime.c: Silence gtk_style_context_set_state() warn...
* Translation updates:
Brazilian Portuguese
Czech
German
Hebrew
Indonesian
Norwegian bokmål
Portuguese
Slovak
Spanish
Overview of Changes in GTK+ 3.19.5
==================================
@@ -853,8 +137,7 @@ Overview of Changes in GTK+ 3.19.3
758407 Could not send the search request \ GDBus.Error:org.freedesktop.Tr...
758442 gtk_style_context_save() destroys style information
Overview of Changes in GTK+ 3.19.2
* Translation updates:
==================================
* Most widgets have been ported to CSS nodes. The element names and

View File

@@ -53,7 +53,7 @@ In the bug report please include:
of software that can be downloaded.
* If the bug was a crash, the exact text that was printed out
when the crash occurred.
when the crash occured.
* Further information such as stack traces may be useful, but
is not necessary.
@@ -72,53 +72,15 @@ and attach the patch to that bug report.
Patches should be in unified diff form. (The -up option to GNU diff)
Even better are git-formatted patches. (Use git format-patch)
Release notes for 3.20
======================
* The way theming works in GTK+ has been reworked fundamentally, to
implement many more CSS features and make themes more expressive.
As a result, custom CSS that is shipped with applications and third-
party themes will need adjustments. Widgets now use element names much
more than style classes; type names are no longer used in style matching.
Every widget now documents the element names it has and the style classes
it uses. The GTK+ inspector can also help with finding this information.
* GTK+ now uses internal subobjects (also known as gadgets) for allocating
and drawing widget parts. Applications that subclass GTK+ widgets may see
warnings if they override the size_allocate vfunc and don't chain up.
The proper way to subclass is to chain up in size_allocate. If you do not
want to do that for some reason, you have to override the draw vfunc as
well.
* Several fixes for window sizing and window placement with client-side
decorations may affect applications that are saving and restoring window
sizes. The recommended best practice for this which is known to work with
client-side and server-side decorations and with older and newer versions
of GTK+ is to use gtk_window_get_size() to save window sizes and
gtk_window_set_default_size() to restore it.
See https://wiki.gnome.org/HowDoI/SaveWindowState for a detailed example.
* Geometry handling in GtkWindow has been removed. If you are using the
functions gtk_window_resize_to_geometry, gtk_window_set_default_geometry,
gtk_window_parse_geometry or gtk_window_set_geometry_hints, you may need
to make some changes to your code.
* GtkDrawingArea used to implicitly render the theme background before
calling the ::draw handler. This is no longer the case. If you rely
on having a theme-provided background, call gtk_render_background()
from your ::draw handler.
* The GtkFileChooser interface prerequisite changed from GtkWidget
* The GtkFileChooser interface pre-requisite changed from GtkWidget
to GObject, allowing non-widget implementations of this interface.
This is a minor change in ABI, as applications are no longer guaranteed
that a GtkFileChooser also supports all GtkWidget methods. However, all
previously existing implementations still derive from GtkWidget, so no
existing code should break.
* The way in which GtkLevelBar determines the offset to apply was a bit
inconsistent in the past; this has been fixed. Applications that are using
custom offsets should double-check that their levels look as expected.
This is a minor change in ABI, as apps are no longer guaranteed
that a GtkFileChooser interface also supports all GtkWidget methods.
However, all previously existing objects still derive from GtkWidget,
so no existing code should break.
Release notes for 3.18
======================

View File

@@ -1,12 +1,13 @@
include $(top_srcdir)/Makefile.decl
SUBDIRS = \
crypt \
vs9 \
vs10 \
vs11 \
vs12 \
vs14
EXTRA_DIST += replace.py
EXTRA_DIST += process-in-win32.py
-include $(top_srcdir)/git.mk

View File

@@ -0,0 +1,7 @@
include $(top_srcdir)/Makefile.decl
EXTRA_DIST += \
crypt.h \
crypt3.c
-include $(top_srcdir)/git.mk

32
build/win32/crypt/crypt.h Normal file
View File

@@ -0,0 +1,32 @@
/**************************************************************************
* Unix-like crypt(3) Algorithm for Password Encryption
*
* File : crypt3.h
* Purpose : Provides crypt(3) prototypes to ANSI C compilers
* without a need for the crypt library.
* Author : Fan, Chun-wei
* Date : June 24, 2013
*
* I am releasing the source that I have provided into public
* domain without any restrictions, warranties, or copyright
* claims of my own.
*
***************************************************************************/
#ifndef __ANSI_CRYPT_H__
#define __ANSI_CRYPT_H__
#ifdef __cplusplus
extern "C"
{
#endif
void encrypt (char *block, int edflag);
void setkey (char *key);
char* crypt (const char *key, const char *salt);
#ifdef __cplusplus
}
#endif
#endif /* __ANSI_CRYPT_H__ */

460
build/win32/crypt/crypt3.c Normal file
View File

@@ -0,0 +1,460 @@
/**************************************************************************
* Unix-like crypt(3) Algorithm for Password Encryption
*
* File : crypt3.c
* Purpose : Provides crypt(3) functionality to ANSI C compilers
* without a need for the crypt library.
* Author : Michael Dipperstein
* Date : November 3, 1998
*
***************************************************************************
* The source in this file is heavily borrowed from the crypt3.c file
* found on several ftp sites on the Internet. The original source
* claimed to be BSD, but was not distributed with any BSD license or
* copyright claims. I am releasing the source that I have provided into
* public domain without any restrictions, warranties, or copyright
* claims of my own.
*
* The code below has been cleaned and compiles correctly under, gcc,
* lcc, and Borland's bcc C compilers. A bug involving the left and
* right halves of the encrypted data block in the widely published
* crypt3.c source has been fixed by this version. All implicit register
* declarations have been removed, because they generated suboptimal code.
* All constant data has been explicitly declared as const and all
* declarations have been given a minimal scope, because I'm paranoid.
*
* Caution: crypt() returns a pointer to static data. I left it this way
* to maintain backward compatibility. The downside is that
* successive calls will cause previous results to be lost.
* This can easily be changed with only minor modifications to
* the function crypt().
**************************************************************************/
/* Initial permutation */
static const char IP[] =
{
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7,
};
/* Final permutation, FP = IP^(-1) */
static const char FP[] = {
40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25,
};
/**************************************************************************
* Permuted-choice 1 from the key bits to yield C and D.
* Note that bits 8,16... are left out:
* They are intended for a parity check.
**************************************************************************/
static const char PC1_C[] =
{
57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
};
static const char PC1_D[] =
{
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4,
};
/* Sequence of shifts used for the key schedule. */
static const char shifts[] =
{1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1};
/**************************************************************************
* Permuted-choice 2, to pick out the bits from the CD array that generate
* the key schedule.
**************************************************************************/
static const char PC2_C[] =
{
14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2,
};
static const char PC2_D[] =
{
41, 52, 31, 37, 47, 55,
30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32,
};
/* The C and D arrays used to calculate the key schedule. */
static char C[28];
static char D[28];
/* The key schedule. Generated from the key. */
static char KS[16][48];
/* The E bit-selection table. */
static char E[48];
static const char e2[] =
{
32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1,
};
/**************************************************************************
* Function: setkey
*
* Description: Set up the key schedule from the encryption key.
*
* Inputs: char *key
* pointer to 64 character array. Each character represents a
* bit in the key.
*
* Returns: none
**************************************************************************/
void setkey(char *key)
{
int i, j, k, temp;
/**********************************************************************
* First, generate C and D by permuting the key. The low order bit of
* each 8-bit char is not used, so C and D are only 28 bits apiece.
**********************************************************************/
for(i = 0; i < 28; i++)
{
C[i] = key[PC1_C[i] - 1];
D[i] = key[PC1_D[i] - 1];
}
/**********************************************************************
* To generate Ki, rotate C and D according to schedule and pick up a
* permutation using PC2.
**********************************************************************/
for(i = 0; i < 16; i++)
{
/* rotate */
for(k = 0; k < shifts[i]; k++)
{
temp = C[0];
for(j = 0; j < 28 - 1; j++)
C[j] = C[j+1];
C[27] = temp;
temp = D[0];
for(j = 0; j < 28 - 1; j++)
D[j] = D[j+1];
D[27] = temp;
}
/* get Ki. Note C and D are concatenated */
for(j = 0; j < 24; j++)
{
KS[i][j] = C[PC2_C[j] - 1];
KS[i][j + 24] = D[PC2_D[j] - 28 -1];
}
}
/* load E with the initial E bit selections */
for(i=0; i < 48; i++)
E[i] = e2[i];
}
/**************************************************************************
* The 8 selection functions. For some reason, they give a 0-origin
* index, unlike everything else.
**************************************************************************/
static const char S[8][64] =
{
{
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
},
{
15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
},
{
10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12
},
{
7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14
},
{
2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3
},
{
12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13
},
{
4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12
},
{
13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
}
};
/**************************************************************************
* P is a permutation on the selected combination of the current L and key.
**************************************************************************/
static const char P[] =
{
16, 7, 20, 21,
29, 12, 28, 17,
1, 15, 23, 26,
5, 18, 31, 10,
2, 8, 24, 14,
32, 27, 3, 9,
19, 13, 30, 6,
22, 11, 4, 25,
};
/* The combination of the key and the input, before selection. */
static char preS[48];
/**************************************************************************
* Function: encrypt
*
* Description: Uses DES to encrypt a 64 bit block of data. Requires
* setkey to be invoked with the encryption key before it may
* be used. The results of the encryption are stored in block.
*
* Inputs: char *block
* pointer to 64 character array. Each character represents a
* bit in the data block.
*
* Returns: none
**************************************************************************/
void encrypt(char *block)
{
int i, ii, temp, j, k;
char left[32], right[32]; /* block in two halves */
char old[32];
char f[32];
/* First, permute the bits in the input */
for(j = 0; j < 32; j++)
left[j] = block[IP[j] - 1];
for(;j < 64; j++)
right[j - 32] = block[IP[j] - 1];
/* Perform an encryption operation 16 times. */
for(ii= 0; ii < 16; ii++)
{
i = ii;
/* Save the right array, which will be the new left. */
for(j = 0; j < 32; j++)
old[j] = right[j];
/******************************************************************
* Expand right to 48 bits using the E selector and
* exclusive-or with the current key bits.
******************************************************************/
for(j =0 ; j < 48; j++)
preS[j] = right[E[j] - 1] ^ KS[i][j];
/******************************************************************
* The pre-select bits are now considered in 8 groups of 6 bits ea.
* The 8 selection functions map these 6-bit quantities into 4-bit
* quantities and the results are permuted to make an f(R, K).
* The indexing into the selection functions is peculiar;
* it could be simplified by rewriting the tables.
******************************************************************/
for(j = 0; j < 8; j++)
{
temp = 6 * j;
k = S[j][(preS[temp + 0] << 5) +
(preS[temp + 1] << 3) +
(preS[temp + 2] << 2) +
(preS[temp + 3] << 1) +
(preS[temp + 4] << 0) +
(preS[temp + 5] << 4)];
temp = 4 * j;
f[temp + 0] = (k >> 3) & 01;
f[temp + 1] = (k >> 2) & 01;
f[temp + 2] = (k >> 1) & 01;
f[temp + 3] = (k >> 0) & 01;
}
/******************************************************************
* The new right is left ^ f(R, K).
* The f here has to be permuted first, though.
******************************************************************/
for(j = 0; j < 32; j++)
right[j] = left[j] ^ f[P[j] - 1];
/* Finally, the new left (the original right) is copied back. */
for(j = 0; j < 32; j++)
left[j] = old[j];
}
/* The output left and right are reversed. */
for(j = 0; j < 32; j++)
{
temp = left[j];
left[j] = right[j];
right[j] = temp;
}
/* The final output gets the inverse permutation of the very original. */
for(j = 0; j < 64; j++)
{
i = FP[j];
if (i < 33)
block[j] = left[FP[j] - 1];
else
block[j] = right[FP[j] - 33];
}
}
/**************************************************************************
* Function: crypt
*
* Description: Clone of Unix crypt(3) function.
*
* Inputs: char *pw
* pointer to 8 character encryption key (user password)
* char *salt
* pointer to 2 character salt used to modify the DES results.
*
* Returns: Pointer to static array containing the salt concatenated
* on to the encrypted results. Same as stored in passwd file.
**************************************************************************/
char *crypt(char *pw, char *salt)
{
int i, j, temp;
char c,
block[66]; /* 1st store key, then results */
static char iobuf[16]; /* encrypted results */
for(i = 0; i < 66; i++)
block[i] = 0;
/* break pw into 64 bits */
for(i = 0, c = *pw; c && (i < 64); i++)
{
for(j = 0; j < 7; j++, i++)
block[i] = (c >> (6 - j)) & 01;
pw++;
c = *pw;
}
/* set key based on pw */
setkey(block);
for(i = 0; i < 66; i++)
block[i] = 0;
for(i = 0; i < 2; i++)
{
/* store salt at beginning of results */
c = *salt++;
iobuf[i] = c;
if(c > 'Z')
c -= 6;
if(c > '9')
c -= 7;
c -= '.';
/* use salt to effect the E-bit selection */
for(j = 0; j < 6; j++)
{
if((c >> j) & 01)
{
temp = E[6 * i + j];
E[6 * i +j] = E[6 * i + j + 24];
E[6 * i + j + 24] = temp;
}
}
}
/* call DES encryption 25 times using pw as key and initial data = 0 */
for(i = 0; i < 25; i++)
encrypt(block);
/* format encrypted block for standard crypt(3) output */
for(i=0; i < 11; i++)
{
c = 0;
for(j = 0; j < 6; j++)
{
c <<= 1;
c |= block[6 * i + j];
}
c += '.';
if(c > '9')
c += 7;
if(c > 'Z')
c += 6;
iobuf[i + 2] = c;
}
iobuf[i + 2] = '\0';
/* prevent premature NULL terminator */
if(iobuf[1] == '\0')
iobuf[1] = iobuf[0];
return(iobuf);
}

View File

@@ -0,0 +1,109 @@
#!/usr/bin/python
# vim: encoding=utf-8
# expand Windows-specific *.in files
# for Visual Studio Builds
import os
import sys
import re
import string
import argparse
def open_compat(src, mode):
if (sys.version_info.major < 3):
return open(src, mode)
else:
return open(src, mode, encoding='utf-8', errors='surrogateescape')
def get_version(srcroot):
ver = {}
RE_VERSION = re.compile(r'^m4_define\(\[(gtk_\w+)\],\s*\[(\d+)\]\)')
RE_FLOAT_VERSION = re.compile(r'^m4_define\(\[(gtk_\w+)\],\s*\[(\d+\.\d*)\]\)')
with open(os.path.join(srcroot, 'configure.ac'), 'r') as ac:
for i in ac:
mo = RE_VERSION.search(i)
if mo:
ver[mo.group(1).upper()] = int(mo.group(2))
mo = RE_FLOAT_VERSION.search(i)
if mo:
ver[mo.group(1).upper()] = float(mo.group(2))
ver['GTK_BINARY_AGE'] = 100 * ver['GTK_MINOR_VERSION'] + ver['GTK_MICRO_VERSION']
ver['GTK_VERSION'] = '%d.%d.%d' % (ver['GTK_MAJOR_VERSION'],
ver['GTK_MINOR_VERSION'],
ver['GTK_MICRO_VERSION'])
ver['LT_RELEASE'] = '%d.%d' % (ver['GTK_MAJOR_VERSION'], ver['GTK_MINOR_VERSION'])
ver['LT_CURRENT'] = 100 * \
ver['GTK_MINOR_VERSION'] + \
ver['GTK_MICRO_VERSION'] - \
ver['GTK_INTERFACE_AGE']
ver['LT_REVISION'] = ver['GTK_INTERFACE_AGE']
ver['LT_AGE'] = ver['GTK_BINARY_AGE'] - ver['GTK_INTERFACE_AGE']
ver['LT_CURRENT_MINUS_AGE'] = ver['LT_CURRENT'] - ver['LT_AGE']
return ver
def process_in(src, dest, vars):
RE_VARS = re.compile(r'@(\w+?)@')
with open_compat(src, 'r') as s:
with open_compat(dest, 'w') as d:
for i in s:
i = RE_VARS.sub(lambda x: str(vars[x.group(1)]), i)
d.write(i)
def get_srcroot():
if not os.path.isabs(__file__):
path = os.path.abspath(__file__)
else:
path = __file__
dirname = os.path.dirname(path)
return os.path.abspath(os.path.join(dirname, '..', '..'))
def main(argv):
prog_desc = 'Create Various autogenerated Win32-specific Source Files'
parser = argparse.ArgumentParser(description=prog_desc)
parser.add_argument('--gtkwin32rc', dest='gtkwin32rc', action='store_const',
const=1,
help='Generate gtk-win32.rc')
parser.add_argument('--gtk3manifest', dest='gtk3manifest', action='store_const',
const=1,
help='Generate libgtk3.manifest')
args = parser.parse_args()
no_args = True
if args.gtkwin32rc is not None:
srcroot = get_srcroot()
ver = get_version(srcroot)
target = os.path.join(srcroot, 'gtk', 'gtk-win32.rc')
process_in(os.path.join(srcroot, 'gtk', 'gtk-win32.rc.in'),
target + '.intermediate',
ver)
fp_r = open_compat(target + '.intermediate', 'r')
lines = fp_r.readlines()
fp_r.close()
fp_w = open_compat(target, 'w')
fp_w.writelines([item for item in lines[:-1]])
fp_w.close()
os.unlink(target + '.intermediate')
no_args = False
if args.gtk3manifest is not None:
manifest = {}
manifest['EXE_MANIFEST_ARCHITECTURE'] = '*'
process_in(os.path.join(srcroot, 'gtk', 'libgtk3.manifest.in'),
os.path.join(srcroot, 'gtk', 'libgtk3.manifest'),
manifest)
no_args = False
if no_args is True:
raise SystemExit('Action argument required. Please see %s --help for details.' % __file__)
if __name__ == '__main__':
sys.exit(main(sys.argv))

View File

@@ -1,102 +0,0 @@
#!/usr/bin/python
#
# Simple utility script to manipulate
# certain types of strings in a file
# This can be used in various projects where
# there is the need to replace strings in files,
# and is copied from GLib's $(srcroot)/build/win32
# Author: Fan, Chun-wei
# Date: September 03, 2014
import os
import sys
import re
import string
import argparse
valid_actions = ['remove-prefix',
'replace-var',
'replace-str',
'remove-str']
def replace(src, dest, instring, outstring):
with open(src, 'r') as s:
with open(dest, 'w') as d:
for line in s:
i = line.replace(instring, outstring)
d.write(i)
def check_required_args(args, params):
for param in params:
if getattr(args, param, None) is None:
raise SystemExit('%s: error: --%s argument is required' % (__file__, param))
def warn_ignored_args(args, params):
for param in params:
if getattr(args, param, None) is not None:
print('%s: warning: --%s argument is ignored' % (__file__, param))
def main(argv):
parser = argparse.ArgumentParser(description='Process strings in a file.')
parser.add_argument('-a',
'--action',
help='Action to carry out. Can be one of:\n'
'remove-prefix\n'
'replace-var\n'
'replace-str\n'
'remove-str',
choices=valid_actions)
parser.add_argument('-i', '--input', help='Input file')
parser.add_argument('-o', '--output', help='Output file')
parser.add_argument('--instring', help='String to replace or remove')
parser.add_argument('--var', help='Autotools variable name to replace')
parser.add_argument('--outstring',
help='New String to replace specified string or variable')
parser.add_argument('--removeprefix', help='Prefix of string to remove')
args = parser.parse_args()
input_string = ''
output_string = ''
# We must have action, input, output for all operations
check_required_args(args, ['action','input','output'])
# Build the arguments by the operation that is to be done,
# to be fed into replace()
# Get rid of prefixes from a string
if args.action == 'remove-prefix':
check_required_args(args, ['instring','removeprefix'])
warn_ignored_args(args, ['outstring','var'])
input_string = args.removeprefix + args.instring
output_string = args.instring
# Replace an m4-style variable (those surrounded by @...@)
if args.action == 'replace-var':
check_required_args(args, ['var','outstring'])
warn_ignored_args(args, ['instring','removeprefix'])
input_string = '@' + args.var + '@'
output_string = args.outstring
# Replace a string
if args.action == 'replace-str':
check_required_args(args, ['instring','outstring'])
warn_ignored_args(args, ['var','removeprefix'])
input_string = args.instring
output_string = args.outstring
# Remove a string
if args.action == 'remove-str':
check_required_args(args, ['instring'])
warn_ignored_args(args, ['var','outstring','removeprefix'])
input_string = args.instring
output_string = ''
replace(args.input, args.output, input_string, output_string)
if __name__ == '__main__':
sys.exit(main(sys.argv))

View File

@@ -19,8 +19,7 @@
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\..\gtk\gtkdbusinterfaces.xml"><Filter>Resource Files</Filter></CustomBuild>
<CustomBuild Include="..\..\..\gtk\gtk-win32.rc.body"><Filter>Resource Files</Filter></CustomBuild>
<CustomBuild Include="..\..\..\gtk\libgtk3.manifest.in"><Filter>Resource Files</Filter></CustomBuild>
<CustomBuild Include="..\..\..\gtk\gtk-win32.rc.in"><Filter>Resource Files</Filter></CustomBuild>
</ItemGroup>
<ItemGroup>
#include "gtk-3.vs10.sourcefiles.filters"

View File

@@ -177,33 +177,19 @@
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkDbusBuiltSources)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtkdbusgenerated.c;..\..\..\gtk\gtkdbusgenerated.h;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\..\gtk\gtk-win32.rc.body">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying GTK+ Win32 Version Resource...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(CopyGtkWin32RC)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying GTK+ Win32 Version Resource...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(CopyGtkWin32RC)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying GTK+ Win32 Version Resource...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(CopyGtkWin32RC)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying GTK+ Win32 Version Resource...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(CopyGtkWin32RC)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtk-win32.rc;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\..\gtk\libgtk3.manifest.in">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating GTK+ Win32 Manifest...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GenerateGtkWin32Manifest)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating GTK+ Win32 Manifest...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GenerateGtkWin32Manifest)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating GTK+ Win32 Manifest...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GenerateGtkWin32Manifest)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating GTK+ Win32 Manifest...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkWin32Manifest)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
<CustomBuild Include="..\..\..\gtk\gtk-win32.rc.in">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating GTK+ Win32 Version Resource...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GenerateGtkWin32RC)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating GTK+ Win32 Version Resource...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GenerateGtkWin32RC)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating GTK+ Win32 Version Resource...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GenerateGtkWin32RC)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating GTK+ Win32 Version Resource...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GenerateGtkWin32RC)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>

View File

@@ -18,8 +18,8 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\gio-win32-2.0;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;_USE_MATH_DEFINES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\..;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ForcedIncludeFiles>msvc_recommended_pragmas.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/d2Zi+ %(AdditionalOptions)</AdditionalOptions>

View File

@@ -64,8 +64,7 @@ $(PythonPath)\python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix
cd $(SolutionDir)
</GenerateGtkDbusBuiltSources>
<CopyGtkWin32RC>copy ..\..\..\gtk\gtk-win32.rc.body ..\..\..\gtk\gtk-win32.rc</CopyGtkWin32RC>
<GenerateGtkWin32Manifest>$(PythonPath)\python ..\replace.py --action=replace-var --input=..\..\..\gtk\libgtk3.manifest.in --output=..\..\..\gtk\libgtk3.manifest --var=EXE_MANIFEST_ARCHITECTURE --outstring=*</GenerateGtkWin32Manifest>
<GenerateGtkWin32RC>$(PythonPath)\python ..\process-in-win32.py --gtkwin32rc --gtk3manifest</GenerateGtkWin32RC>
<CopyDemosH>copy ..\..\..\demos\gtk-demo\demos.h.win32 ..\..\..\demos\gtk-demo\demos.h</CopyDemosH>
</PropertyGroup>
<PropertyGroup>
@@ -84,11 +83,8 @@ cd $(SolutionDir)
<BuildMacro Include="GenerateGtkDbusBuiltSources">
<Value>$(GenerateGtkDbusBuiltSources)</Value>
</BuildMacro>
<BuildMacro Include="CopyGtkWin32RC">
<Value>$(CopyGtkWin32RC)</Value>
</BuildMacro>
<BuildMacro Include="GenerateGtkWin32Manifest">
<Value>$(GenerateGtkWin32Manifest)</Value>
<BuildMacro Include="GenerateGtkWin32RC">
<Value>$(GenerateGtkWin32RC)</Value>
</BuildMacro>
<BuildMacro Include="CopyDemosH">
<Value>$(CopyDemosH)</Value>

View File

@@ -5,6 +5,9 @@
</ImportGroup>
<PropertyGroup Label="UserMacros">
<BinDir>$(SolutionDir)$(Configuration)\$(Platform)\bin</BinDir>
<InstalledDlls>$(BinDir)\$(GtkDllPrefix)gdk(GtkDllSuffix).dll;$(BinDir)\$(GtkDllPrefix)gtk(GtkDllSuffix).dll;$(BinDir)\$(GtkDllPrefix)gailutil(GtkDllSuffix).dll</InstalledDlls>
<InstalledBins>$(BinDir)\gtk3-demo.exe;$(BinDir)\gtk3-demo-application.exe;$(BinDir)\gtk3-icon-browser.exe;$(BinDir)\gtk-encode-symbolic-svg.exe</InstalledBins>
<InstalledBroadwayBins>$(BinDir)\broadwayd.exe</InstalledBroadwayBins>
<GtkDoInstallBin>
mkdir $(CopyDir)\bin
mkdir $(CopyDir)\lib
@@ -123,19 +126,18 @@ copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(CopyDir)\share\glib
copy ..\..\..\gtk\org.gtk.Settings.ColorChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas
copy ..\..\..\gtk\org.gtk.Settings.Debug.gschema.xml $(CopyDir)\share\glib-2.0\schemas
copy ..\..\..\demos\gtk-demo\org.gtk.Demo.gschema.xml $(CopyDir)\share\glib-2.0\schemas
echo "Compiling gsettings XML Files..."
$(GlibEtcInstallRoot)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
echo "Generating icon cache......"
$(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force "$(CopyDir)\share\icons\hicolor"
</GtkDoInstall>
<GtkDoInstallBroadwayHeaders>
copy ..\..\..\gdk\broadway\gdkbroadway.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway
#include "gdk3-broadway.vs10.headers"
</GtkDoInstallBroadwayHeaders>
<GtkPostInstall>
echo "Compiling gsettings XML Files..."
$(GlibEtcInstallRoot)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
echo "Generating icon cache......"
$(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force "$(CopyDir)\share\icons\hicolor"
</GtkPostInstall>
</PropertyGroup>
<PropertyGroup>
<_PropertySheetDisplayName>gtk3installsprops</_PropertySheetDisplayName>
@@ -144,6 +146,15 @@ $(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force "$(CopyDir
<BuildMacro Include="BinDir">
<Value>$(BinDir)</Value>
</BuildMacro>
<BuildMacro Include="InstalledDlls">
<Value>$(InstalledDlls)</Value>
</BuildMacro>
<BuildMacro Include="InstalledBins">
<Value>$(InstalledBins)</Value>
</BuildMacro>
<BuildMacro Include="InstalledBroadwayBins">
<Value>$(InstalledBroadwayBins)</Value>
</BuildMacro>
<BuildMacro Include="GtkDoInstallBin">
<Value>$(GtkDoInstallBin)</Value>
</BuildMacro>
@@ -153,8 +164,5 @@ $(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force "$(CopyDir
<BuildMacro Include="GtkDoInstallBroadwayHeaders">
<Value>$(GtkDoInstallBroadwayHeaders)</Value>
</BuildMacro>
<BuildMacro Include="GtkPostInstall">
<Value>$(GtkPostInstall)</Value>
</BuildMacro>
</ItemGroup>
</Project>

View File

@@ -157,29 +157,29 @@
<ItemGroup>
<CustomBuild Include="..\..\..\config.h.win32">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>

View File

@@ -192,63 +192,33 @@
/>
</FileConfiguration>
</File>
<File RelativePath="..\..\..\gtk\gtk-win32.rc.body">
<File RelativePath="..\..\..\gtk\gtk-win32.rc.in">
<FileConfiguration Name="Debug|Win32">
<Tool Name="VCCustomBuildTool"
Description="Copying GTK+ Win32 Version Resource..."
CommandLine="$(CopyGtkWin32RC)"
Outputs="..\..\..\gtk\gtk-win32.rc"
Description="Generating GTK+ Win32 Version Resource..."
CommandLine="$(GenerateGtkWin32RC)"
Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
/>
</FileConfiguration>
<FileConfiguration Name="Release|Win32">
<Tool Name="VCCustomBuildTool"
Description="Copying GTK+ Win32 Version Resource..."
CommandLine="$(CopyGtkWin32RC)"
Outputs="..\..\..\gtk\gtk-win32.rc"
Description="Generating GTK+ Win32 Version Resource..."
CommandLine="$(GenerateGtkWin32RC)"
Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
/>
</FileConfiguration>
<FileConfiguration Name="Debug|x64">
<Tool Name="VCCustomBuildTool"
Description="Copying GTK+ Win32 Version Resource..."
CommandLine="$(CopyGtkWin32RC)"
Outputs="..\..\..\gtk\gtk-win32.rc"
Description="Generating GTK+ Win32 Version Resource..."
CommandLine="$(GenerateGtkWin32RC)"
Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
/>
</FileConfiguration>
<FileConfiguration Name="Release|x64">
<Tool Name="VCCustomBuildTool"
Description="Copying GTK+ Win32 Version Resource..."
CommandLine="$(CopyGtkWin32RC)"
Outputs="..\..\..\gtk\gtk-win32.rc"
/>
</FileConfiguration>
</File>
<File RelativePath="..\..\..\gtk\libgtk3.manifest.in">
<FileConfiguration Name="Debug|Win32">
<Tool Name="VCCustomBuildTool"
Description="Generating GTK+ Win32 Manifest..."
CommandLine="$(GenerateGtkWin32Manifest)"
Outputs="..\..\..\gtk\libgtk3.manifest"
/>
</FileConfiguration>
<FileConfiguration Name="Release|Win32">
<Tool Name="VCCustomBuildTool"
Description="Generating GTK+ Win32 Manifest..."
CommandLine="$(GenerateGtkWin32Manifest)"
Outputs="..\..\..\gtk\libgtk3.manifest"
/>
</FileConfiguration>
<FileConfiguration Name="Debug|x64">
<Tool Name="VCCustomBuildTool"
Description="Generating GTK+ Win32 Manifest..."
CommandLine="$(GenerateGtkWin32Manifest)"
Outputs="..\..\..\gtk\libgtk3.manifest"
/>
</FileConfiguration>
<FileConfiguration Name="Release|x64">
<Tool Name="VCCustomBuildTool"
Description="Generating GTK+ Win32 Manifest..."
CommandLine="$(GenerateGtkWin32Manifest)"
Outputs="..\..\..\gtk\libgtk3.manifest"
Description="Generating GTK+ Win32 Version Resource..."
CommandLine="$(GenerateGtkWin32RC)"
Outputs="..\..\..\gtk\gtk-win32.rc;..\..\..\gtk\libgtk3.manifest"
/>
</FileConfiguration>
</File>

View File

@@ -9,8 +9,8 @@
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\gio-win32-2.0;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include"
PreprocessorDefinitions="HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;_USE_MATH_DEFINES"
AdditionalIncludeDirectories="..\..\..;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0"
PreprocessorDefinitions="HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES"
ForcedIncludeFiles="msvc_recommended_pragmas.h"
AdditionalOptions="/MP"
/>

View File

@@ -63,12 +63,8 @@ cd $(SolutionDir)&#x0D;&#x0A;
"
/>
<UserMacro
Name="CopyGtkWin32RC"
Value="copy ..\..\..\gtk\gtk-win32.rc.body ..\..\..\gtk\gtk-win32.rc"
/>
<UserMacro
Name="GenerateGtkWin32Manifest"
Value="$(PythonPath)\python ..\replace.py --action=replace-var --input=..\..\..\gtk\libgtk3.manifest.in --output=..\..\..\gtk\libgtk3.manifest --var=EXE_MANIFEST_ARCHITECTURE --outstring=*"
Name="GenerateGtkWin32RC"
Value="$(PythonPath)\python ..\process-in-win32.py --gtkwin32rc --gtk3manifest"
/>
<UserMacro
Name="CopyDemosH"

View File

@@ -29,7 +29,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)"
/>
</Configuration>
<Configuration
@@ -42,7 +42,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)"
/>
</Configuration>
<Configuration
@@ -56,7 +56,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)"
/>
</Configuration>
<Configuration
@@ -69,7 +69,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)"
/>
</Configuration>
<Configuration
@@ -84,7 +84,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)"
/>
</Configuration>
<Configuration
@@ -98,7 +98,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)"
/>
</Configuration>
<Configuration
@@ -113,7 +113,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)"
/>
</Configuration>
<Configuration
@@ -127,7 +127,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)"
/>
</Configuration>
</Configurations>

View File

@@ -128,24 +128,20 @@ copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(CopyDir)\share\glib
copy ..\..\..\gtk\org.gtk.Settings.ColorChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas&#x0D;&#x0A;
copy ..\..\..\gtk\org.gtk.Settings.Debug.gschema.xml $(CopyDir)\share\glib-2.0\schemas&#x0D;&#x0A;
copy ..\..\..\demos\gtk-demo\org.gtk.Demo.gschema.xml $(CopyDir)\share\glib-2.0\schemas&#x0D;&#x0A;
"
/>
<UserMacro
Name="GtkPostInstall"
Value="
echo &quot;Compiling gsettings XML Files...&quot;&#x0D;&#x0A;
$(GlibEtcInstallRoot)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas&#x0D;&#x0A;
echo &quot;Generating icon cache...&quot;&#x0D;&#x0A;
$(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force &quot;$(CopyDir)\share\icons\hicolor&quot;
"
/>
<UserMacro
Name="GtkDoInstallBroadwayHeaders"
Value="
"
/>
<UserMacro
Name="GtkDoInstallBroadwayHeaders"
Value="
copy ..\..\..\gdk\broadway\gdkbroadway.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk&#x0D;&#x0A;
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway&#x0D;&#x0A;
#include "gdk3-broadway.headers"
"
/>
"
/>
</VisualStudioPropertySheet>

View File

@@ -50,9 +50,6 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the `flockfile' function. */
#undef HAVE_FLOCKFILE
/* Define to 1 if you have the <ftw.h> header file. */
/* #undef HAVE_FTW_H */
@@ -233,9 +230,6 @@
/* Have the SYNC extension library */
/* #undef HAVE_XSYNC */
/* Define to 1 if you have the `_lock_file' function. */
#define HAVE__LOCK_FILE
/* Define if _NL_MEASUREMENT_MEASUREMENT is available */
/* #undef HAVE__NL_MEASUREMENT_MEASUREMENT */
@@ -310,7 +304,7 @@
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* defines how to decorate public symbols while building */
/* defines how to decorate public symbols while building */
#ifdef _MSC_VER
#define _GDK_EXTERN __declspec (dllexport) extern
#else

View File

@@ -9,9 +9,9 @@
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [20])
m4_define([gtk_micro_version], [7])
m4_define([gtk_interface_age], [7])
m4_define([gtk_minor_version], [19])
m4_define([gtk_micro_version], [5])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
m4_define([gtk_version],
@@ -42,8 +42,8 @@ m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_major], [2])
m4_define([glib_required_minor], [49])
m4_define([glib_required_micro], [1])
m4_define([glib_required_minor], [45])
m4_define([glib_required_micro], [8])
m4_define([glib_required_version],
[glib_required_major.glib_required_minor.glib_required_micro])
m4_define([glib_min_required_minor],
@@ -59,7 +59,7 @@ m4_define([atk_required_version], [2.15.1])
m4_define([cairo_required_version], [1.14.0])
m4_define([gdk_pixbuf_required_version], [2.30.0])
m4_define([introspection_required_version], [1.39.0])
m4_define([wayland_required_version], [1.9.91])
m4_define([wayland_required_version], [1.5.91])
m4_define([wayland_protocols_required_version], [1.0])
m4_define([mirclient_required_version], [0.11.0])
m4_define([mircookie_required_version], [0.17.0])
@@ -413,7 +413,7 @@ AC_SUBST(DISABLE_ON_QUARTZ)
AC_CHECK_LIB([rt], [shm_open], [SHM_LIBS="-lrt"], [SHM_LIBS=""])
AC_SUBST(SHM_LIBS)
AC_CHECK_FUNCS(posix_fallocate flockfile _lock_file)
AC_CHECK_FUNCS(posix_fallocate)
if test "x$enable_broadway_backend" = xyes; then
GDK_BACKENDS="$GDK_BACKENDS broadway"
@@ -580,7 +580,7 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
PKG_CHECK_MODULES(CAIRO_BACKEND, [$cairo_backends])
# Remove this check once cairo_required_version reaches at least 1.16.0
# Remove this check once cairo_required_version reaches at least 1.14.4
case $host_os in
mingw*)
PKG_CHECK_MODULES(CAIRO, [cairo >= cairo_required_version])
@@ -588,7 +588,7 @@ case $host_os in
[AC_MSG_RESULT([found])],
[AC_MSG_ERROR(
[cairo_win32_surface_create_with_format is not found in cairo library
You need a cairo snapshot 1.15.x or 1.16.x release or newer])])
You need cairo version newer than 2015-04-14])])
;;
*)
;;
@@ -794,9 +794,6 @@ LIBS="$LIBS $GLIB_LIBS"
AC_CHECK_FUNCS(bind_textdomain_codeset)
LIBS=$gtk_save_LIBS
AC_CHECK_HEADERS(linux/memfd.h,
AC_DEFINE(HAVE_LINUX_MEMFD_H, 1,
[Define to 1 if memfd.h is available]))
AC_CHECK_HEADERS(sys/mman.h,
AC_DEFINE(HAVE_SYS_MMAN_H, 1,
[Define to 1 if mman.h is available]))
@@ -1475,7 +1472,7 @@ else
CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | awk -F. '{print $1}'`
CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | awk -F. '{print $2}'`
if test $CUPS_API_MAJOR -lt 1 -o \
if test $CUPS_API_MAJOR -gt 1 -o \
$CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -lt 2; then
AC_MSG_ERROR([CUPS >= 1.2 not found])
fi
@@ -1693,15 +1690,6 @@ if test "$have_colord" = "yes"; then
fi
AM_CONDITIONAL(HAVE_COLORD, test "x$have_colord" = "xyes")
##################################################
# Check for harfbuzz and pangoft2
##################################################
PKG_CHECK_MODULES(FONTDEMO, harfbuzz >= 0.9 pangoft2, build_font_demo=yes, build_font_demo=no)
AC_SUBST(FONTDEMO_CFLAGS)
AC_SUBST(FONTDEMO_LIBS)
AM_CONDITIONAL(BUILD_FONT_DEMO, [ test "x$build_font_demo" = xyes ])
##################################################
# Checks for gtk-doc and docbook-tools
##################################################
@@ -1925,6 +1913,7 @@ docs/tools/Makefile
build/Makefile
build/gtk-introspection-msvc.mak
build/win32/Makefile
build/win32/crypt/Makefile
build/win32/vs9/Makefile
build/win32/vs9/gtk3-version-paths.vsprops
build/win32/vs10/Makefile
@@ -1945,7 +1934,7 @@ gdk/gdkversionmacros.h
gtk/Makefile
gtk/makefile.msc
gtk/gtkversion.h
gtk/gtk-win32.rc.body
gtk/gtk-win32.rc
gtk/libgtk3.manifest
libgail-util/Makefile
modules/Makefile

View File

@@ -4,7 +4,7 @@ include $(top_srcdir)/Makefile.decl
## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename
demos_base = \
application_demo.c \
application.c \
assistant.c \
builder.c \
button_box.c \
@@ -26,7 +26,7 @@ demos_base = \
event_axes.c \
expander.c \
filtermodel.c \
foreigndrawing.c \
font_features.c \
gestures.c \
glarea.c \
headerbar.c \
@@ -70,18 +70,12 @@ demos_base = \
transparent.c \
tree_store.c
demos_opt =
if BUILD_FONT_DEMO
demos_opt += font_features.c
endif
if OS_UNIX
demos_opt += pagesetup.c
demos = $(demos_base) pagesetup.c
else
demos = $(demos_base)
endif
demos = $(demos_base) $(demos_opt)
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir)/gdk \
@@ -100,11 +94,6 @@ LDADDS = \
$(GDK_DEP_LIBS) \
-lm
if BUILD_FONT_DEMO
AM_CPPFLAGS += $(FONTDEMO_CFLAGS)
LDADDS += $(FONTDEMO_LIBS)
endif
bin_PROGRAMS = gtk3-demo gtk3-demo-application
desktopdir = $(datadir)/applications
@@ -143,7 +132,7 @@ gtk3_demo_LDADD = $(LDADDS)
gtk3_demo_LDFLAGS = -export-dynamic
gtk3_demo_application_SOURCES = \
application.c \
application-standalone.c \
demo_resources.c
gtk3_demo_application_LDADD = $(LDADDS)
@@ -187,7 +176,7 @@ uninstall-update-icon-cache:
MSVCPROJS = gtk3-demo gtk3-demo-application
gtk3_demo_FILES = $(gtk3_demo_SOURCES)
gtk3_demo_EXCLUDES = font_features.c|pagesetup.c
gtk3_demo_EXCLUDES = pagesetup.c
gtk3_demo_application_FILES = $(gtk3_demo_application_SOURCES)
gtk3_demo_application_EXCLUDES = dummy

View File

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

View File

@@ -1,31 +1,17 @@
/* 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>
typedef GtkApplication DemoApplication;
typedef GtkApplicationClass DemoApplicationClass;
G_DEFINE_TYPE (DemoApplication, demo_application, GTK_TYPE_APPLICATION)
typedef struct {
GtkApplicationWindow parent_instance;
GtkWidget *message;
GtkWidget *infobar;
GtkWidget *status;
GtkWidget *menutool;
GMenuModel *toolmenu;
GtkTextBuffer *buffer;
int width;
int height;
gboolean maximized;
gboolean fullscreen;
} DemoApplicationWindow;
typedef GtkApplicationWindowClass DemoApplicationWindowClass;
G_DEFINE_TYPE (DemoApplicationWindow, demo_application_window, GTK_TYPE_APPLICATION_WINDOW)
#ifdef STANDALONE
static void create_window (GApplication *app, const char *contents);
@@ -53,9 +39,10 @@ show_action_dialog (GSimpleAction *action)
static void
show_action_infobar (GSimpleAction *action,
GVariant *parameter,
gpointer data)
gpointer window)
{
DemoApplicationWindow *window = data;
GtkWidget *infobar;
GtkWidget *message;
gchar *text;
const gchar *name;
const gchar *value;
@@ -63,25 +50,27 @@ show_action_infobar (GSimpleAction *action,
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 (window->message), text);
gtk_widget_show (window->infobar);
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)
activate_action (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
show_action_dialog (action);
}
static void
activate_new (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
activate_new (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GApplication *app = user_data;
@@ -90,8 +79,8 @@ activate_new (GSimpleAction *action,
static void
open_response_cb (GtkNativeDialog *dialog,
gint response_id,
gpointer user_data)
gint response_id,
gpointer user_data)
{
GtkFileChooserNative *native = user_data;
GApplication *app = g_object_get_data (G_OBJECT (native), "app");
@@ -130,9 +119,9 @@ open_response_cb (GtkNativeDialog *dialog,
static void
activate_open (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
activate_open (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GApplication *app = user_data;
GtkFileChooserNative *native;
@@ -239,8 +228,8 @@ activate_quit (GSimpleAction *action,
}
static void
update_statusbar (GtkTextBuffer *buffer,
DemoApplicationWindow *window)
update_statusbar (GtkTextBuffer *buffer,
GtkStatusbar *statusbar)
{
gchar *msg;
gint row, col;
@@ -248,7 +237,7 @@ update_statusbar (GtkTextBuffer *buffer,
GtkTextIter iter;
/* clear any previous message, underflow is allowed */
gtk_statusbar_pop (GTK_STATUSBAR (window->status), 0);
gtk_statusbar_pop (statusbar, 0);
count = gtk_text_buffer_get_char_count (buffer);
@@ -262,18 +251,18 @@ update_statusbar (GtkTextBuffer *buffer,
msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
row, col, count);
gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, msg);
gtk_statusbar_push (statusbar, 0, msg);
g_free (msg);
}
static void
mark_set_callback (GtkTextBuffer *buffer,
const GtkTextIter *new_location,
GtkTextMark *mark,
DemoApplicationWindow *window)
mark_set_callback (GtkTextBuffer *buffer,
const GtkTextIter *new_location,
GtkTextMark *mark,
gpointer data)
{
update_statusbar (buffer, window);
update_statusbar (buffer, GTK_STATUSBAR (data));
}
static void
@@ -331,9 +320,9 @@ static GActionEntry win_entries[] = {
};
static void
clicked_cb (GtkWidget *widget, DemoApplicationWindow *window)
clicked_cb (GtkWidget *widget, GtkWidget *info)
{
gtk_widget_hide (window->infobar);
gtk_widget_hide (info);
}
static void
@@ -343,10 +332,8 @@ startup (GApplication *app)
GMenuModel *appmenu;
GMenuModel *menubar;
G_APPLICATION_CLASS (demo_application_parent_class)->startup (app);
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/application_demo/menus.ui", NULL);
gtk_builder_add_from_resource (builder, "/application/menus.ui", NULL);
appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");
menubar = (GMenuModel *)gtk_builder_get_object (builder, "menubar");
@@ -359,17 +346,66 @@ startup (GApplication *app)
static void
create_window (GApplication *app,
const char *content)
const char *content_text)
{
DemoApplicationWindow *window;
GtkBuilder *builder;
GtkWidget *window;
GtkWidget *grid;
GtkWidget *contents;
GtkWidget *status;
GtkWidget *message;
GtkWidget *button;
GtkWidget *infobar;
GtkWidget *menutool;
GMenuModel *toolmenu;
GtkTextBuffer *buffer;
window = (DemoApplicationWindow *)g_object_new (demo_application_window_get_type (),
"application", app,
NULL);
if (content)
gtk_text_buffer_set_text (window->buffer, content, -1);
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);
gtk_window_present (GTK_WINDOW (window));
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, "/application/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));
if (content_text)
gtk_text_buffer_set_text (buffer, content_text, -1);
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);
}
static void
@@ -378,12 +414,16 @@ activate (GApplication *app)
create_window (app, NULL);
}
static void
demo_application_init (DemoApplication *app)
int
main (int argc, char *argv[])
{
GtkApplication *app;
GSettings *settings;
GAction *action;
gtk_init (NULL, NULL);
app = gtk_application_new ("org.gtk.Demo2", 0);
settings = g_settings_new ("org.gtk.Demo");
g_action_map_add_action_entries (G_ACTION_MAP (app),
@@ -394,151 +434,97 @@ demo_application_init (DemoApplication *app)
g_action_map_add_action (G_ACTION_MAP (app), action);
g_object_unref (settings);
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
demo_application_class_init (DemoApplicationClass *class)
on_name_vanished (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
GApplicationClass *app_class = G_APPLICATION_CLASS (class);
if (!name_seen)
return;
app_class->startup = startup;
app_class->activate = activate;
if (placeholder)
{
gtk_widget_destroy (placeholder);
g_object_unref (placeholder);
placeholder = NULL;
}
}
static void
demo_application_window_store_state (DemoApplicationWindow *win)
{
GSettings *settings;
#ifdef G_OS_WIN32
#define APP_EXTENSION ".exe"
#else
#define APP_EXTENSION
#endif
settings = g_settings_new ("org.gtk.Demo");
g_settings_set (settings, "window-size", "(ii)", win->width, win->height);
g_settings_set_boolean (settings, "maximized", win->maximized);
g_settings_set_boolean (settings, "fullscreen", win->fullscreen);
g_object_unref (settings);
GtkWidget *
do_application (GtkWidget *toplevel)
{
static guint watch = 0;
if (watch == 0)
watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
"org.gtk.Demo2",
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" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE))
command = "./gtk3-demo-application" APP_EXTENSION;
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.Demo2",
"/org/gtk/Demo2",
"org.gtk.Actions",
"Activate",
g_variant_new ("(sava{sv})", "quit", NULL, NULL),
NULL,
0,
G_MAXINT,
NULL, NULL);
}
return placeholder;
}
static void
demo_application_window_load_state (DemoApplicationWindow *win)
{
GSettings *settings;
settings = g_settings_new ("org.gtk.Demo");
g_settings_get (settings, "window-size", "(ii)", &win->width, &win->height);
win->maximized = g_settings_get_boolean (settings, "maximized");
win->fullscreen = g_settings_get_boolean (settings, "fullscreen");
g_object_unref (settings);
}
static void
demo_application_window_init (DemoApplicationWindow *window)
{
GtkWidget *menu;
window->width = -1;
window->height = -1;
window->maximized = FALSE;
window->fullscreen = FALSE;
gtk_widget_init_template (GTK_WIDGET (window));
menu = gtk_menu_new_from_model (window->toolmenu);
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (window->menutool), menu);
g_action_map_add_action_entries (G_ACTION_MAP (window),
win_entries, G_N_ELEMENTS (win_entries),
window);
}
static void
demo_application_window_constructed (GObject *object)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)object;
demo_application_window_load_state (window);
gtk_window_set_default_size (GTK_WINDOW (window), window->width, window->height);
if (window->maximized)
gtk_window_maximize (GTK_WINDOW (window));
if (window->fullscreen)
gtk_window_fullscreen (GTK_WINDOW (window));
G_OBJECT_CLASS (demo_application_window_parent_class)->constructed (object);
}
static void
demo_application_window_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation);
if (!window->maximized && !window->fullscreen)
gtk_window_get_size (GTK_WINDOW (window), &window->width, &window->height);
}
static gboolean
demo_application_window_state_event (GtkWidget *widget,
GdkEventWindowState *event)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
gboolean res = GDK_EVENT_PROPAGATE;
if (GTK_WIDGET_CLASS (demo_application_window_parent_class)->window_state_event)
res = GTK_WIDGET_CLASS (demo_application_window_parent_class)->window_state_event (widget, event);
window->maximized = (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
window->fullscreen = (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
return res;
}
static void
demo_application_window_destroy (GtkWidget *widget)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
demo_application_window_store_state (window);
GTK_WIDGET_CLASS (demo_application_window_parent_class)->destroy (widget);
}
static void
demo_application_window_class_init (DemoApplicationWindowClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->constructed = demo_application_window_constructed;
widget_class->size_allocate = demo_application_window_size_allocate;
widget_class->window_state_event = demo_application_window_state_event;
widget_class->destroy = demo_application_window_destroy;
gtk_widget_class_set_template_from_resource (widget_class, "/application_demo/application.ui");
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, message);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, infobar);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, status);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, buffer);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, menutool);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, toolmenu);
gtk_widget_class_bind_template_callback (widget_class, clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, update_statusbar);
gtk_widget_class_bind_template_callback (widget_class, mark_set_callback);
}
int
main (int argc, char *argv[])
{
GtkApplication *app;
app = GTK_APPLICATION (g_object_new (demo_application_get_type (),
"application-id", "org.gtk.Demo2",
"flags", G_APPLICATION_HANDLES_OPEN,
NULL));
return g_application_run (G_APPLICATION (app), 0, NULL);
}
#endif

View File

@@ -1,123 +1,100 @@
<?xml version="1.0"?>
<interface>
<template class="DemoApplicationWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Application Class</property>
<property name="default-width">200</property>
<property name="default-height">200</property>
<property name="icon-name">document-open</property>
<object class="GtkGrid" id="grid">
<child>
<object class="GtkGrid">
<property name="visible">1</property>
<object class="GtkToolbar" id="toolbar">
<property name="hexpand">1</property>
<style>
<class name="primary-toolbar"/>
</style>
<child>
<object class="GtkToolbar">
<property name="visible">1</property>
<property name="hexpand">1</property>
<style>
<class name="primary-toolbar"/>
</style>
<child>
<object class="GtkMenuToolButton" id="menutool">
<property name="visible">1</property>
<property name="icon-name">document-open</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="icon-name">application-exit</property>
<property name="action-name">app.quit</property>
</object>
</child>
<child>
<object class="GtkSeparatorToolItem">
<property name="visible">1</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="icon-name">applications-other</property>
<property name="action-name">win.logo</property>
</object>
</child>
<object class="GtkMenuToolButton" id="menutool">
<property name="icon-name">document-open</property>
</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">1</property>
<property name="hexpand">1</property>
<child internal-child="content_area">
<object class="GtkBox" id="content_area">
<child>
<object class="GtkLabel" id="message">
<property name="visible">1</property>
<property name="hexpand">1</property>
</object>
</child>
</object>
</child>
<child internal-child="action_area">
<object class="GtkBox">
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="valign">center</property>
<property name="label" translatable="yes">_OK</property>
<property name="use_underline">1</property>
<signal name="clicked" handler="clicked_cb"/>
</object>
</child>
</object>
</child>
<object class="GtkToolButton" id="quit">
<property name="icon-name">application-exit</property>
<property name="action-name">app.quit</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">1</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView">
<property name="visible">1</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="buffer">buffer</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
<object class="GtkSeparatorToolItem" id="sep"/>
</child>
<child>
<object class="GtkStatusbar" id="status">
<property name="hexpand">1</property>
<property name="visible">1</property>
<object class="GtkToolButton" id="logo">
<property name="icon-name">applications-other</property>
<property name="action-name">win.logo</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
</template>
<child>
<object class="GtkInfoBar" id="infobar">
<property name="no-show-all">1</property>
<property name="hexpand">1</property>
<child internal-child="content_area">
<object class="GtkBox" id="content_area">
<child>
<object class="GtkLabel" id="message">
<property name="visible">1</property>
<property name="hexpand">1</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">1</property>
<property name="valign">center</property>
<property name="label" translatable="yes">_OK</property>
<property name="use_underline">1</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="hexpand">1</property>
<property name="vexpand">1</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="hexpand">1</property>
<property name="visible">1</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>
<object class="GtkTextBuffer" id="buffer">
<signal name="changed" handler="update_statusbar"/>
<signal name="mark-set" handler="mark_set_callback"/>
</object>
</interface>

View File

@@ -1,95 +0,0 @@
/* Application Class
*
* Demonstrates a simple application.
*
* This example 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>
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;
}
}
#ifdef G_OS_WIN32
#define APP_EXTENSION ".exe"
#else
#define APP_EXTENSION
#endif
GtkWidget *
do_application_demo (GtkWidget *toplevel)
{
static guint watch = 0;
if (watch == 0)
watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
"org.gtk.Demo2",
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" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE))
command = "./gtk3-demo-application" APP_EXTENSION;
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.Demo2",
"/org/gtk/Demo2",
"org.gtk.Actions",
"Activate",
g_variant_new ("(sava{sv})", "quit", NULL, NULL),
NULL,
0,
G_MAXINT,
NULL, NULL);
}
return placeholder;
}

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
<menu id="appmenu">
<section>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.about</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>
</interface>

View File

@@ -108,7 +108,6 @@ query_for_toplevel (GdkScreen *screen,
GtkWidget *popup, *label, *frame;
GdkCursor *cursor;
GtkWidget *toplevel = NULL;
GdkDevice *device;
popup = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_screen (GTK_WINDOW (popup), screen);
@@ -125,12 +124,14 @@ query_for_toplevel (GdkScreen *screen,
gtk_widget_show_all (popup);
cursor = gdk_cursor_new_from_name (display, "crosshair");
device = gtk_get_current_event_device ();
if (gdk_seat_grab (gdk_device_get_seat (device),
gtk_widget_get_window (popup),
GDK_SEAT_CAPABILITY_ALL_POINTING,
FALSE, cursor, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
if (gdk_device_grab (gtk_get_current_event_device (),
gtk_widget_get_window (popup),
GDK_OWNERSHIP_NONE,
FALSE,
GDK_BUTTON_RELEASE_MASK,
cursor,
GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
{
gboolean clicked = FALSE;

View File

@@ -36,10 +36,13 @@ create_icon_store (void)
N_("Open")
};
GtkWidget *cellview;
GtkTreeIter iter;
GtkListStore *store;
gint i;
cellview = gtk_cell_view_new ();
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
for (i = 0; i < G_N_ELEMENTS (icon_names); i++)
@@ -62,6 +65,8 @@ create_icon_store (void)
}
}
gtk_widget_destroy (cellview);
return GTK_TREE_MODEL (store);
}

View File

@@ -1,4 +1,4 @@
/* Theming/CSS Accordion
/* CSS Theming/CSS Accordion
*
* A simple accordion demo written using CSS transitions and multiple backgrounds
*

View File

@@ -1,4 +1,4 @@
/* Theming/CSS Basics
/* CSS Theming/CSS Basics
*
* Gtk themes are written using CSS. Every widget is build of multiple items
* that you can style very similarly to a regular website.

View File

@@ -1,4 +1,4 @@
/* Theming/Multiple Backgrounds
/* CSS Theming/Multiple Backgrounds
*
* Gtk themes are written using CSS. Every widget is build of multiple items
* that you can style very similarly to a regular website.

View File

@@ -1,4 +1,4 @@
/* Theming/Animated Backgrounds
/* CSS Theming/Animated Backgrounds
*
* This demo is done in honour of the Pixbufs demo further down.
* It is done exclusively with CSS as the background of the window.

View File

@@ -1,4 +1,4 @@
/* Theming/Shadows
/* CSS Theming/Shadows
*
* This demo shows how to use CSS shadows.
*/

View File

@@ -29,7 +29,7 @@ button {
button:hover {
text-shadow: 3px 3px 5px alpha(black, 0.75);
-gtk-icon-shadow: 3px 3px 5px alpha(black, 0.75);
icon-shadow: 3px 3px 5px alpha(black, 0.75);
box-shadow: 3px 3px 5px alpha(black, 0.5) inset;
border: solid 1px alpha(black, 0.75);
}
@@ -37,7 +37,7 @@ button:hover {
button:active {
padding: 11px 9px 9px 11px;
text-shadow: 1px 1px 2.5px alpha(black, 0.6);
-gtk-icon-shadow: 1px 1px 2.5px alpha(black, 0.6);
icon-shadow: 1px 1px 2.5px alpha(black, 0.6);
}

View File

@@ -10,12 +10,12 @@
background-color: #4a90d9;
}
scrollbar trough,
.scrollbar.trough,
.scrollbars-junction {
background-color: alpha(white, 0.80);
}
scrollbar slider {
.scrollbar.slider {
border-width: 3px;
border-style: solid;
border-radius: 10px;
@@ -24,11 +24,11 @@ scrollbar slider {
background-color: #999;
}
scrollbar slider:hover {
.scrollbar.slider:prelight {
background-color: #555;
}
paned separator {
.pane-separator {
background-color: alpha(white, 0.80);
background-image: linear-gradient(transparent, transparent 1px, #999 1px, #999 4px, transparent 4px);
background-size: 40px auto;
@@ -36,6 +36,6 @@ paned separator {
background-position: center;
}
paned separator:hover {
.pane-separator:prelight {
background-image: linear-gradient(transparent, transparent 1px, #555 1px, #555 4px, transparent 4px);
}

View File

@@ -2,10 +2,8 @@
<gresources>
<gresource prefix="/ui">
<file preprocess="xml-stripblanks">main.ui</file>
<file preprocess="xml-stripblanks">appmenu.ui</file>
</gresource>
<gresource prefix="/application_demo">
<file>application.c</file>
<gresource prefix="/application">
<file>application.ui</file>
<file>menus.ui</file>
</gresource>
@@ -119,7 +117,7 @@
<file>gnu-keys.png</file>
</gresource>
<gresource prefix="/sources">
<file>application_demo.c</file>
<file>application.c</file>
<file>assistant.c</file>
<file>builder.c</file>
<file>button_box.c</file>
@@ -142,7 +140,6 @@
<file>expander.c</file>
<file>filtermodel.c</file>
<file>flowbox.c</file>
<file>foreigndrawing.c</file>
<file>font_features.c</file>
<file>gestures.c</file>
<file>glarea.c</file>
@@ -202,7 +199,7 @@
<file>glarea-fragment.glsl</file>
<file>glarea-vertex.glsl</file>
</gresource>
<gresource prefix="/font_features">
<gresource prefix="/font-features">
<file>font-features.ui</file>
</gresource>
<gresource prefix="/spinbutton">

View File

@@ -78,7 +78,6 @@
<property name="visible">1</property>
<property name="label" translatable="yes">Save _As</property>
<property name="use-underline">1</property>
<accelerator key="s" modifiers="primary | shift-mask" signal="activate"/>
</object>
</child>
<child>

View File

@@ -131,8 +131,7 @@ update_axes_from_event (GdkEvent *event,
source_device = gdk_event_get_source_device (event);
sequence = gdk_event_get_event_sequence (event);
if (event->type == GDK_TOUCH_END ||
event->type == GDK_TOUCH_CANCEL)
if (event->type == GDK_TOUCH_END)
{
g_hash_table_remove (data->touch_info, sequence);
return;

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,15 @@
/* Pango/Font Features
*
* This example demonstrates support for OpenType font features with
* Pango attributes. The attributes can be used manually or via Pango
* markup.
*
* It can also be used to explore available features in OpenType fonts
* and their effect.
* This demonstrates support for OpenType font features with
* Pango attributes. The attributes can be used manually or
* via Pango markup.
*/
#include <gtk/gtk.h>
#include <pango/pangofc-font.h>
#include <hb.h>
#include <hb-ot.h>
#include <hb-ft.h>
static GtkWidget *label;
static GtkWidget *settings;
static GtkWidget *font;
static GtkWidget *script_lang;
static GtkWidget *resetbutton;
static GtkWidget *numcasedefault;
static GtkWidget *numspacedefault;
@@ -25,19 +17,10 @@ static GtkWidget *fractiondefault;
static GtkWidget *stack;
static GtkWidget *entry;
#define num_features 40
static GtkWidget *toggle[num_features];
static GtkWidget *icon[num_features];
static const char *feature_names[num_features] = {
"kern", "liga", "dlig", "hlig", "clig", "smcp", "c2sc", "pcap", "c2pc", "unic",
"cpsp", "case", "lnum", "onum", "pnum", "tnum", "frac", "afrc", "zero", "nalt",
"sinf", "swsh", "cswh", "locl", "calt", "hist", "salt", "titl", "rand", "subs",
"sups", "init", "medi", "fina", "isol", "ss01", "ss02", "ss03", "ss04", "ss05"
};
static GtkWidget *toggle[24];
static void
update_display (void)
update (void)
{
GString *s;
char *font_desc;
@@ -45,10 +28,6 @@ update_display (void)
const char *text;
gboolean has_feature;
int i;
hb_tag_t lang_tag;
GtkTreeModel *model;
GtkTreeIter iter;
const char *lang;
text = gtk_entry_get_text (GTK_ENTRY (entry));
@@ -57,7 +36,7 @@ update_display (void)
s = g_string_new ("");
has_feature = FALSE;
for (i = 0; i < num_features; i++)
for (i = 0; i < 24; i++)
{
if (!gtk_widget_is_sensitive (toggle[i]))
continue;
@@ -90,24 +69,8 @@ update_display (void)
gtk_label_set_text (GTK_LABEL (settings), font_settings);
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (script_lang), &iter))
{
model = gtk_combo_box_get_model (GTK_COMBO_BOX (script_lang));
gtk_tree_model_get (model, &iter,
3, &lang_tag,
-1);
lang = hb_language_to_string (hb_ot_tag_to_language (lang_tag));
}
else
lang = NULL;
s = g_string_new ("");
g_string_append_printf (s, "<span font_desc='%s' font_features='%s'", font_desc, font_settings);
if (lang)
g_string_append_printf (s, " lang='%s'", lang);
g_string_append_printf (s, ">%s</span>", text);
g_string_append_printf (s, "<span font_desc='%s' font_features='%s'>%s</span>", font_desc, font_settings, text);
gtk_label_set_markup (GTK_LABEL (label), s->str);
@@ -117,315 +80,15 @@ update_display (void)
g_free (font_settings);
}
static PangoFont *
get_pango_font (void)
{
PangoFontDescription *desc;
PangoContext *context;
PangoFontMap *map;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font));
context = gtk_widget_get_pango_context (font);
map = pango_context_get_font_map (context);
return pango_font_map_load_font (map, context, desc);
}
static struct { const char *name; hb_script_t script; } script_names[] = {
{ "Common", HB_SCRIPT_COMMON },
{ "Inherited", HB_SCRIPT_INHERITED },
{ "Unknown", HB_SCRIPT_UNKNOWN },
{ "Arabic", HB_SCRIPT_ARABIC },
{ "Armenian", HB_SCRIPT_ARMENIAN },
{ "Bengali", HB_SCRIPT_BENGALI },
{ "Cyrillic", HB_SCRIPT_CYRILLIC },
{ "Devanagari", HB_SCRIPT_DEVANAGARI },
{ "Georgian", HB_SCRIPT_GEORGIAN },
{ "Greek", HB_SCRIPT_GREEK },
{ "Gujarati", HB_SCRIPT_GUJARATI },
{ "Gurmukhi", HB_SCRIPT_GURMUKHI },
{ "Hangul", HB_SCRIPT_HANGUL },
{ "Han", HB_SCRIPT_HAN },
{ "Hebrew", HB_SCRIPT_HEBREW },
{ "Hiragana", HB_SCRIPT_HIRAGANA },
{ "Kannada", HB_SCRIPT_KANNADA },
{ "Katakana", HB_SCRIPT_KATAKANA },
{ "Lao", HB_SCRIPT_LAO },
{ "Latin", HB_SCRIPT_LATIN },
{ "Malayalam", HB_SCRIPT_MALAYALAM },
{ "Oriya", HB_SCRIPT_ORIYA },
{ "Tamil", HB_SCRIPT_TAMIL },
{ "Telugu", HB_SCRIPT_TELUGU },
{ "Thai", HB_SCRIPT_THAI },
{ "Tibetan", HB_SCRIPT_TIBETAN },
{ "Bopomofo", HB_SCRIPT_BOPOMOFO }
/* FIXME: complete */
};
static struct { const char *name; hb_tag_t tag; } language_names[] = {
{ "Arabic", HB_TAG ('A','R','A',' ') },
{ "Romanian", HB_TAG ('R','O','M',' ') },
{ "Skolt Sami", HB_TAG ('S','K','S',' ') },
{ "Northern Sami", HB_TAG ('N','S','M',' ') },
{ "Kildin Sami", HB_TAG ('K','S','M',' ') },
{ "Moldavian", HB_TAG ('M','O','L',' ') },
{ "Turkish", HB_TAG ('T','R','K',' ') },
{ "Azerbaijani", HB_TAG ('A','Z','E',' ') },
{ "Crimean Tatar", HB_TAG ('C','R','T',' ') },
{ "Serbian", HB_TAG ('S','R','B',' ') },
{ "German", HB_TAG ('D','E','U',' ') }
/* FIXME: complete */
};
typedef struct {
hb_tag_t script_tag;
hb_tag_t lang_tag;
unsigned int script_index;
unsigned int lang_index;
} TagPair;
static guint
tag_pair_hash (gconstpointer data)
{
const TagPair *pair = data;
return pair->script_tag + pair->lang_tag;
}
static gboolean
tag_pair_equal (gconstpointer a, gconstpointer b)
{
const TagPair *pair_a = a;
const TagPair *pair_b = b;
return pair_a->script_tag == pair_b->script_tag && pair_a->lang_tag == pair_b->lang_tag;
}
static void
update_script_combo (void)
{
GtkListStore *store;
hb_font_t *hb_font;
gint i, j, k, l;
FT_Face ft_face;
PangoFont *pango_font;
GHashTable *tags;
GHashTableIter iter;
TagPair *pair;
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
pango_font = get_pango_font ();
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
tags = g_hash_table_new_full (tag_pair_hash, tag_pair_equal, g_free, NULL);
pair = g_new (TagPair, 1);
pair->script_tag = HB_OT_TAG_DEFAULT_SCRIPT;
pair->lang_tag = HB_OT_TAG_DEFAULT_LANGUAGE;
g_hash_table_insert (tags, pair, g_strdup ("Default"));
if (hb_font)
{
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
hb_face_t *hb_face;
hb_face = hb_font_get_face (hb_font);
for (i= 0; i < 2; i++)
{
hb_tag_t scripts[80];
unsigned int script_count = G_N_ELEMENTS (scripts);
hb_ot_layout_table_get_script_tags (hb_face, tables[i], 0, &script_count, scripts);
for (j = 0; j < script_count; j++)
{
hb_tag_t languages[80];
unsigned int language_count = G_N_ELEMENTS (languages);
pair = g_new (TagPair, 1);
pair->script_tag = scripts[j];
pair->lang_tag = HB_OT_TAG_DEFAULT_LANGUAGE;
pair->script_index = j;
pair->lang_index = HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX;
g_hash_table_add (tags, pair);
hb_ot_layout_script_get_language_tags (hb_face, tables[i], j, 0, &language_count, languages);
for (k = 0; k < language_count; k++)
{
pair = g_new (TagPair, 1);
pair->script_tag = scripts[j];
pair->lang_tag = languages[k];
pair->script_index = j;
pair->lang_index = k;
g_hash_table_add (tags, pair);
}
}
}
hb_face_destroy (hb_face);
}
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
g_object_unref (pango_font);
g_hash_table_iter_init (&iter, tags);
while (g_hash_table_iter_next (&iter, (gpointer *)&pair, NULL))
{
const char *scriptname;
char scriptbuf[5];
const char *langname;
char langbuf[5];
char *name;
if (pair->script_tag == HB_OT_TAG_DEFAULT_SCRIPT)
scriptname = "Default";
else if (pair->script_tag == HB_TAG ('m','a','t','h'))
scriptname = "Math";
else
{
hb_script_t script;
hb_tag_to_string (pair->script_tag, scriptbuf);
scriptbuf[4] = 0;
scriptname = scriptbuf;
script = hb_script_from_iso15924_tag (pair->script_tag);
for (k = 0; k < G_N_ELEMENTS (script_names); k++)
{
if (script == script_names[k].script)
{
scriptname = script_names[k].name;
break;
}
}
}
if (pair->lang_tag == HB_OT_TAG_DEFAULT_LANGUAGE)
langname = "Default";
else
{
hb_tag_to_string (pair->lang_tag, langbuf);
langbuf[4] = 0;
langname = langbuf;
for (l = 0; l < G_N_ELEMENTS (language_names); l++)
{
if (pair->lang_tag == language_names[l].tag)
{
langname = language_names[l].name;
break;
}
}
}
name = g_strdup_printf ("%s - %s", scriptname, langname);
gtk_list_store_insert_with_values (store, NULL, -1,
0, name,
1, pair->script_index,
2, pair->lang_index,
3, pair->lang_tag,
-1);
g_free (name);
}
g_hash_table_destroy (tags);
gtk_combo_box_set_model (GTK_COMBO_BOX (script_lang), GTK_TREE_MODEL (store));
gtk_combo_box_set_active (GTK_COMBO_BOX (script_lang), 0);
}
static void
update_features (void)
{
gint i, j, k;
GtkTreeModel *model;
GtkTreeIter iter;
guint script_index, lang_index;
PangoFont *pango_font;
FT_Face ft_face;
hb_font_t *hb_font;
for (i = 0; i < num_features; i++)
gtk_widget_set_opacity (icon[i], 0);
/* set feature presence checks from the font features */
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (script_lang), &iter))
return;
model = gtk_combo_box_get_model (GTK_COMBO_BOX (script_lang));
gtk_tree_model_get (model, &iter,
1, &script_index,
2, &lang_index,
-1);
pango_font = get_pango_font ();
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
if (hb_font)
{
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
hb_face_t *hb_face;
hb_face = hb_font_get_face (hb_font);
for (i = 0; i < 2; i++)
{
hb_tag_t features[80];
unsigned int count = G_N_ELEMENTS(features);
hb_ot_layout_language_get_feature_tags (hb_face,
tables[i],
script_index,
lang_index,
0,
&count,
features);
for (j = 0; j < count; j++)
{
for (k = 0; k < num_features; k++)
{
if (hb_tag_from_string (feature_names[k], -1) == features[j])
gtk_widget_set_opacity (icon[k], 0.5);
}
}
}
hb_face_destroy (hb_face);
}
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
g_object_unref (pango_font);
}
static void
font_changed (void)
{
update_script_combo ();
}
static void
script_changed (void)
{
update_features ();
update_display ();
}
static void
reset_features (void)
reset (void)
{
int i;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (numcasedefault), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (numspacedefault), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fractiondefault), TRUE);
for (i = 0; i < num_features; i++)
for (i = 0; i < 24; i++)
{
if (!GTK_IS_RADIO_BUTTON (toggle[i]))
{
@@ -450,7 +113,7 @@ switch_to_label (void)
g_free (text);
text = NULL;
gtk_stack_set_visible_child_name (GTK_STACK (stack), "label");
update_display ();
update ();
}
static gboolean
@@ -476,12 +139,10 @@ do_font_features (GtkWidget *do_widget)
GtkBuilder *builder;
int i;
builder = gtk_builder_new_from_resource ("/font_features/font-features.ui");
builder = gtk_builder_new_from_resource ("/font-features/font-features.ui");
gtk_builder_add_callback_symbol (builder, "update_display", update_display);
gtk_builder_add_callback_symbol (builder, "font_changed", font_changed);
gtk_builder_add_callback_symbol (builder, "script_changed", script_changed);
gtk_builder_add_callback_symbol (builder, "reset", reset_features);
gtk_builder_add_callback_symbol (builder, "update", update);
gtk_builder_add_callback_symbol (builder, "reset", reset);
gtk_builder_add_callback_symbol (builder, "switch_to_entry", switch_to_entry);
gtk_builder_add_callback_symbol (builder, "switch_to_label", switch_to_label);
gtk_builder_add_callback_symbol (builder, "entry_key_press", G_CALLBACK (entry_key_press));
@@ -492,24 +153,39 @@ do_font_features (GtkWidget *do_widget)
settings = GTK_WIDGET (gtk_builder_get_object (builder, "settings"));
resetbutton = GTK_WIDGET (gtk_builder_get_object (builder, "reset"));
font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
numcasedefault = GTK_WIDGET (gtk_builder_get_object (builder, "numcasedefault"));
numspacedefault = GTK_WIDGET (gtk_builder_get_object (builder, "numspacedefault"));
fractiondefault = GTK_WIDGET (gtk_builder_get_object (builder, "fractiondefault"));
stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
for (i = 0; i < num_features; i++)
{
char *iname;
i = 0;
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "kern"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "liga"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "dlig"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "hlig"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "clig"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "smcp"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "c2sc"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "lnum"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "onum"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "pnum"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "tnum"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "frac"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "afrc"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "zero"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "nalt"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "swsh"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "calt"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "hist"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "salt"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss01"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss02"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss03"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss04"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss05"));
toggle[i] = GTK_WIDGET (gtk_builder_get_object (builder, feature_names[i]));
iname = g_strconcat (feature_names[i], "_pres", NULL);
icon[i] = GTK_WIDGET (gtk_builder_get_object (builder, iname));
g_free (iname);
}
font_changed ();
update ();
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -1,986 +0,0 @@
/* Foreign drawing
*
* Many applications can't use GTK+ widgets, for a variety of reasons,
* but still want their user interface to appear integrated with the
* rest of the desktop, and follow GTK+ themes. This demo shows how to
* use GtkStyleContext and the gtk_render_ APIs to achieve this.
*
* Note that this is a very simple, non-interactive example.
*/
#include <gtk/gtk.h>
#include <string.h>
static void
append_element (GtkWidgetPath *path,
const char *selector)
{
static const struct {
const char *name;
GtkStateFlags state_flag;
} pseudo_classes[] = {
{ "active", GTK_STATE_FLAG_ACTIVE },
{ "hover", GTK_STATE_FLAG_PRELIGHT },
{ "selected", GTK_STATE_FLAG_SELECTED },
{ "disabled", GTK_STATE_FLAG_INSENSITIVE },
{ "indeterminate", GTK_STATE_FLAG_INCONSISTENT },
{ "focus", GTK_STATE_FLAG_FOCUSED },
{ "backdrop", GTK_STATE_FLAG_BACKDROP },
{ "dir(ltr)", GTK_STATE_FLAG_DIR_LTR },
{ "dir(rtl)", GTK_STATE_FLAG_DIR_RTL },
{ "link", GTK_STATE_FLAG_LINK },
{ "visited", GTK_STATE_FLAG_VISITED },
{ "checked", GTK_STATE_FLAG_CHECKED },
{ "drop(active)", GTK_STATE_FLAG_DROP_ACTIVE }
};
const char *next;
char *name;
char type;
guint i;
next = strpbrk (selector, "#.:");
if (next == NULL)
next = selector + strlen (selector);
name = g_strndup (selector, next - selector);
if (g_ascii_isupper (selector[0]))
{
GType gtype;
gtype = g_type_from_name (name);
if (gtype == G_TYPE_INVALID)
{
g_critical ("Unknown type name `%s'", name);
g_free (name);
return;
}
gtk_widget_path_append_type (path, gtype);
}
else
{
/* Omit type, we're using name */
gtk_widget_path_append_type (path, G_TYPE_NONE);
gtk_widget_path_iter_set_object_name (path, -1, name);
}
g_free (name);
while (*next != '\0')
{
type = *next;
selector = next + 1;
next = strpbrk (selector, "#.:");
if (next == NULL)
next = selector + strlen (selector);
name = g_strndup (selector, next - selector);
switch (type)
{
case '#':
gtk_widget_path_iter_set_name (path, -1, name);
break;
case '.':
gtk_widget_path_iter_add_class (path, -1, name);
break;
case ':':
for (i = 0; i < G_N_ELEMENTS (pseudo_classes); i++)
{
if (g_str_equal (pseudo_classes[i].name, name))
{
gtk_widget_path_iter_set_state (path,
-1,
gtk_widget_path_iter_get_state (path, -1)
| pseudo_classes[i].state_flag);
break;
}
}
if (i == G_N_ELEMENTS (pseudo_classes))
g_critical ("Unknown pseudo-class :%s", name);
break;
default:
g_assert_not_reached ();
break;
}
g_free (name);
}
}
static GtkStyleContext *
create_context_for_path (GtkWidgetPath *path,
GtkStyleContext *parent)
{
GtkStyleContext *context;
context = gtk_style_context_new ();
gtk_style_context_set_path (context, path);
gtk_style_context_set_parent (context, parent);
/* Unfortunately, we have to explicitly set the state again here
* for it to take effect
*/
gtk_style_context_set_state (context, gtk_widget_path_iter_get_state (path, -1));
gtk_widget_path_unref (path);
return context;
}
static GtkStyleContext *
get_style (GtkStyleContext *parent,
const char *selector)
{
GtkWidgetPath *path;
if (parent)
path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
else
path = gtk_widget_path_new ();
append_element (path, selector);
return create_context_for_path (path, parent);
}
static GtkStyleContext *
get_style_with_siblings (GtkStyleContext *parent,
const char *selector,
const char **siblings,
gint position)
{
GtkWidgetPath *path, *siblings_path;
guint i;
if (parent)
path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
else
path = gtk_widget_path_new ();
siblings_path = gtk_widget_path_new ();
for (i = 0; siblings[i]; i++)
append_element (siblings_path, siblings[i]);
gtk_widget_path_append_with_siblings (path, siblings_path, position);
gtk_widget_path_unref (siblings_path);
return create_context_for_path (path, parent);
}
static void
draw_style_common (GtkStyleContext *context,
cairo_t *cr,
gint x,
gint y,
gint width,
gint height,
gint *contents_x,
gint *contents_y,
gint *contents_width,
gint *contents_height)
{
GtkBorder margin, border, padding;
int min_width, min_height;
gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &margin);
gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
gtk_style_context_get (context, gtk_style_context_get_state (context),
"min-width", &min_width,
"min-height", &min_height,
NULL);
x += margin.left;
y += margin.top;
width -= margin.left + margin.right;
height -= margin.top + margin.bottom;
width = MAX (width, min_width);
height = MAX (height, min_height);
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
if (contents_x)
*contents_x = x + border.left + padding.left;
if (contents_y)
*contents_y = y + border.top + padding.top;
if (contents_width)
*contents_width = width - border.left - border.right - padding.left - padding.right;
if (contents_height)
*contents_height = height - border.top - border.bottom - padding.top - padding.bottom;
}
static void
query_size (GtkStyleContext *context,
gint *width,
gint *height)
{
GtkBorder margin, border, padding;
int min_width, min_height;
gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &margin);
gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
gtk_style_context_get (context, gtk_style_context_get_state (context),
"min-width", &min_width,
"min-height", &min_height,
NULL);
min_width += margin.left + margin.right + border.left + border.right + padding.left + padding.right;
min_height += margin.top + margin.bottom + border.top + border.bottom + padding.top + padding.bottom;
if (width)
*width = MAX (*width, min_width);
if (height)
*height = MAX (*height, min_height);
}
static void
draw_menu (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint *height)
{
GtkStyleContext *menu_context;
GtkStyleContext *menuitem_context;
GtkStyleContext *hovermenuitem_context;
GtkStyleContext *hoveredarrowmenuitem_context;
GtkStyleContext *arrowmenuitem_context;
GtkStyleContext *checkmenuitem_context;
GtkStyleContext *disabledarrowmenuitem_context;
GtkStyleContext *disabledcheckmenuitem_context;
GtkStyleContext *radiomenuitem_context;
GtkStyleContext *disablemenuitem_context;
GtkStyleContext *disabledradiomenuitem_context;
GtkStyleContext *separatormenuitem_context;
gint menuitem1_height, menuitem2_height, menuitem3_height, menuitem4_height, menuitem5_height;
gint contents_x, contents_y, contents_width, contents_height;
gint menu_x, menu_y, menu_width, menu_height;
gint arrow_width, arrow_height, arrow_size;
gint toggle_x, toggle_y, toggle_width, toggle_height;
/* This information is taken from the GtkMenu docs, see "CSS nodes" */
menu_context = get_style (gtk_widget_get_style_context(widget), "menu");
hovermenuitem_context = get_style (menu_context, "menuitem:hover");
hoveredarrowmenuitem_context = get_style (hovermenuitem_context, "arrow.right:dir(ltr)");
menuitem_context = get_style (menu_context, "menuitem");
arrowmenuitem_context = get_style (menuitem_context, "arrow:dir(rtl)");
disablemenuitem_context = get_style (menu_context, "menuitem:disabled");
disabledarrowmenuitem_context = get_style (disablemenuitem_context, "arrow:dir(rtl)");
checkmenuitem_context = get_style (menuitem_context, "check:checked");
disabledcheckmenuitem_context = get_style (disablemenuitem_context, "check");
separatormenuitem_context = get_style (menu_context, "separator:disabled");
radiomenuitem_context = get_style (menuitem_context, "radio:checked");
disabledradiomenuitem_context = get_style (disablemenuitem_context, "radio");
*height = 0;
query_size (menu_context, NULL, height);
menuitem1_height = 0;
query_size (hovermenuitem_context, NULL, &menuitem1_height);
query_size (hoveredarrowmenuitem_context, NULL, &menuitem1_height);
*height += menuitem1_height;
menuitem2_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (menuitem_context, NULL, &menuitem2_height);
query_size (arrowmenuitem_context, NULL, &menuitem2_height);
query_size (disabledarrowmenuitem_context, NULL, &menuitem2_height);
*height += menuitem2_height;
menuitem3_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (menuitem_context, NULL, &menuitem3_height);
query_size (checkmenuitem_context, NULL, &menuitem3_height);
query_size (disabledcheckmenuitem_context, NULL, &menuitem3_height);
*height += menuitem3_height;
menuitem4_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (separatormenuitem_context, NULL, &menuitem4_height);
*height += menuitem4_height;
menuitem5_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (menuitem_context, NULL, &menuitem5_height);
query_size (radiomenuitem_context, NULL, &menuitem5_height);
query_size (disabledradiomenuitem_context, NULL, &menuitem5_height);
*height += menuitem5_height;
draw_style_common (menu_context, cr, x, y, width, *height,
&menu_x, &menu_y, &menu_width, &menu_height);
/* Hovered with right arrow */
gtk_style_context_get (hoveredarrowmenuitem_context, gtk_style_context_get_state (hoveredarrowmenuitem_context),
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
draw_style_common (hovermenuitem_context, cr, menu_x, menu_y, menu_width, menuitem1_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_arrow (hoveredarrowmenuitem_context, cr, G_PI / 2,
contents_x + contents_width - arrow_size,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
/* Left arrow sensitive, and right arrow insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height, menu_width, menuitem2_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_style_context_get (arrowmenuitem_context, gtk_style_context_get_state (arrowmenuitem_context),
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (arrowmenuitem_context, cr, G_PI / 2,
contents_x,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
gtk_style_context_get (disabledarrowmenuitem_context, gtk_style_context_get_state (disabledarrowmenuitem_context),
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (disabledarrowmenuitem_context, cr, G_PI / 2,
contents_x + contents_width - arrow_size,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
/* Left check enabled, sensitive, and right check unchecked, insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height, menu_width, menuitem3_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_style_context_get (checkmenuitem_context, gtk_style_context_get_state (checkmenuitem_context),
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (checkmenuitem_context, cr,
contents_x,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (checkmenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
gtk_style_context_get (disabledcheckmenuitem_context, gtk_style_context_get_state (disabledcheckmenuitem_context),
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledcheckmenuitem_context, cr,
contents_x + contents_width - toggle_width,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (disabledcheckmenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
/* Separator */
draw_style_common (separatormenuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height + menuitem3_height,
menu_width, menuitem4_height,
NULL, NULL, NULL, NULL);
/* Left check enabled, sensitive, and right check unchecked, insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height + menuitem3_height + menuitem4_height,
menu_width, menuitem5_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_style_context_get (radiomenuitem_context, gtk_style_context_get_state (radiomenuitem_context),
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (radiomenuitem_context, cr,
contents_x,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (radiomenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
gtk_style_context_get (disabledradiomenuitem_context, gtk_style_context_get_state (disabledradiomenuitem_context),
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledradiomenuitem_context, cr,
contents_x + contents_width - toggle_width,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (disabledradiomenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
g_object_unref (menu_context);
g_object_unref (menuitem_context);
g_object_unref (hovermenuitem_context);
g_object_unref (hoveredarrowmenuitem_context);
g_object_unref (arrowmenuitem_context);
g_object_unref (checkmenuitem_context);
g_object_unref (disabledarrowmenuitem_context);
g_object_unref (disabledcheckmenuitem_context);
g_object_unref (radiomenuitem_context);
g_object_unref (disablemenuitem_context);
g_object_unref (disabledradiomenuitem_context);
g_object_unref (separatormenuitem_context);
}
static void
draw_menubar (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint *height)
{
GtkStyleContext *frame_context;
GtkStyleContext *border_context;
GtkStyleContext *menubar_context;
GtkStyleContext *hovered_menuitem_context;
GtkStyleContext *menuitem_context;
gint contents_x, contents_y, contents_width, contents_height;
gint item_width;
/* Menubar background is the same color as our base background, so use a frame */
frame_context = get_style (NULL, "frame");
border_context = get_style (frame_context, "border");
/* This information is taken from the GtkMenuBar docs, see "CSS nodes" */
menubar_context = get_style (NULL, "menubar");
hovered_menuitem_context = get_style (menubar_context, "menuitem:hover");
menuitem_context = get_style (menubar_context, "menuitem");
*height = 0;
query_size (frame_context, NULL, height);
query_size (border_context, NULL, height);
query_size (menubar_context, NULL, height);
query_size (hovered_menuitem_context, NULL, height);
query_size (menuitem_context, NULL, height);
draw_style_common (frame_context, cr, x, y, width, *height,
NULL, NULL, NULL, NULL);
draw_style_common (border_context, cr, x, y, width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (menubar_context, cr, contents_x, contents_y, contents_width, contents_height,
NULL, NULL, NULL, NULL);
item_width = contents_width / 3;
draw_style_common (hovered_menuitem_context, cr, contents_x, contents_y, item_width, contents_height,
NULL, NULL, NULL, NULL);
draw_style_common (menuitem_context, cr, contents_x + item_width * 2, contents_y, item_width, contents_height,
NULL, NULL, NULL, NULL);
g_object_unref (menuitem_context);
g_object_unref (hovered_menuitem_context);
g_object_unref (menubar_context);
g_object_unref (border_context);
g_object_unref (frame_context);
}
static void
draw_notebook (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint height)
{
GtkStyleContext *notebook_context;
GtkStyleContext *header_context;
GtkStyleContext *tabs_context;
GtkStyleContext *tab1_context, *tab2_context;
GtkStyleContext *stack_context;
gint header_height;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkNotebook docs, see "CSS nodes" */
notebook_context = get_style (NULL, "notebook.frame");
header_context = get_style (notebook_context, "header.top");
tabs_context = get_style (header_context, "tabs");
tab1_context = get_style (tabs_context, "tab:checked");
tab2_context = get_style (tabs_context, "tab:hover");
stack_context = get_style (notebook_context, "stack");
header_height = 0;
query_size (notebook_context, NULL, &header_height);
query_size (header_context, NULL, &header_height);
query_size (tabs_context, NULL, &header_height);
query_size (tab1_context, NULL, &header_height);
query_size (tab2_context, NULL, &header_height);
draw_style_common (notebook_context, cr, x, y, width, height, NULL, NULL, NULL, NULL);
draw_style_common (header_context, cr, x, y, width, header_height, NULL, NULL, NULL, NULL);
draw_style_common (tabs_context, cr, x, y, width, header_height, NULL, NULL, NULL, NULL);
draw_style_common (tab1_context, cr, x, y, width / 2, header_height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (tab2_context, cr, x + width / 2, y, width / 2, header_height,
NULL, NULL, NULL, NULL);
draw_style_common (stack_context, cr, x, y + header_height, width,height - header_height,
NULL, NULL, NULL, NULL);
g_object_unref (stack_context);
g_object_unref (tabs_context);
g_object_unref (tab1_context);
g_object_unref (tab2_context);
g_object_unref (header_context);
g_object_unref (notebook_context);
}
static void
draw_horizontal_scrollbar (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint position,
GtkStateFlags state,
gint *height)
{
GtkStyleContext *scrollbar_context;
GtkStyleContext *contents_context;
GtkStyleContext *trough_context;
GtkStyleContext *slider_context;
gint slider_width;
/* This information is taken from the GtkScrollbar docs, see "CSS nodes" */
scrollbar_context = get_style (NULL, "scrollbar.horizontal.bottom");
contents_context = get_style (scrollbar_context, "contents");
trough_context = get_style (contents_context, "trough");
slider_context = get_style (trough_context, "slider");
gtk_style_context_set_state (scrollbar_context, state);
gtk_style_context_set_state (contents_context, state);
gtk_style_context_set_state (trough_context, state);
gtk_style_context_set_state (slider_context, state);
*height = 0;
query_size (scrollbar_context, NULL, height);
query_size (contents_context, NULL, height);
query_size (trough_context, NULL, height);
query_size (slider_context, NULL, height);
gtk_style_context_get (slider_context, gtk_style_context_get_state (slider_context),
"min-width", &slider_width, NULL);
draw_style_common (scrollbar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (contents_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (trough_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (slider_context, cr, x + position, y, slider_width, *height, NULL, NULL, NULL, NULL);
g_object_unref (slider_context);
g_object_unref (trough_context);
g_object_unref (contents_context);
g_object_unref (scrollbar_context);
}
static void
draw_text (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint height,
const gchar *text,
GtkStateFlags state)
{
GtkStyleContext *label_context;
GtkStyleContext *selection_context;
GtkStyleContext *context;
PangoLayout *layout;
/* This information is taken from the GtkLabel docs, see "CSS nodes" */
label_context = get_style (NULL, "label.view");
selection_context = get_style (label_context, "selection");
gtk_style_context_set_state (label_context, state);
if (state & GTK_STATE_FLAG_SELECTED)
context = selection_context;
else
context = label_context;
layout = gtk_widget_create_pango_layout (widget, text);
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
gtk_render_layout (context, cr, x, y, layout);
g_object_unref (layout);
g_object_unref (selection_context);
g_object_unref (label_context);
}
static void
draw_check (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
GtkStateFlags state,
gint *width,
gint *height)
{
GtkStyleContext *button_context;
GtkStyleContext *check_context;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkCheckButton docs, see "CSS nodes" */
button_context = get_style (NULL, "checkbutton");
check_context = get_style (button_context, "check");
gtk_style_context_set_state (check_context, state);
*width = *height = 0;
query_size (button_context, width, height);
query_size (check_context, width, height);
draw_style_common (button_context, cr, x, y, *width, *height, NULL, NULL, NULL, NULL);
draw_style_common (check_context, cr, x, y, *width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_check (check_context, cr, contents_x, contents_y, contents_width, contents_height);
g_object_unref (check_context);
g_object_unref (button_context);
}
static void
draw_radio (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
GtkStateFlags state,
gint *width,
gint *height)
{
GtkStyleContext *button_context;
GtkStyleContext *check_context;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkRadioButton docs, see "CSS nodes" */
button_context = get_style (NULL, "radiobutton");
check_context = get_style (button_context, "radio");
gtk_style_context_set_state (check_context, state);
*width = *height = 0;
query_size (button_context, width, height);
query_size (check_context, width, height);
draw_style_common (button_context, cr, x, y, *width, *height, NULL, NULL, NULL, NULL);
draw_style_common (check_context, cr, x, y, *width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_check (check_context, cr, contents_x, contents_y, contents_width, contents_height);
g_object_unref (check_context);
g_object_unref (button_context);
}
static void
draw_progress (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint position,
gint *height)
{
GtkStyleContext *bar_context;
GtkStyleContext *trough_context;
GtkStyleContext *progress_context;
/* This information is taken from the GtkProgressBar docs, see "CSS nodes" */
bar_context = get_style (NULL, "progressbar.horizontal");
trough_context = get_style (bar_context, "trough");
progress_context = get_style (trough_context, "progress.left");
*height = 0;
query_size (bar_context, NULL, height);
query_size (trough_context, NULL, height);
query_size (progress_context, NULL, height);
draw_style_common (bar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (trough_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (progress_context, cr, x, y, position, *height, NULL, NULL, NULL, NULL);
g_object_unref (progress_context);
g_object_unref (trough_context);
g_object_unref (bar_context);
}
static void
draw_scale (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint position,
gint *height)
{
GtkStyleContext *scale_context;
GtkStyleContext *contents_context;
GtkStyleContext *trough_context;
GtkStyleContext *slider_context;
GtkStyleContext *highlight_context;
gint contents_x, contents_y, contents_width, contents_height;
gint trough_height, slider_height;
scale_context = get_style (NULL, "scale.horizontal");
contents_context = get_style (scale_context, "contents");
trough_context = get_style (contents_context, "trough");
slider_context = get_style (trough_context, "slider");
highlight_context = get_style (trough_context, "highlight.top");
*height = 0;
query_size (scale_context, NULL, height);
query_size (contents_context, NULL, height);
query_size (trough_context, NULL, height);
query_size (slider_context, NULL, height);
query_size (highlight_context, NULL, height);
draw_style_common (scale_context, cr, x, y, width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (contents_context, cr, contents_x, contents_y, contents_width, contents_height,
&contents_x, &contents_y, &contents_width, &contents_height);
/* Scale trough defines its size querying slider and highlight */
trough_height = 0;
query_size (trough_context, NULL, &trough_height);
slider_height = 0;
query_size (slider_context, NULL, &slider_height);
query_size (highlight_context, NULL, &slider_height);
trough_height += slider_height;
draw_style_common (trough_context, cr, contents_x, contents_y, contents_width, trough_height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (highlight_context, cr, contents_x, contents_y,
contents_width / 2, contents_height,
NULL, NULL, NULL, NULL);
draw_style_common (slider_context, cr, contents_x + position, contents_y, contents_height, contents_height,
NULL, NULL, NULL, NULL);
g_object_unref (scale_context);
g_object_unref (contents_context);
g_object_unref (trough_context);
g_object_unref (slider_context);
g_object_unref (highlight_context);
}
static void
draw_combobox (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gboolean has_entry,
gint *height)
{
GtkStyleContext *combo_context;
GtkStyleContext *box_context;
GtkStyleContext *button_context;
GtkStyleContext *button_box_context;
GtkStyleContext *entry_context;
GtkStyleContext *arrow_context;
gint contents_x, contents_y, contents_width, contents_height;
gint button_width;
gint arrow_width, arrow_height, arrow_size;
/* This information is taken from the GtkComboBox docs, see "CSS nodes" */
combo_context = get_style (NULL, "combobox:focus");
box_context = get_style (combo_context, "box.horizontal.linked");
if (has_entry)
{
const char *siblings[3] = { "entry.combo:focus", "button.combo" , NULL };
entry_context = get_style_with_siblings (box_context, "entry.combo:focus", siblings, 0);
button_context = get_style_with_siblings (box_context, "button.combo", siblings, 1);
}
else
{
const char *siblings[2] = { "button.combo" , NULL };
button_context = get_style_with_siblings (box_context, "button.combo", siblings, 0);
}
button_box_context = get_style (button_context, "box.horizontal");
arrow_context = get_style (button_box_context, "arrow");
*height = 0;
query_size (combo_context, NULL, height);
query_size (box_context, NULL, height);
if (has_entry)
query_size (entry_context, NULL, height);
query_size (button_context, NULL, height);
query_size (button_box_context, NULL, height);
query_size (arrow_context, NULL, height);
gtk_style_context_get (arrow_context, gtk_style_context_get_state (arrow_context),
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
draw_style_common (combo_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (box_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
if (has_entry)
{
button_width = *height;
draw_style_common (entry_context, cr, x, y, width - button_width, *height, NULL, NULL, NULL, NULL);
draw_style_common (button_context, cr, x + width - button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
}
else
{
button_width = width;
draw_style_common (button_context, cr, x, y, width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
}
draw_style_common (button_box_context, cr, contents_x, contents_y, contents_width, contents_height,
NULL, NULL, NULL, NULL);
draw_style_common (arrow_context, cr, contents_x, contents_y, contents_width, contents_height,
NULL, NULL, NULL, NULL);
gtk_render_arrow (arrow_context, cr, G_PI / 2,
contents_x + contents_width - arrow_size,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
g_object_unref (arrow_context);
if (has_entry)
g_object_unref (entry_context);
g_object_unref (button_context);
g_object_unref (combo_context);
}
static void
draw_spinbutton (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint *height)
{
GtkStyleContext *spin_context;
GtkStyleContext *entry_context;
GtkStyleContext *up_context;
GtkStyleContext *down_context;
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
GdkPixbuf *pixbuf;
gint icon_width, icon_height, icon_size;
gint button_width;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkSpinButton docs, see "CSS nodes" */
spin_context = get_style (NULL, "spinbutton.horizontal:focus");
entry_context = get_style (NULL, "entry:focus");
up_context = get_style (spin_context, "button.up:focus:active");
down_context = get_style (spin_context, "button.down:focus");
*height = 0;
query_size (spin_context, NULL, height);
query_size (entry_context, NULL, height);
query_size (up_context, NULL, height);
query_size (down_context, NULL, height);
button_width = *height;
draw_style_common (spin_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (entry_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
gtk_style_context_get (up_context, gtk_style_context_get_state (up_context),
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", icon_size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, up_context, NULL, NULL);
g_object_unref (icon_info);
draw_style_common (up_context, cr, x + width - button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (up_context, cr, pixbuf, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (pixbuf);
gtk_style_context_get (down_context, gtk_style_context_get_state (down_context),
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", icon_size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, down_context, NULL, NULL);
g_object_unref (icon_info);
draw_style_common (down_context, cr, x + width - 2 * button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (down_context, cr, pixbuf, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (pixbuf);
g_object_unref (down_context);
g_object_unref (up_context);
g_object_unref (entry_context);
g_object_unref (spin_context);
}
static gboolean
draw_cb (GtkWidget *widget,
cairo_t *cr)
{
gint panewidth, width, height;
gint x, y;
width = gtk_widget_get_allocated_width (widget);
panewidth = width / 2;
height = gtk_widget_get_allocated_height (widget);
cairo_rectangle (cr, 0, 0, width, height);
cairo_set_source_rgb (cr, 0.9, 0.9, 0.9);
cairo_fill (cr);
x = y = 10;
draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 30, GTK_STATE_FLAG_NORMAL, &height);
y += height + 8;
draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 40, GTK_STATE_FLAG_PRELIGHT, &height);
y += height + 8;
draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 50, GTK_STATE_FLAG_ACTIVE|GTK_STATE_FLAG_PRELIGHT, &height);
y += height + 8;
draw_text (widget, cr, x, y, panewidth - 20, 20, "Not selected", GTK_STATE_FLAG_NORMAL);
y += 20 + 10;
draw_text (widget, cr, x, y, panewidth - 20, 20, "Selected", GTK_STATE_FLAG_SELECTED);
x = 10;
y += 20 + 10;
draw_check (widget, cr, x, y, GTK_STATE_FLAG_NORMAL, &width, &height);
x += width + 10;
draw_check (widget, cr, x, y, GTK_STATE_FLAG_CHECKED, &width, &height);
x += width + 10;
draw_radio (widget, cr, x, y, GTK_STATE_FLAG_NORMAL, &width, &height);
x += width + 10;
draw_radio (widget, cr, x, y, GTK_STATE_FLAG_CHECKED, &width, &height);
x = 10;
y += height + 10;
draw_progress (widget, cr, x, y, panewidth - 20, 50, &height);
y += height + 10;
draw_scale (widget, cr, x, y, panewidth - 20, 75, &height);
y += height + 20;
draw_notebook (widget, cr, x, y, panewidth - 20, 160);
/* Second column */
x += panewidth;
y = 10;
draw_menu (widget, cr, x, y, panewidth - 20, &height);
y += height + 10;
draw_menubar (widget, cr, x, y, panewidth - 20, &height);
y += height + 20;
draw_spinbutton (widget, cr, x, y, panewidth - 20, &height);
y += height + 30;
draw_combobox (widget, cr, x, y, panewidth - 20, FALSE, &height);
y += height + 10;
draw_combobox (widget, cr, 10 + panewidth, y, panewidth - 20, TRUE, &height);
return FALSE;
}
GtkWidget *
do_foreigndrawing (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *box;
GtkWidget *da;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Foreign drawing");
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (window), box);
da = gtk_drawing_area_new ();
gtk_widget_set_size_request (da, 400, 400);
gtk_widget_set_hexpand (da, TRUE);
gtk_widget_set_vexpand (da, TRUE);
gtk_widget_set_app_paintable (da, TRUE);
gtk_container_add (GTK_CONTAINER (box), da);
g_signal_connect (da, "draw", G_CALLBACK (draw_cb), NULL);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show_all (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -77,7 +77,7 @@ create_shader (int type,
buffer = g_malloc (log_len + 1);
glGetShaderInfoLog (shader, log_len, NULL, buffer);
g_warning ("Compile failure in %s shader:\n%s",
g_warning ("Compile failure in %s shader:\n%s\n",
type == GL_VERTEX_SHADER ? "vertex" : "fragment",
buffer);
@@ -140,7 +140,7 @@ init_shaders (GLuint *program_out,
buffer = g_malloc (log_len + 1);
glGetProgramInfoLog (program, log_len, NULL, buffer);
g_warning ("Linking failure:\n%s", buffer);
g_warning ("Linking failure:\n%s\n", buffer);
g_free (buffer);

View File

@@ -44,7 +44,7 @@ show_page (GtkTextBuffer *buffer,
if (page == 1)
{
gtk_text_buffer_insert (buffer, &iter, "Some text to show that simple ", -1);
insert_link (buffer, &iter, "hyper text", 3);
insert_link (buffer, &iter, "hypertext", 3);
gtk_text_buffer_insert (buffer, &iter, " can easily be realized with ", -1);
insert_link (buffer, &iter, "tags", 2);
gtk_text_buffer_insert (buffer, &iter, ".", -1);
@@ -173,8 +173,9 @@ event_after (GtkWidget *text_view,
GTK_TEXT_WINDOW_WIDGET,
ex, ey, &x, &y);
if (gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y))
follow_if_link (text_view, &iter);
gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y);
follow_if_link (text_view, &iter);
return TRUE;
}
@@ -196,19 +197,18 @@ set_cursor_if_appropriate (GtkTextView *text_view,
GtkTextIter iter;
gboolean hovering = FALSE;
if (gtk_text_view_get_iter_at_location (text_view, &iter, x, y))
{
tags = gtk_text_iter_get_tags (&iter);
for (tagp = tags; tagp != NULL; tagp = tagp->next)
{
GtkTextTag *tag = tagp->data;
gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
if (page != 0)
{
hovering = TRUE;
break;
}
tags = gtk_text_iter_get_tags (&iter);
for (tagp = tags; tagp != NULL; tagp = tagp->next)
{
GtkTextTag *tag = tagp->data;
gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
if (page != 0)
{
hovering = TRUE;
break;
}
}
@@ -272,8 +272,6 @@ do_hypertext (GtkWidget *do_widget)
view = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 20);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 20);
g_signal_connect (view, "key-press-event",
G_CALLBACK (key_press_event), NULL);
g_signal_connect (view, "event-after",

View File

@@ -470,31 +470,6 @@ fontify (GtkTextBuffer *source_buffer)
gchar *start_ptr, *end_ptr;
gchar *tag;
gtk_text_buffer_create_tag (source_buffer, "source",
"font", "monospace",
NULL);
gtk_text_buffer_create_tag (source_buffer, "comment",
"foreground", "DodgerBlue",
NULL);
gtk_text_buffer_create_tag (source_buffer, "type",
"foreground", "ForestGreen",
NULL);
gtk_text_buffer_create_tag (source_buffer, "string",
"foreground", "RosyBrown",
"weight", PANGO_WEIGHT_BOLD,
NULL);
gtk_text_buffer_create_tag (source_buffer, "control",
"foreground", "purple",
NULL);
gtk_text_buffer_create_tag (source_buffer, "preprocessor",
"style", PANGO_STYLE_OBLIQUE,
"foreground", "burlywood4",
NULL);
gtk_text_buffer_create_tag (source_buffer, "function",
"weight", PANGO_WEIGHT_BOLD,
"foreground", "DarkGoldenrod4",
NULL);
gtk_text_buffer_get_bounds (source_buffer, &start_iter, &tmp_iter);
gtk_text_buffer_apply_tag_by_name (source_buffer, "source", &start_iter, &tmp_iter);
@@ -581,13 +556,11 @@ add_data_tab (const gchar *demoname)
widget = create_text (&textview, FALSE);
buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_set_text (buffer, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
if (g_str_has_suffix (resource_name, ".c"))
fontify (buffer);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
}
else
{
g_warning ("Don't know how to display resource '%s'", resource_name);
g_warning ("Don't know how to display resource '%s'\n", resource_name);
widget = NULL;
}
@@ -650,6 +623,30 @@ load_file (const gchar *demoname,
NULL);
source_buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_create_tag (source_buffer, "source",
"font", "monospace",
NULL);
gtk_text_buffer_create_tag (source_buffer, "comment",
"foreground", "DodgerBlue",
NULL);
gtk_text_buffer_create_tag (source_buffer, "type",
"foreground", "ForestGreen",
NULL);
gtk_text_buffer_create_tag (source_buffer, "string",
"foreground", "RosyBrown",
"weight", PANGO_WEIGHT_BOLD,
NULL);
gtk_text_buffer_create_tag (source_buffer, "control",
"foreground", "purple",
NULL);
gtk_text_buffer_create_tag (source_buffer, "preprocessor",
"style", PANGO_STYLE_OBLIQUE,
"foreground", "burlywood4",
NULL);
gtk_text_buffer_create_tag (source_buffer, "function",
"weight", PANGO_WEIGHT_BOLD,
"foreground", "DarkGoldenrod4",
NULL);
resource_filename = g_strconcat ("/sources/", filename, NULL);
bytes = g_resources_lookup_data (resource_filename, 0, &err);
@@ -657,7 +654,7 @@ load_file (const gchar *demoname,
if (bytes == NULL)
{
g_warning ("Cannot open source for %s: %s", filename, err->message);
g_warning ("Cannot open source for %s: %s\n", filename, err->message);
g_error_free (err);
return;
}
@@ -920,7 +917,7 @@ startup (GApplication *app)
gchar *ids[] = { "appmenu", NULL };
builder = gtk_builder_new ();
gtk_builder_add_objects_from_resource (builder, "/ui/appmenu.ui", ids, NULL);
gtk_builder_add_objects_from_resource (builder, "/ui/main.ui", ids, NULL);
appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");

View File

@@ -1,6 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
<menu id="appmenu">
<section>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.about</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>
<object class="GtkTreeStore" id="treestore">
<columns>
<!-- column-name NAME -->
@@ -26,7 +41,7 @@
<property name="visible">1</property>
<property name="show-close-button">1</property>
<child>
<object class="GtkButton">
<object class="GtkButton" id="run_button">
<property name="visible">1</property>
<property name="valign">center</property>
<property name="can_focus">1</property>
@@ -35,7 +50,7 @@
<class name="text-button"/>
</style>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="run_label">
<property name="visible">1</property>
<property name="label" translatable="yes">Run</property>
</object>
@@ -45,13 +60,13 @@
</object>
</child>
<child>
<object class="GtkBox">
<object class="GtkBox" id="box1">
<property name="visible">1</property>
<child>
<object class="GtkFrame">
<property name="visible">1</property>
<child>
<object class="GtkScrolledWindow">
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="width_request">120</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
@@ -69,19 +84,15 @@
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererText"/>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="style">4</attribute>
<attribute name="text">1</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText">
<property name="text"> </property>
</object>
</child>
</object>
</child>
</object>
@@ -98,7 +109,7 @@
<property name="enable_popup">1</property>
<property name="show_border">0</property>
<child>
<object class="GtkScrolledWindow">
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">1</property>
<property name="can_focus">1</property>
<child>
@@ -122,7 +133,7 @@
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<object class="GtkLabel" id="label1">
<property name="visible">1</property>
<property name="label" translatable="yes">_Info</property>
<property name="use_underline">1</property>
@@ -155,7 +166,7 @@
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<object class="GtkLabel" id="label2">
<property name="visible">1</property>
<property name="label" translatable="yes">Source</property>
</object>

View File

@@ -8,35 +8,6 @@
#include <gtk/gtk.h>
static GtkWidget *stack;
static GtkWidget *view;
static GtkWidget *view2;
static void
source_toggled (GtkToggleButton *button)
{
if (gtk_toggle_button_get_active (button))
gtk_stack_set_visible_child_name (GTK_STACK (stack), "source");
else
{
GtkTextBuffer *buffer;
GtkTextIter start, end;
gchar *markup;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
gtk_text_buffer_get_bounds (buffer, &start, &end);
markup = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_get_bounds (buffer, &start, &end);
gtk_text_buffer_delete (buffer, &start, &end);
gtk_text_buffer_insert_markup (buffer, &start, markup, -1);
g_free (markup);
gtk_stack_set_visible_child_name (GTK_STACK (stack), "formatted");
}
}
GtkWidget *
do_markup (GtkWidget *do_widget)
{
@@ -44,13 +15,12 @@ do_markup (GtkWidget *do_widget)
if (!window)
{
GtkWidget *view;
GtkWidget *sw;
GtkTextBuffer *buffer;
GtkTextIter iter;
GBytes *bytes;
const gchar *markup;
GtkWidget *header;
GtkWidget *show_source;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
@@ -59,50 +29,19 @@ do_markup (GtkWidget *do_widget)
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
stack = gtk_stack_new ();
gtk_widget_show (stack);
gtk_container_add (GTK_CONTAINER (window), stack);
show_source = gtk_check_button_new_with_label ("Source");
gtk_widget_set_valign (show_source, GTK_ALIGN_CENTER);
g_signal_connect (show_source, "toggled", G_CALLBACK (source_toggled), stack);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), show_source);
gtk_widget_show_all (header);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_title (GTK_WINDOW (window), "Markup");
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 10);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 10);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_widget_show_all (sw);
gtk_stack_add_named (GTK_STACK (stack), sw, "formatted");
view2 = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view2), GTK_WRAP_WORD);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view2), 10);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view2), 10);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), view2);
gtk_widget_show_all (sw);
gtk_stack_add_named (GTK_STACK (stack), sw, "source");
bytes = g_resources_lookup_data ("/markup/markup.txt", 0, NULL);
markup = (const gchar *)g_bytes_get_data (bytes, NULL);
@@ -111,13 +50,9 @@ do_markup (GtkWidget *do_widget)
gtk_text_buffer_get_start_iter (buffer, &iter);
gtk_text_buffer_insert_markup (buffer, &iter, markup, -1);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
gtk_text_buffer_get_start_iter (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, markup, -1);
g_bytes_unref (bytes);
gtk_widget_show (stack);
gtk_widget_show_all (sw);
}
if (!gtk_widget_get_visible (window))

View File

@@ -1,9 +1,9 @@
Text sizes: <span size="xx-small">tiny</span> <span size="x-small">very small</span> <span size="small">small</span> <span size="medium">normal</span> <span size="large">large</span> <span size="x-large">very large</span> <span size="xx-large">huge</span>
Text <span color="gray">c<span color="green">o</span>l<span color="tomato">o</span>rs</span> and <span background="pink">backgrounds</span>
Text <span color="gray">c<span color="green">o</span>l<span color="tomato">o</span>rs</span>
Colorful <span underline="low" underline-color="blue"><span underline="double" underline-color="red">under</span>lines</span> and <span background="pink"><span underline="error">mo</span><span underline="error" underline-color="green">re</span></span>
Colorful <span underline="low" underline-color="blue"><span underline="double" underline-color="red">under</span>lines</span>
Colorful <span strikethrough="true" strikethrough-color="magenta">strikethroughs</span>

View File

@@ -328,7 +328,7 @@ gtk_rotated_bin_add (GtkContainer *container,
bin->child = widget;
}
else
g_warning ("GtkRotatedBin cannot have more than one child");
g_warning ("GtkRotatedBin cannot have more than one child\n");
}
static void

View File

@@ -267,7 +267,7 @@ gtk_mirror_bin_add (GtkContainer *container,
bin->child = widget;
}
else
g_warning ("GtkMirrorBin cannot have more than one child");
g_warning ("GtkMirrorBin cannot have more than one child\n");
}
static void
@@ -345,7 +345,7 @@ gtk_mirror_bin_get_preferred_height (GtkWidget *widget,
gtk_mirror_bin_size_request (widget, &requisition);
*minimum = *natural = requisition.height;
*minimum = *natural = requisition.width;
}
static void

View File

@@ -12,15 +12,6 @@
<key name='color' enum='org.gtk.Demo.Color'>
<default>'red'</default>
</key>
<key name='window-size' type='(ii)'>
<default>(-1, -1)</default>
</key>
<key name='maximized' type='b'>
<default>false</default>
</key>
<key name='fullscreen' type='b'>
<default>false</default>
</key>
</schema>
</schemalist>

View File

@@ -7,5 +7,60 @@
*/
* {
all: unset;
color: inherit;
font-size: inherit;
background-color: initial;
font-family: inherit;
font-style: inherit;
font-variant: inherit;
font-weight: inherit;
text-shadow: inherit;
icon-shadow: inherit;
box-shadow: initial;
margin-top: initial;
margin-left: initial;
margin-bottom: initial;
margin-right: initial;
padding-top: initial;
padding-left: initial;
padding-bottom: initial;
padding-right: initial;
border-top-style: initial;
border-top-width: initial;
border-left-style: initial;
border-left-width: initial;
border-bottom-style: initial;
border-bottom-width: initial;
border-right-style: initial;
border-right-width: initial;
border-top-left-radius: initial;
border-top-right-radius: initial;
border-bottom-right-radius: initial;
border-bottom-left-radius: initial;
outline-style: initial;
outline-width: initial;
outline-offset: initial;
background-clip: initial;
background-origin: initial;
background-size: initial;
background-position: initial;
border-top-color: initial;
border-right-color: initial;
border-bottom-color: initial;
border-left-color: initial;
outline-color: initial;
background-repeat: initial;
background-image: initial;
border-image-source: initial;
border-image-repeat: initial;
border-image-slice: initial;
border-image-width: initial;
transition-property: initial;
transition-duration: initial;
transition-timing-function: initial;
transition-delay: initial;
engine: initial;
gtk-key-bindings: initial;
-GtkNotebook-initial-gap: 0;
}

View File

@@ -12,13 +12,10 @@ static guint timeout = 0;
static void
change_direction (GtkRevealer *revealer)
{
if (gtk_widget_get_mapped (GTK_WIDGET (revealer)))
{
gboolean revealed;
gboolean revealed;
revealed = gtk_revealer_get_child_revealed (revealer);
gtk_revealer_set_reveal_child (revealer, !revealed);
}
revealed = gtk_revealer_get_child_revealed (revealer);
gtk_revealer_set_reveal_child (revealer, !revealed);
}
static gboolean

View File

@@ -4,10 +4,10 @@
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">Stack</property>
<child>
<object class="GtkGrid">
<object class="GtkGrid" id="grid1">
<property name="visible">1</property>
<child>
<object class="GtkStackSwitcher">
<object class="GtkStackSwitcher" id="switcher">
<property name="visible">1</property>
<property name="stack">stack</property>
<property name="halign">center</property>
@@ -23,7 +23,7 @@
<property name="can_focus">1</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkImage">
<object class="GtkImage" id="image1">
<property name="visible">1</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
@@ -35,7 +35,7 @@
</packing>
</child>
<child>
<object class="GtkCheckButton">
<object class="GtkCheckButton" id="checkbutton1">
<property name="label" translatable="yes">Page 2</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
@@ -49,7 +49,7 @@
</packing>
</child>
<child>
<object class="GtkSpinner">
<object class="GtkSpinner" id="spinner1">
<property name="visible">1</property>
<property name="halign">center</property>
<property name="valign">center</property>

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkGrid" id="grid">
<property name="row-spacing">10</property>
<property name="row-spacing">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar">
<object class="GtkToolbar" id="toolbar1">
<property name="visible">1</property>
<property name="hexpand">1</property>
<property name="show-arrow">0</property>
@@ -12,7 +12,7 @@
<class name="primary-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="toolbutton1">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="use_action_appearance">0</property>
@@ -26,7 +26,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="toolbutton2">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="use_action_appearance">0</property>
@@ -41,7 +41,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="toolbutton3">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="sensitive">0</property>
@@ -55,7 +55,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="toolbutton5">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="label" translatable="yes">Raised</property>
@@ -71,7 +71,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="toolbutton6">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="label" translatable="yes">Raised Active</property>
@@ -88,7 +88,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="toolbutton4">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="sensitive">0</property>
@@ -103,7 +103,7 @@
</packing>
</child>
<child>
<object class="GtkToolItem">
<object class="GtkToolItem" id="toolitementry">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<child>
@@ -118,7 +118,7 @@
</object>
</child>
<child>
<object class="GtkToolItem">
<object class="GtkToolItem" id="toolitemswitch">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<child>
@@ -132,7 +132,7 @@
</object>
</child>
<child>
<object class="GtkBox">
<object class="GtkBox" id="box1">
<property name="visible">1</property>
<property name="valign">center</property>
<property name="halign">center</property>
@@ -140,7 +140,7 @@
<class name="linked"/>
</style>
<child>
<object class="GtkButton">
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">Hi, I am a button</property>
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
@@ -150,8 +150,8 @@
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">And I'm another button</property>
<object class="GtkButton" id="button2">
<property name="label" translatable="yes">And I&apos;m another button</property>
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
@@ -163,7 +163,7 @@
</packing>
</child>
<child>
<object class="GtkButton">
<object class="GtkButton" id="button3">
<property name="label" translatable="yes">This is a button party!</property>
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
@@ -178,16 +178,15 @@
</object>
</child>
<child>
<object class="GtkToolbar">
<object class="GtkToolbar" id="itoolbar1">
<property name="visible">1</property>
<property name="hexpand">1</property>
<property name="icon_size">1</property>
<property name="toolbar-style">icons</property>
<style>
<class name="inline-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="itoolbutton1">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="use_action_appearance">0</property>
@@ -200,7 +199,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="itoolbutton2">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="use_action_appearance">0</property>
@@ -213,7 +212,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="itoolbutton3">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="use_action_appearance">0</property>
@@ -227,7 +226,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="itoolbutton4">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="use_action_appearance">0</property>
@@ -241,7 +240,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="itoolbutton5">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="sensitive">0</property>
@@ -255,7 +254,7 @@
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<object class="GtkToggleToolButton" id="itoolbutton6">
<property name="use_action_appearance">0</property>
<property name="visible">1</property>
<property name="sensitive">0</property>
@@ -271,40 +270,5 @@
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="spacing">10</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Plain</property>
<property name="halign">end</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Destructive</property>
<style>
<class name="destructive-action"/>
</style>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Suggested</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -1,4 +1,4 @@
/* Theming/Style Classes
/* CSS Theming/Style Classes
*
* GTK+ uses CSS for theming. Style classes can be associated
* with widgets to inform the theme about intended rendering.
@@ -24,7 +24,6 @@ do_theming_style_classes (GtkWidget *do_widget)
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Style Classes");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -31,7 +31,7 @@ resources.c: iconbrowser.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourc
--target=$@ --sourcedir=$(srcdir) --generate-source
EXTRA_DIST = \
menus.ui \
app-menu.ui \
iconbrowser.gresource.xml \
window.ui

View File

@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="app-menu">
<menu id="appmenu">
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gtk/iconbrowser/gtk">
<gresource prefix="/org/gtk/iconbrowser">
<file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">menus.ui</file>
<file preprocess="xml-stripblanks">app-menu.ui</file>
</gresource>
</gresources>

View File

@@ -36,6 +36,8 @@ static GActionEntry app_entries[] =
static void
icon_browser_app_startup (GApplication *app)
{
GtkBuilder *builder;
GMenuModel *app_menu;
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
G_APPLICATION_CLASS (icon_browser_app_parent_class)->startup (app);
@@ -46,6 +48,11 @@ icon_browser_app_startup (GApplication *app)
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
"app.quit",
quit_accels);
builder = gtk_builder_new_from_resource ("/org/gtk/iconbrowser/app-menu.ui");
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
gtk_application_set_app_menu (GTK_APPLICATION (app), app_menu);
g_object_unref (builder);
}
static void

View File

@@ -840,7 +840,7 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
g_type_ensure (ICON_STORE_TYPE);
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
"/org/gtk/iconbrowser/gtk/window.ui");
"/org/gtk/iconbrowser/window.ui");
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, context_list);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, filter_model);

View File

@@ -38,25 +38,6 @@ change_theme_state (GSimpleAction *action,
g_simple_action_set_state (action, state);
}
static GtkWidget *page_stack;
static void
change_transition_state (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GtkStackTransitionType transition;
if (g_variant_get_boolean (state))
transition = GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT;
else
transition = GTK_STACK_TRANSITION_TYPE_NONE;
gtk_stack_set_transition_type (GTK_STACK (page_stack), transition);
g_simple_action_set_state (action, state);
}
static gboolean
get_idle (gpointer data)
{
@@ -805,39 +786,10 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
row = gtk_widget_get_parent (row);
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
g_object_set_data (G_OBJECT (widget), color, row);
g_object_set_data (G_OBJECT (row), "color", (gpointer)color);
}
static void
rgba_changed (GtkColorChooser *chooser, GParamSpec *pspec, GtkListBox *box)
{
gtk_list_box_select_row (box, NULL);
}
static void
set_color (GtkListBox *box, GtkListBoxRow *row, GtkColorChooser *chooser)
{
const char *color;
GdkRGBA rgba;
if (!row)
return;
color = (const char *)g_object_get_data (G_OBJECT (row), "color");
if (!color)
return;
if (gdk_rgba_parse (&rgba, color))
{
g_signal_handlers_block_by_func (chooser, rgba_changed, box);
gtk_color_chooser_set_rgba (chooser, &rgba);
g_signal_handlers_unblock_by_func (chooser, rgba_changed, box);
}
}
static void
populate_colors (GtkWidget *widget, GtkWidget *chooser)
populate_colors (GtkWidget *widget)
{
struct { const gchar *name; const gchar *color; const gchar *title; } colors[] = {
{ "2.5", "#C8828C", "Red" },
@@ -915,13 +867,10 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser)
gtk_list_box_insert (GTK_LIST_BOX (widget), row, -1);
row = gtk_widget_get_parent (row);
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
g_object_set_data (G_OBJECT (row), "color", (gpointer)colors[i].color);
if (colors[i].title)
g_object_set_data (G_OBJECT (row), "title", (gpointer)colors[i].title);
}
g_signal_connect (widget, "row-selected", G_CALLBACK (set_color), chooser);
gtk_list_box_invalidate_headers (GTK_LIST_BOX (widget));
sw = gtk_widget_get_ancestor (widget, GTK_TYPE_SCROLLED_WINDOW);
@@ -1507,124 +1456,6 @@ g_test_permission_class_init (GTestPermissionClass *class)
permission_class->release_finish = release_finish;
}
static int icon_sizes[5];
static void
register_icon_sizes (void)
{
static gboolean registered;
if (registered)
return;
registered = TRUE;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
icon_sizes[0] = gtk_icon_size_register ("a", 16, 16);
icon_sizes[1] = gtk_icon_size_register ("b", 24, 24);
icon_sizes[2] = gtk_icon_size_register ("c", 32, 32);
icon_sizes[3] = gtk_icon_size_register ("d", 48, 48);
icon_sizes[4] = gtk_icon_size_register ("e", 64, 64);
G_GNUC_END_IGNORE_DEPRECATIONS
}
static int
find_icon_size (GtkIconSize size)
{
gint w, h, w2, h2;
gint i;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_icon_size_lookup (size, &w, &h);
for (i = 0; i < G_N_ELEMENTS (icon_sizes); i++)
{
gtk_icon_size_lookup (icon_sizes[i], &w2, &h2);
if (w == w2)
return i;
}
G_GNUC_END_IGNORE_DEPRECATIONS
return 2;
}
static void
update_buttons (GtkWidget *iv, int pos)
{
GtkWidget *button;
button = GTK_WIDGET (g_object_get_data (G_OBJECT (iv), "increase_button"));
gtk_widget_set_sensitive (button, pos + 1 < G_N_ELEMENTS (icon_sizes));
button = GTK_WIDGET (g_object_get_data (G_OBJECT (iv), "decrease_button"));
gtk_widget_set_sensitive (button, pos > 0);
}
static void
increase_icon_size (GtkWidget *iv)
{
GList *cells;
GtkCellRendererPixbuf *cell;
GtkIconSize size;
int i;
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (iv));
cell = cells->data;
g_list_free (cells);
g_object_get (cell, "stock-size", &size, NULL);
i = find_icon_size (size);
i = CLAMP (i + 1, 0, G_N_ELEMENTS (icon_sizes) - 1);
size = icon_sizes[i];
g_object_set (cell, "stock-size", size, NULL);
update_buttons (iv, i);
gtk_widget_queue_resize (iv);
}
static void
decrease_icon_size (GtkWidget *iv)
{
GList *cells;
GtkCellRendererPixbuf *cell;
GtkIconSize size;
int i;
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (iv));
cell = cells->data;
g_list_free (cells);
g_object_get (cell, "stock-size", &size, NULL);
i = find_icon_size (size);
i = CLAMP (i - 1, 0, G_N_ELEMENTS (icon_sizes) - 1);
size = icon_sizes[i];
g_object_set (cell, "stock-size", size, NULL);
update_buttons (iv, i);
gtk_widget_queue_resize (iv);
}
static void
reset_icon_size (GtkWidget *iv)
{
GList *cells;
GtkCellRendererPixbuf *cell;
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (iv));
cell = cells->data;
g_list_free (cells);
g_object_set (cell, "stock-size", icon_sizes[2], NULL);
update_buttons (iv, 2);
gtk_widget_queue_resize (iv);
}
static void
activate (GApplication *app)
{
@@ -1640,7 +1471,6 @@ activate (GApplication *app)
GtkCssProvider *provider;
static GActionEntry win_entries[] = {
{ "dark", NULL, NULL, "false", change_theme_state },
{ "transition", NULL, NULL, "false", change_transition_state },
{ "search", activate_search, NULL, NULL, NULL },
{ "delete", activate_delete, NULL, NULL, NULL },
{ "busy", get_busy, NULL, NULL, NULL },
@@ -1668,7 +1498,6 @@ activate (GApplication *app)
GAction *action;
g_type_ensure (my_text_view_get_type ());
register_icon_sizes ();
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory/widget-factory.css");
@@ -1687,9 +1516,6 @@ activate (GApplication *app)
gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed);
gtk_builder_add_callback_symbol (builder, "osd_frame_button_press", (GCallback)osd_frame_button_press);
gtk_builder_add_callback_symbol (builder, "tab_close_cb", (GCallback)tab_close_cb);
gtk_builder_add_callback_symbol (builder, "increase_icon_size", (GCallback)increase_icon_size);
gtk_builder_add_callback_symbol (builder, "decrease_icon_size", (GCallback)decrease_icon_size);
gtk_builder_add_callback_symbol (builder, "reset_icon_size", (GCallback)reset_icon_size);
gtk_builder_connect_signals (builder, NULL);
@@ -1777,8 +1603,6 @@ activate (GApplication *app)
g_signal_connect (stack, "notify::visible-child-name", G_CALLBACK (page_changed_cb), NULL);
page_changed_cb (stack, NULL, NULL);
page_stack = stack;
dialog = (GtkWidget *)gtk_builder_get_object (builder, "preference_dialog");
g_signal_connect (dialog, "response", G_CALLBACK (close_dialog), NULL);
widget = (GtkWidget *)gtk_builder_get_object (builder, "preference_dialog_button");
@@ -1802,11 +1626,7 @@ activate (GApplication *app)
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget), row_separator_func, NULL, NULL);
gtk_tree_view_expand_all (GTK_TREE_VIEW (widget));
widget = GTK_WIDGET (gtk_builder_get_object (builder, "munsell"));
widget2 = GTK_WIDGET (gtk_builder_get_object (builder, "cchooser"));
populate_colors (widget, widget2);
g_signal_connect (widget2, "notify::rgba", G_CALLBACK (rgba_changed), widget);
populate_colors ((GtkWidget *)gtk_builder_get_object (builder, "munsell"));
widget = (GtkWidget *)gtk_builder_get_object (builder, "page_combo");
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (widget), page_combo_separator_func, NULL, NULL);
@@ -1890,12 +1710,6 @@ activate (GApplication *app)
gtk_lock_button_set_permission (GTK_LOCK_BUTTON (widget2), permission);
g_object_unref (permission);
widget = (GtkWidget *)gtk_builder_get_object (builder, "iconview1");
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "increase_button");
g_object_set_data (G_OBJECT (widget), "increase_button", widget2);
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "decrease_button");
g_object_set_data (G_OBJECT (widget), "decrease_button", widget2);
gtk_widget_show_all (GTK_WIDGET (window));
g_object_unref (builder);

View File

@@ -11,10 +11,6 @@
<attribute name="label" translatable="yes">Dark Theme</attribute>
<attribute name="action">win.dark</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Slide Pages</attribute>
<attribute name="action">win.transition</attribute>
</item>
</section>
</menu>
<menu id="dinner_menu">
@@ -132,8 +128,6 @@
<column type="gchararray"/>
<!-- column-name Nick -->
<column type="gchararray"/>
<!-- column-name isRadio -->
<column type="gboolean"/>
</columns>
<data>
<row>
@@ -141,28 +135,18 @@
<col id="1">emblem-default-symbolic</col>
<col id="2" translatable="yes">Andrea</col>
<col id="3" translatable="yes">Cimi</col>
<col id="4">False</col>
</row>
<row>
<col id="0">False</col>
<col id="1">emblem-important-symbolic</col>
<col id="2" translatable="yes">Otto</col>
<col id="3" translatable="yes">chaotic</col>
<col id="4">False</col>
</row>
<row>
<col id="0">True</col>
<col id="1">weather-clear-night-symbolic</col>
<col id="2" translatable="yes">Orville</col>
<col id="3" translatable="yes">Redenbacher</col>
<col id="4">False</col>
</row>
<row>
<col id="0">True</col>
<col id="1">face-monkey-symbolic</col>
<col id="2" translatable="yes">Benjamin</col>
<col id="3" translatable="yes">Company</col>
<col id="4">True</col>
</row>
</data>
</object>
@@ -436,7 +420,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkStack" id="toplevel_stack">
<property name="visible">1</property>
<property name="transition-duration">1000</property>
<child>
<object class="GtkBox" id="page1">
<property name="visible">1</property>
@@ -635,8 +618,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="invisible_char">•</property>
<property name="width-chars">2</property>
<property name="max-width-chars">2</property>
<property name="adjustment">adjustment2</property>
</object>
<packing>
@@ -650,8 +631,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="can_focus">1</property>
<property name="invisible_char">•</property>
<property name="sensitive">0</property>
<property name="width-chars">2</property>
<property name="max-width-chars">2</property>
</object>
<packing>
<property name="fill">0</property>
@@ -1115,11 +1094,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="max-value">5</property>
<property name="value">2</property>
<property name="mode">1</property>
<offsets>
<offset name="low" value="1"/>
<offset name="high" value="4"/>
<offset name="full" value="5"/>
</offsets>
</object>
<packing>
<property name="position">11</property>
@@ -1402,7 +1376,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkCellRendererToggle" id="cellrenderertoggle1"/>
<attributes>
<attribute name="active">0</attribute>
<attribute name="radio">4</attribute>
</attributes>
</child>
</object>
@@ -2756,65 +2729,23 @@ microphone-sensitivity-medium-symbolic</property>
<property name="can_focus">1</property>
<property name="expanded">1</property>
<child>
<object class="GtkBox">
<object class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<property name="can_focus">1</property>
<property name="shadow_type">in</property>
<property name="margin-top">6</property>
<property name="height_request">226</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow3">
<object class="GtkIconView" id="iconview1">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="shadow_type">in</property>
<property name="margin-top">6</property>
<property name="height_request">226</property>
<property name="selection_mode">multiple</property>
<property name="model">iconsmodel</property>
<child>
<object class="GtkIconView" id="iconview1">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="selection_mode">multiple</property>
<property name="model">iconsmodel</property>
<child>
<object class="GtkCellRendererPixbuf" id="iconviewcell">
<property name="stock-size">5</property>
</object>
<attributes>
<attribute name="icon-name">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolbar">
<property name="visible">1</property>
<property name="icon-size">1</property>
<property name="toolbar-style">icons</property>
<style>
<class name="inline-toolbar"/>
</style>
<child>
<object class="GtkToolButton" id="decrease_button">
<property name="visible">1</property>
<property name="icon-name">zoom-out-symbolic</property>
<property name="label">Remove item</property>
<signal name="clicked" handler="decrease_icon_size" object="iconview1" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkToolButton" id="increase_button">
<property name="visible">1</property>
<property name="icon-name">zoom-in-symbolic</property>
<property name="label">Add item</property>
<signal name="clicked" handler="increase_icon_size" object="iconview1" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkToolButton" id="reset_button">
<property name="visible">1</property>
<property name="icon-name">zoom-original-symbolic</property>
<property name="label">Refresh</property>
<signal name="clicked" handler="reset_icon_size" object="iconview1" swapped="yes"/>
</object>
<object class="GtkCellRendererPixbuf" id="iconviewcell"/>
<attributes>
<attribute name="icon-name">0</attribute>
</attributes>
</child>
</object>
</child>
@@ -3754,8 +3685,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<style>
<class name="image-button"/>
<class name="circular"/>
<class name="flat"/>
<class name="sidebar-button"/>
</style>
</object>
</child>
@@ -3834,9 +3764,10 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkColorChooserWidget" id="cchooser">
<object class="GtkSpinner">
<property name="visible">1</property>
<property name="show-editor">1</property>
<property name="active">1</property>
<property name="expand">1</property>
</object>
</child>
</object>

View File

@@ -26,27 +26,12 @@ IGNORE_HFILES= \
gdkkeysyms.h \
gdkinternals.h \
gdkprivate.h \
gdk-private.h \
gdkapplaunchcontextprivate.h \
gdkcursorprivate.h \
gdkdevicemanagerprivate.h \
gdkdeviceprivate.h \
gdkdisplaymanagerprivate.h \
gdkdisplayprivate.h \
gdkdndprivate.h \
gdkframeclockprivate.h \
gdkglcontextprivate.h \
gdkkeysprivate.h \
gdkscreenprivate.h \
gdkseatdefaultprivate.h \
gdkseatprivate.h \
gdkvisualprivate.h \
gdk*private.h \
keyname-table.h \
wayland/xdg-shell-client-protocol.h \
win32 \
x11 \
quartz \
broadway \
wayland
quartz
# Extra files to add when scanning
EXTRA_HFILES= \

View File

@@ -638,6 +638,9 @@ gdk_rectangle_intersect
gdk_rectangle_union
gdk_rectangle_equal
<SUBSECTION>
GdkBorder
<SUBSECTION Private>
gdk_rectangle_get_type
</SECTION>
@@ -856,7 +859,6 @@ gdk_event_get_keyval
gdk_event_get_root_coords
gdk_event_get_scroll_direction
gdk_event_get_scroll_deltas
gdk_event_is_scroll_stop_event
gdk_event_get_state
gdk_event_get_time
gdk_event_get_window
@@ -976,7 +978,6 @@ gdk_cursor_get_type
<TITLE>Drag and Drop</TITLE>
<FILE>dnd</FILE>
GdkDragContext
GdkDragCancelReason
gdk_drag_get_selection
gdk_drag_abort
gdk_drop_reply
@@ -1005,7 +1006,6 @@ gdk_drag_context_get_dest_window
gdk_drag_context_get_protocol
gdk_drag_context_get_drag_window
gdk_drag_context_set_hotspot
gdk_drag_context_manage_dnd
<SUBSECTION Standard>
GDK_DRAG_CONTEXT
@@ -1344,7 +1344,6 @@ gdk_gl_context_set_debug_enabled
gdk_gl_context_get_debug_enabled
gdk_gl_context_set_forward_compatible
gdk_gl_context_get_forward_compatible
gdk_gl_context_is_legacy
<SUBSECTION>
GdkGLError

View File

@@ -281,45 +281,43 @@ MKHTML_OPTIONS="--path=\"$(abs_srcdir):$(top_srcdir)/examples\""
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
content_files = \
broadway.xml \
broadwayd.xml \
version.xml \
running.sgml \
building.sgml \
compiling.sgml \
css-overview.xml \
css-properties.xml \
drawing-model.xml \
getting_started.xml \
glossary.xml \
gtk3-demo-application.xml \
gtk3-demo.xml \
gtk3-icon-browser.xml \
gtk3-widget-factory.xml \
gtk-builder-tool.xml \
gtk-encode-symbolic-svg.xml \
gtk-launch.xml \
gtk-query-immodules-3.0.xml \
gtk-query-settings.xml \
gtk-update-icon-cache.xml \
input-handling.xml \
migrating-2to3.xml \
migrating-checklist.sgml \
migrating-unique-GtkApplication.xml \
migrating-smclient-GtkApplication.xml \
migrating-GtkGrid.xml \
migrating-GtkStyleContext.xml \
migrating-smclient-GtkApplication.xml \
migrating-unique-GtkApplication.xml \
mir.xml \
osx.sgml \
overview.xml \
broadway.xml \
wayland.xml \
mir.xml \
question_index.sgml \
resources.sgml \
running.sgml \
text_widget.sgml \
tree_widget.sgml \
version.xml \
visual_index.xml \
wayland.xml \
windows.sgml \
x11.sgml
x11.sgml \
gtk3-demo.xml \
gtk3-demo-application.xml \
gtk3-widget-factory.xml \
gtk3-icon-browser.xml \
gtk-query-immodules-3.0.xml \
gtk-update-icon-cache.xml \
gtk-encode-symbolic-svg.xml \
gtk-launch.xml \
broadwayd.xml \
gtk-builder-tool.xml \
input-handling.xml \
visual_index.xml \
getting_started.xml \
overview.xml \
gtk-query-settings.xml
expand_content_files = \
compiling.sgml \
@@ -329,10 +327,10 @@ expand_content_files = \
input-handling.xml \
migrating-2to3.xml \
migrating-checklist.sgml \
migrating-unique-GtkApplication.xml \
migrating-smclient-GtkApplication.xml \
migrating-GtkGrid.xml \
migrating-GtkStyleContext.xml \
migrating-smclient-GtkApplication.xml \
migrating-unique-GtkApplication.xml \
question_index.sgml \
text_widget.sgml \
tree_widget.sgml

View File

@@ -43,10 +43,10 @@ To use broadwayd, start it like this:
<programlisting>
broadwayd :5
</programlisting>
Then point your web browser at <literal>http://127.0.0.1:8085</literal>.
Then point your web browser at <literal>http://127.0.0.1:8084</literal>.
Start your applications like this:
<programlisting>
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk3-demo
BROADWAY_DISPLAY=:5 gtk3-demo
</programlisting>
</para>
@@ -58,11 +58,11 @@ GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk3-demo
<title><envar>BROADWAY_DISPLAY</envar></title>
<para>
Specifies the Broadway display number. The default display is 0.
Specifies the Broadway display number. The default display is 1.
The display number determines the port to use when connecting
to a Broadway application via the following formula:
<programlisting>
<replaceable>port</replaceable> = 8080 + <replaceable>display</replaceable>
<replaceable>port</replaceable> = 8080 + (<replaceable>display</replaceable> - 1)
</programlisting>
</para>
</formalpara>

View File

@@ -45,14 +45,14 @@ windows in the same web browser, by connecting to broadwayd.
</para>
<para>
When using broadwayd, specify the display number to use, prefixed
with a colon, similar to X. The default display number is 0.
with a colon, similar to X. The default display number is 1.
<programlisting>
broadwayd :5
</programlisting>
Then point your web browser at <literal>http://127.0.0.1:8085</literal>.
Then point your web browser at <literal>http://127.0.0.1:8084</literal>.
Start your applications like this:
<programlisting>
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk3-demo
BROADWAY_DISPLAY=:5 gtk3-demo
</programlisting>
You can add password protection for your session by creating a file in

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2196
docs/reference/gtk/css.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -211,7 +211,7 @@
<para>When creating an application, you'll want to put more than one widget
inside a window.
When you want to put more than one widget into a window,
When you want to put more than one widget into a window, it
it becomes important to control how each widget is positioned and sized.
This is where packing comes in.</para>

View File

@@ -31,7 +31,6 @@
<cmdsynopsis>
<command>gtk-builder-tool</command>
<arg choice="opt"><replaceable>COMMAND</replaceable></arg>
<arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
<arg choice="plain"><replaceable>FILE</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -63,26 +62,6 @@
<term><option>enumerate</option></term>
<listitem><para>Lists all the named objects that are created in the .ui file.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>preview</option></term>
<listitem><para>Preview the .ui file. This command accepts options
to specify the ID of an object and a .css file to use.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Preview Options</title>
<para>The <option>preview</option> command accepts the following options:</para>
<variablelist>
<varlistentry>
<term><option>--id=<arg choice="plain">ID</arg></option></term>
<listitem><para>The ID of the object to preview. If not specified,
gtk-builder-tool will choose a suitable object on its own.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--css=<arg choice="plain">FILE</arg></option></term>
<listitem><para>Load style information from the given .css file.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@@ -375,8 +375,7 @@
<part id="theming">
<title>Theming in GTK+</title>
<xi:include href="css-overview.xml" />
<xi:include href="css-properties.xml" />
<xi:include href="css.xml" />
<xi:include href="xml/gtkstylecontext.xml" />
<xi:include href="xml/gtkcssprovider.xml" />
<xi:include href="xml/gtkstyleprovider.xml" />

View File

@@ -31,8 +31,7 @@
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk-launch</command>
<arg choice="opt" rep="repeat">OPTION</arg>
<arg choice="plain">APPLICATION</arg>
<arg>APPLICATION</arg>
<arg choice="opt" rep="repeat">URI</arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -63,12 +62,6 @@ application.
<listitem><para>Prints a short help text and exits.</para></listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term><option>--version</option></term>
<listitem><para>Prints the program version and exits.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -36,7 +36,7 @@
<refsect1><title>Description</title>
<para>
<command>gtk3-icon-browser</command> is a utility to explore the icons
<command>gtk3-icon-browswer</command> is a utility to explore the icons
in the current icon theme. It shows icons in various sizes, their symbolic
variants where available, as well as a description of the icon and its context.
</para>

View File

@@ -3541,7 +3541,6 @@ gtk_status_icon_get_type
<TITLE>GtkLevelBar</TITLE>
GTK_LEVEL_BAR_OFFSET_LOW
GTK_LEVEL_BAR_OFFSET_HIGH
GTK_LEVEL_BAR_OFFSET_FULL
GtkLevelBarMode
GtkLevelBar
gtk_level_bar_new
@@ -3951,7 +3950,6 @@ gtk_text_view_set_editable
gtk_text_view_get_editable
gtk_text_view_set_cursor_visible
gtk_text_view_get_cursor_visible
gtk_text_view_reset_cursor_blink
gtk_text_view_set_overwrite
gtk_text_view_get_overwrite
gtk_text_view_set_pixels_above_lines
@@ -6182,7 +6180,6 @@ GTK_STYLE_CLASS_VERTICAL
GTK_STYLE_CLASS_VIEW
GTK_STYLE_CLASS_WARNING
GTK_STYLE_CLASS_WIDE
<SUBSECTION>
GTK_STYLE_REGION_COLUMN
GTK_STYLE_REGION_COLUMN_HEADER
GTK_STYLE_REGION_ROW
@@ -6259,7 +6256,6 @@ gtk_border_free
<SUBSECTION>
gtk_render_arrow
gtk_render_background
gtk_render_background_get_clip
gtk_render_check
gtk_render_expander
gtk_render_extension

View File

@@ -1133,7 +1133,7 @@ gtk_arrow_draw (GtkWidget *widget,
The default values for the #GtkScrolledWindow:hscrollbar-policy and
#GtkScrolledWindow:vscrollbar-policy properties have been changed from
'never' to 'automatic'. If your application was relying on the default
value, you will have to set it explicitly.
value, you will have explicitly set it explicitly.
</para>
<para>
@@ -1205,12 +1205,6 @@ gtk_arrow_draw (GtkWidget *widget,
have disappeared, and instead there are now
gtk_window_set_has_resize_grip() and gtk_window_get_has_resize_grip().
</para>
<para>
In more recent versions of GTK+ 3, the resize grip functionality has
been removed entirely, in favor of invisible resize borders around the
window. When updating to newer versions of GTK+ 3, you should simply
remove all code dealing with resize grips.
</para>
</section>
<section>

View File

@@ -140,11 +140,11 @@ additional environment variables.
<variablelist>
<varlistentry>
<term>actions</term>
<listitem><para>Actions and menu models</para></listitem>
<listitem><para>Actions and menu models.</para></listitem>
</varlistentry>
<varlistentry>
<term>baselines</term>
<listitem><para>Show baselines</para></listitem>
<listitem><para>Baselines.</para></listitem>
</varlistentry>
<varlistentry>
<term>builder</term>
@@ -160,7 +160,7 @@ additional environment variables.
</varlistentry>
<varlistentry>
<term>interactive</term>
<listitem><para>Open the <link linkend="interactive-debugging">interactive debugger</link></para></listitem>
<listitem><para>Open the <link linkend="interactive-debugging">interactive debugger</link>.</para></listitem>
</varlistentry>
<varlistentry>
<term>keybindings</term>
@@ -176,11 +176,11 @@ additional environment variables.
</varlistentry>
<varlistentry>
<term>no-css-cache</term>
<listitem><para>Bypass caching for CSS style properties</para></listitem>
<listitem><para>Bypass caching for CSS style properties.</para></listitem>
</varlistentry>
<varlistentry>
<term>no-pixel-cache</term>
<listitem><para>Disable the pixel cache</para></listitem>
<listitem><para>Disable the pixel cache.</para></listitem>
</varlistentry>
<varlistentry>
<term>plugsocket</term>
@@ -188,7 +188,7 @@ additional environment variables.
</varlistentry>
<varlistentry>
<term>pixel-cache</term>
<listitem><para>Pixel cache</para></listitem>
<listitem><para>Pixel cache.</para></listitem>
</varlistentry>
<varlistentry>
<term>printing</term>
@@ -218,10 +218,7 @@ additional environment variables.
<term>resize</term>
<listitem><para>Highlight resizing widgets</para></listitem>
</varlistentry>
<varlistentry>
<term>layout</term>
<listitem><para>Show layout borders</para></listitem>
</varlistentry>
</variablelist>
The special value <literal>all</literal> can be used to turn on all
debug options. The special value <literal>help</literal> can be used
@@ -480,7 +477,7 @@ nevertheless.
<para>
If set, selects the GDK backend to use. Selecting a backend requires that
GTK+ is compiled with support for that backend. The following backends can
be selected, provided they are included in the GDK libraries you are using:
be selected:
<variablelist>
<varlistentry>
@@ -516,8 +513,7 @@ nevertheless.
</variablelist>
Since 3.10, this environment variable can contain a comma-separated list
of backend names, which are tried in order. The list may also contain
a *, which means: try all remaining backends. The special value "help" can
be used to make GDK print out a list of all available backends.
a *, which means: try all remaining backends.
For more information about selecting backends, see the gdk_display_manager_get() function.
</para>
</formalpara>

View File

@@ -13,7 +13,7 @@ all: exampleapp
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS)
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f $(OBJS)

View File

@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --source
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid

View File

@@ -29,6 +29,7 @@
<child type="title">
<object class="GtkStackSwitcher" id="tabs">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">stack</property>
</object>
</child>

View File

@@ -18,7 +18,7 @@ resources.c: exampleapp.gresource.xml window.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS)
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f $(BUILT_SRC)

View File

@@ -15,6 +15,7 @@
<child type="title">
<object class="GtkStackSwitcher" id="tabs">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">stack</property>
</object>
</child>

View File

@@ -18,7 +18,7 @@ resources.c: exampleapp.gresource.xml window.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS)
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f $(BUILT_SRC)

View File

@@ -15,6 +15,7 @@
<child type="title">
<object class="GtkStackSwitcher" id="tabs">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">stack</property>
</object>
</child>

View File

@@ -18,7 +18,7 @@ resources.c: exampleapp.gresource.xml window.ui app-menu.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS)
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f $(BUILT_SRC)

View File

@@ -15,6 +15,7 @@
<child type="title">
<object class="GtkStackSwitcher" id="tabs">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">stack</property>
</object>
</child>

View File

@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml window.ui app-menu.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid

View File

@@ -15,6 +15,7 @@
<child type="title">
<object class="GtkStackSwitcher" id="tabs">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">stack</property>
</object>
</child>

View File

@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml window.ui app-menu.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid

View File

@@ -15,6 +15,7 @@
<child type="title">
<object class="GtkStackSwitcher" id="tabs">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">stack</property>
</object>
</child>

View File

@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --source
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid

View File

@@ -15,6 +15,7 @@
<child type="title">
<object class="GtkStackSwitcher" id="tabs">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">stack</property>
</object>
</child>

View File

@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --source
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid

View File

@@ -15,6 +15,7 @@
<child type="title">
<object class="GtkStackSwitcher" id="tabs">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">stack</property>
</object>
</child>

View File

@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --source
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid

View File

@@ -32,6 +32,7 @@
<child type="title">
<object class="GtkStackSwitcher" id="tabs">
<property name="visible">True</property>
<property name="margin">6</property>
<property name="stack">stack</property>
</object>
</child>

View File

@@ -249,7 +249,7 @@ enable_plugin (const gchar *name)
g_print ("Menus of '%s' plugin added\n", name);
}
else
g_warning ("Plugin menu not found");
g_warning ("Plugin menu not found\n");
if (g_strcmp0 (name, "red") == 0)
is_red_plugin_enabled = TRUE;
@@ -284,7 +284,7 @@ disable_plugin (const gchar *name)
}
}
else
g_warning ("Plugin menu not found");
g_warning ("Plugin menu not found\n");
g_action_map_remove_action (G_ACTION_MAP (g_application_get_default ()), name);
g_print ("Actions of '%s' plugin removed\n", name);

View File

@@ -312,12 +312,14 @@ w32_introspection_files = \
win32/gdkevents-win32.c \
win32/gdkgeometry-win32.c \
win32/gdkglobals-win32.c \
win32/gdkinput.c \
win32/gdkkeys-win32.c \
win32/gdkmain-win32.c \
win32/gdkproperty-win32.c \
win32/gdkscreen-win32.c \
win32/gdkselection-win32.c \
win32/gdktestutils-win32.c \
win32/gdkvisual-win32.c \
win32/gdkwin32.h \
win32/gdkwin32cursor.h \
win32/gdkwin32display.h \
@@ -372,7 +374,7 @@ endif
if MS_LIB_AVAILABLE
noinst_DATA = gdk-win32-$(GTK_API_VERSION).lib
gdk-win32-$(GTK_API_VERSION).lib: libgdk-3.la gdk.def
gdk-win32-$(GTK_API_VERSION).lib: libgdk-win32-$(GTK_API_VERSION).la gdk.def
lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgdk-win32-$(GTK_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:gdk.def -out:$@
install-ms-lib:

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