Compare commits

..

1 Commits

Author SHA1 Message Date
Luca Bacci 5b4d4b17ed WIP 2024-10-10 10:39:15 +02:00
157 changed files with 5141 additions and 4575 deletions
-2
View File
@@ -1,4 +1,2 @@
/subprojects/*/
.flatpak-builder/
.vscode/
subprojects/*.wrap
+22
View File
@@ -327,6 +327,20 @@ flatpak:widget-factory:aarch64:
variables:
APPID: org.gtk.WidgetFactory4
flatpak:icon-browser:
extends: '.flatpak-defaults'
needs: []
variables:
APPID: org.gtk.IconBrowser4
flatpak:icon-browser:aarch64:
extends: '.flatpak-defaults'
needs: []
tags:
- flatpak-aarch64
variables:
APPID: org.gtk.IconBrowser4
flatpak:node-editor:
extends: '.flatpak-defaults'
needs: []
@@ -360,6 +374,14 @@ nightly factory aarch64:
extends: '.publish_nightly'
needs: ['flatpak:widget-factory:aarch64']
nightly icon-browser:
extends: '.publish_nightly'
needs: ['flatpak:icon-browser']
nightly icon-browser aarch64:
extends: '.publish_nightly'
needs: ['flatpak:icon-browser:aarch64']
nightly node-editor:
extends: '.publish_nightly'
needs: ['flatpak:node-editor']
View File
+1 -1
View File
@@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
@echo on
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson~=1.2 || goto :error
pip3 install --upgrade --user meson~=0.64 || goto :error
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled -Dvulkan=disabled _build || goto :error
ninja -C _build || goto :error
+6 -1
View File
@@ -196,5 +196,10 @@
}
]
}
]
],
"build-options" : {
"env" : {
"GSK_RENDERER" : "opengl"
}
}
}
@@ -129,6 +129,7 @@
"build-options" : {
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"G_ENABLE_DEBUG" : "true"
}
}
@@ -129,6 +129,7 @@
"build-options" : {
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"G_ENABLE_DEBUG" : "true"
}
}
+1 -1
View File
@@ -1869,4 +1869,4 @@ do_font_features (GtkWidget *do_widget)
return window;
}
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+6 -2
View File
@@ -165,6 +165,10 @@ activate_about (GSimpleAction *action,
gpointer user_data)
{
GtkApplication *app = user_data;
const char *authors[] = {
"The GTK Team",
NULL
};
char *version;
char *os_name;
char *os_version;
@@ -202,11 +206,11 @@ activate_about (GSimpleAction *action,
? "GTK Demo (Development)"
: "GTK Demo",
"version", version,
"copyright", "© 1997—2024 The GTK Team",
"copyright", "© 1997—2021 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK widgets",
"authors", (const char *[]) { "The GTK Team", NULL },
"authors", authors,
"logo-icon-name", "org.gtk.Demo4",
"title", "About GTK Demo",
"system-information", s->str,
+517
View File
@@ -0,0 +1,517 @@
[volume]
Name=Volume
Description=Icons related to audio input and output volume
audio-volume-high=The icon used to indicate high audio volume
audio-volume-low=The icon used to indicate low audio volume
audio-volume-medium=The icon used to indicate medium audio volume
audio-volume-muted=The icon used to indicate the muted state for audio playback
microphone-sensitivity-high=The icon used to indicate high microphone sensitivity
microphone-sensitivity-low=The icon used to indicate low microphone sensitivity
microphone-sensitivity-medium=The icon used to indicate medium microphone sensitivity
microphone-sensitivity-muted=The icon used to indicate that a microphone is muted
[multimedia]
Name=Multimedia
Description=Icons related to playback of media
media-playlist-repeat=The icon for the repeat mode of a media player
media-playlist-repeat-song=The icon for repeating a song in a media player
media-playlist-shuffle=The icon for the shuffle mode of a media player
media-playlist-consecutive=The icon for consecutive mode of a media player
media-skip-backward=The icon for the skip backward action of a media player
media-seek-backward=The icon for the seek backward action of a media player
media-playback-start=The icon for the start playback action of a media player
media-seek-forward=The icon for the seek forward action of a media player
media-skip-forward=The icon for the skip forward action of a media player
media-playback-stop=The icon for the stop action of a media player
media-playback-pause=The icon for the pause action of a media player
media-eject=The icon for the eject action of a media player or file manager
media-record=The icon for the record action of a media application
media-view-subtitles=The icon used to show subtitles in a media player
[network]
Name=Network
Description=Icons related to network status
network-transmit-receive=The icon used data is being both transmitted and received simultaneously, while the computing device is connected to a network
network-transmit=The icon used when data is being transmitted, while the computing device is connected to a network
network-receive=The icon used when data is being received, while the computing device is connected to a network
network-idle=The icon used when no data is being transmitted or received, while the computing device is connected to a network
network-error=The icon used when an error occurs trying to initialize the network connection of the computing device
network-offline=The icon used when the computing device is disconnected from the network
[weather]
Name=Weather
Description=Icons about weather conditions
weather-clear=The icon used while the weather for a region is “clear skies”
weather-clear-night=The icon used while the weather for a region is “clear skies” during the night
weather-few-clouds=The icon used while the weather for a region is “partly cloudy”
weather-few-clouds-night=The icon used while the weather for a region is “partly cloudy” during the night
weather-fog=The icon used while the weather for a region is “foggy”
weather-overcast=The icon used while the weather for a region is “overcast”
weather-severe-alert=The icon used while a sever weather alert is in effect for a region
weather-showers=The icon used while rain showers are occurring in a region
weather-showers-scattered=The icon used while scattered rain showers are occurring in a region
weather-snow=The icon used while snow showers are occurring in a region
weather-storm=The icon used while storms are occurring in a region
weather-windy=The icon used while the weather is windy
[navigation]
Name=Navigation
Description=Icons for navigation in the user interface of a program
go-first=The icon for the go to the first item in a list
go-previous=The icon for the go to the previous item in a list
go-next=The icon for the go to the next item in a list
go-last=The icon for the go to the last item in a list
go-bottom=The icon for the go to bottom of a list
go-down=The icon for the go down in a list
go-up=The icon for the go up in a list
go-top=The icon for the go to the top of a list
go-home=The icon for the go to home location
go-jump=The icon for the jump to action
[editing]
Name=Editing
Description=Icons related to editing a document
format-indent-less=The icon for the decrease indent formatting action
format-indent-more=The icon for the increase indent formatting action
format-justify-center=The icon for the center justification formatting action
format-justify-fill=The icon for the fill justification formatting action
format-justify-left=The icon for the left justification formatting action
format-justify-right=The icon for the right justification action
format-text-direction-ltr=The icon for the left-to-right text formatting action
format-text-direction-rtl=The icon for the right-to-left formatting action
format-text-bold=The icon for the bold text formatting action
format-text-italic=The icon for the italic text formatting action
format-text-underline=The icon for the underlined text formatting action
format-text-strikethrough=The icon for the strikethrough text formatting action
edit-clear=The icon for the clear action
edit-clear-all=
edit-copy=The icon for the copy action
edit-cut=The icon for the cut action
edit-delete=The icon for the delete action
edit-find-replace=The icon for the find and replace action
edit-paste=The icon for the paste action
edit-redo=The icon for the redo action
edit-select-all=The icon for the select all action
edit-select=
edit-undo=The icon for the undo action
error-correct=
document-properties=The icon for the action to view the properties of a document in an application
document-new=The icon used for the action to create a new document
document-open=The icon used for the action to open a document
document-open-recent=The icon used for the action to open a document that was recently opened
document-save=The icon for the save action. Should be an arrow pointing down and toward a hard disk
document-save-as=The icon for the save as action
document-send=The icon for the send action. Should be an arrow pointing up and away from a hard disk
document-page-setup=The icon for the page setup action of a document editor
document-edit=The icon for the action to edit a document
object-flip-horizontal=The icon for the action to flip an object horizontally
object-flip-vertical=The icon for the action to flip an object vertically
object-rotate-left=The icon for the rotate left action performed on an object
object-rotate-right=The icon for the rotate right action performed on an object
insert-image=The icon for the insert image action of an application
insert-link=The icon for the insert link action of an application
insert-object=The icon for the insert object action of an application
insert-text=The icon for the insert text action of an application
accessories-text-editor=The icon used for the desktop's text editing accessory program
[view]
Name=View Controls
Description=Icons for view controls in a user interface
view-list=The icon used for “List“ view mode
view-grid=The icon used for “Grid“ view mode (as opposed to “List“)
view-fullscreen=The icon used for the “Fullscreen” item in the application's “View” menu
view-restore=The icon used by an application for leaving the fullscreen view, and returning to a normal windowed view
zoom-fit-best=The icon used for the “Best Fit” item in the application's “View” menu
zoom-in=The icon used for the “Zoom in” item in the application's “View” menu
zoom-out=The icon used for the “Zoom Out” item in the application's “View” menu
zoom-original=The icon used for the “Original Size” item in the application's “View” menu
view-continuous=The icon used for a continuous view mode
view-paged=The icon used for a paged view mode (as opposed to continuous)
view-dual=The icon used for a side-by-side view of paginated content
view-wrapped=The icon used to indicate a wrap-around to the beginning
view-pin=The icon used for 'pin a view'
[calendar]
Name=Calendar, Tasks and Alarms
Description=Icons related to calendars, tasks and alarms
task-due=The icon used when a task is due soon
task-past-due=The icon used when a task that was due, has been left incomplete
appointment-soon=The icon used when an appointment will occur soon
appointment-missed=The icon used when an appointment was missed
alarm=The icon used for alarms when a task or appointment is due
[communication]
Name=Communication
Description=Icons related email, phone calls, IM and other forms of communication
mail-unread=The icon used for an electronic mail that is unread
mail-read=The icon used for an electronic mail that is read
mail-replied=The icon used for an electronic mail that has been replied to
mail-attachment=The icon used for an electronic mail that contains attachments
mail-mark-important=The icon for the mark as important action of an electronic mail application
mail-send=The icon for the send action of an electronic mail application
mail-send-receive=The icon for the send and receive action of an electronic mail application
call-start=The icon used for initiating or accepting a call
call-stop=The icon used for stopping a current call
call-missed=The icon used to show a missed call
user-available=The icon used when a user on a chat network is available to initiate a conversation with
user-offline=The icon used when a user on a chat network is not available
user-idle=The icon used when a user on a chat network has not been an active participant in any chats on the network, for an extended period of time
user-invisible=The icon used when a user is on a chat network, but is invisible to others
user-busy=The icon used when a user is on a chat network, and has marked himself as busy
user-away=The icon used when a user on a chat network is away from their keyboard and the chat program
user-status-pending=The icon used when the current user status on a chat network is not known
[devices]
Name=Devices and Media
Description=Icons for devices and media
audio-input-microphone=The icon used for the microphone audio input device
camera-web=The fallback icon for web cameras
camera-photo=The icon used for a digital still camera devices
input-keyboard=The icon used for the keyboard input device
printer=The icon used for a printer device
video-display=The icon used for the monitor that video gets displayed to
computer=The icon used for the computing device as a whole
media-optical=The icon used for physical optical media such as CD and DVD
phone=The icon used for phone devices which support connectivity to the PC, such as VoIP, cellular, or possibly landline phones
input-dialpad=The icon used for dialpad input devices
input-touchpad=The icon used for touchpad input devices
scanner=The icon used for a scanner device
audio-card=The icon used for the audio rendering device
input-gaming=The icon used for the gaming input device
input-mouse=The icon used for the mousing input device
multimedia-player=The icon used for generic multimedia playing devices
audio-headphones=The icon used for headphones
audio-headset=The icon used for headsets
display-projector=The icon used for projectors
media-removable=The icon used for generic removable media
printer-network=The icon used for printers which are connected via the network
audio-speakers=The icon used for speakers
camera-video=The fallback icon for video cameras
drive-optical=The icon used for optical media drives such as CD and DVD
drive-removable-media=The icon used for removable media drives
input-tablet=The icon used for graphics tablet input devices
network-wireless=The icon used for wireless network connections
network-wired=The icon used for wired network connections
media-floppy=The icon used for physical floppy disk media
media-flash=The fallback icon used for flash media, such as memory stick and SD
[contenttypes]
Name=Content Types
Description=Icons for different types of data, such as audio or image files
application-certificate=
application-rss+xml=
application-x-appliance=
audio-x-generic=The icon used for generic audio file types
folder=The standard folder icon used to represent directories on local filesystems, mail folders, and other hierarchical groups
text-x-generic=The icon used for generic text file types
video-x-generic=The icon used for generic video file types
x-office-calendar=The icon used for generic calendar file types
[emotes]
Name=Emotes
Description=Icons for emotions that are expressed through text chat applications such as :-) or :-P in IRC or instant messengers
face-angel=The icon used for the 0:-) emote
face-angry=The icon used for the X-( emote
face-cool=The icon used for the B-) emote
face-crying=The icon used for the :'( emote
face-devilish=The icon used for the >:-) emote
face-embarrassed=The icon used for the :-[ emote
face-kiss=The icon used for the :-* emote
face-laugh=The icon used for the :-)) emote
face-monkey=The icon used for the :-(|) emote
face-plain=The icon used for the :-| emote
face-raspberry=The icon used for the :-P emote
face-sad=The icon used for the :-( emote
face-shutmouth=The 'shut mouth' emote
face-sick=The icon used for the :-& emote
face-smile=The icon used for the :-) emote
face-smile-big=The icon used for the :-D emote
face-smirk=The icon used for the :-! emote
face-surprise=The icon used for the :-0 emote
face-tired=The icon used for the |-) emote
face-uncertain=The icon used for the :-/ emote
face-wink=The icon used for the ;-) emote
face-worried=The icon used for the :-S emote
face-yawn=
[general]
Name=General
Description=Generally useful icons that don't fit in a particular category
edit-find=The icon for generic search actions
content-loading=The icon used to indicate that content is loading
open-menu=The icon used for a menu button in the header bar
view-more=The icon used for a “View More“ action
tab-new=The icon used for a “New Tab“ action
bookmark-new=The icon used for creating a new bookmark
mark-location=The icon used to mark a location on a map
find-location=The icon used for a “Search location“ action
send-to=The icon used for a “Send to“ action
object-select=The icon used for generic selection actions
window-close=The icon used for actions that close a view, such as window or tab close button
view-refresh=The icon used for the “Refresh” item in the application's “View” menu
process-stop=The icon used for the “Stop” action in applications with actions that may take a while to process, such as web page loading in a browser
action-unavailable=The icon used to indicate that an action is currently unavailable, such as “Pause“ when no media is playing
document-print=The icon for the print action of an application
printer-printing=The icon used while a print job is successfully being spooled to a printing device
printer-warning=The icon used when a recoverable problem occurs while attempting to printing
printer-error=The icon used when an error occurs while attempting to print
dialog-information=The icon used when a dialog is opened to give information to the user that may be pertinent to the requested action
dialog-question=The icon used when a dialog is opened to ask a simple question of the user
dialog-warning=The icon used when a dialog is opened to warn the user of impending issues with the requested action
dialog-password=The icon used when a dialog requesting the authentication credentials for a user is opened
dialog-error=The icon used when a dialog is opened to explain an error condition to the user
list-add=The icon for the add to list action
list-remove=The icon for the remove from list action
non-starred=The icon used to indicate that an object is not 'starred'
semi-starred=The icon used to indicate that an object has is 'half-starred'
starred=The icon used to indicate that an object is 'starred'
star-new=The used for the “New Star“ action
security-low=The icon used to indicate that the security level of a connection is presumed to be insecure, either by using weak encryption, or by using a certificate that the could not be automatically verified, and which the user has not chosent to trust
security-medium=The icon used to indicate that the security level of a connection is presumed to be secure, using strong encryption, and a certificate that could not be automatically verified, but which the user has chosen to trust
security-high=The icon used to indicate that the security level of a connection is known to be secure, using strong encryption and a valid certificate
user-trash=The icon for the user's “Trash” place in the file system
user-trash-full=The icon for the user's “Trash” in the file system, when there are items in the “Trash” waiting for disposal or recovery
emblem-system=The icon used as an emblem for directories that contain system libraries, settings, and data
avatar-default=The generic avatar icon, which is used to represent a user that doesn't have a personalized avatar
emblem-synchronizing=The icon used as an emblem to indicate that a synchronizing operation is in process
emblem-shared=The icon used as an emblem for files and directories that are shared to other users
help-browser=The icon used for the desktop's help browsing application
[other]
Name=Other
Description=Icons which have may be too specialized and not of general interest
changes-allow=
changes-prevent=
view-sort-ascending=The icon used for the “Sort Ascending” item in the application's “View” menu, or in a button for changing the sort method for a list
view-sort-descending=The icon used for the “Sort Descending” item in the application's “View” menu, or in a button for changing the sort method for a list
document-revert=The icon for the action of reverting to a previous version of a document
address-book-new=The icon used for the action to create a new address book
application-exit=The icon used for exiting an application. Typically this is seen in the application's menus as File->Quit
appointment-new=The icon used for the action to create a new appointment in a calendaring application
contact-new=The icon used for the action to create a new contact in an address book application
document-print-preview=The icon for the print preview action of an application
folder-new=The icon for creating a new folder
help-about=The icon for the About item in the Help menu
help-contents=The icon for Contents item in the Help menu
help-faq=The icon for the FAQ item in the Help menu
list-remove-all=
mail-forward=The icon for the forward action of an electronic mail application
mail-mark-junk=The icon for the mark as junk action of an electronic mail application
mail-mark-notjunk=The icon for the mark as not junk action of an electronic mail application
mail-mark-read=The icon for the mark as read action of an electronic mail application
mail-mark-unread=The icon for the mark as unread action of an electronic mail application
mail-message-new=The icon for the compose new mail action of an electronic mail application
mail-reply-all=The icon for the reply to all action of an electronic mail application
mail-reply-sender=The icon for the reply to sender action of an electronic mail application
pan-down=
pan-end=
pan-start=
pan-up=
system-lock-screen=The icon used for the “Lock Screen” item in the desktop's panel application
system-log-out=The icon used for the “Log Out” item in the desktop's panel application
system-run=The icon used for the “Run Application...” item in the desktop's panel application
system-search=The icon used for the “Search” item in the desktop's panel application
system-reboot=The icon used for the “Reboot” item in the desktop's panel application
system-shutdown=The icon used for the “Shutdown” item in the desktop's panel application
tools-check-spelling=The icon used for the “Check Spelling” item in the application's “Tools” menu
window-maximize=
window-minimize=
window-restore=
window-new=The icon used for the “New Window” item in the application's “Windows” menu
accessories-calculator=The icon used for the desktop's calculator accessory program
accessories-character-map=The icon used for the desktop's international and extended text character accessory program
accessories-dictionary=The icon used for the desktop's dictionary accessory program
multimedia-volume-control=The icon used for the desktop's hardware volume control application
preferences-desktop-accessibility=The icon used for the desktop's accessibility preferences
preferences-desktop-display=
preferences-desktop-font=The icon used for the desktop's font preferences
preferences-desktop-keyboard=The icon used for the desktop's keyboard preferences
preferences-desktop-keyboard-shortcuts=
preferences-desktop-locale=The icon used for the desktop's locale preferences
preferences-desktop-remote-desktop=
preferences-desktop-multimedia=The icon used for the desktop's multimedia preferences
preferences-desktop-screensaver=The icon used for the desktop's screen saving preferences
preferences-desktop-theme=The icon used for the desktop's theme preferences
preferences-desktop-wallpaper=The icon used for the desktop's wallpaper preferences
preferences-system-privacy=
preferences-system-windows=
system-file-manager=The icon used for the desktop's file management application
system-software-install=The icon used for the desktop's software installer application
system-software-update=The icon used for the desktop's software updating application
system-users=
user-info=
utilities-system-monitor=The icon used for the desktop's system resource monitor application
utilities-terminal=The icon used for the desktop's terminal emulation application.
application-x-addon=
application-x-executable=The icon used for executable file types
font-x-generic=The icon used for generic font file types
image-x-generic=The icon used for generic image file types
package-x-generic=The icon used for generic package file types
text-html=The icon used for HTML text file types
text-x-generic-template=The icon used for generic text templates
text-x-preview=
text-x-script=The icon used for script file types, such as shell scripts
x-office-address-book=The icon used for generic address book file types
x-office-document=The icon used for generic document and letter file types
x-office-document-template=
x-office-presentation=The icon used for generic presentation file types
x-office-presentation-template=
x-office-spreadsheet=The icon used for generic spreadsheet file types
x-office-spreadsheet-template=
x-package-repository=
applications-accessories=The icon for the “Accessories” sub-menu of the Programs menu
applications-development=The icon for the “Programming” sub-menu of the Programs menu
applications-engineering=The icon for the “Engineering” sub-menu of the Programs menu
applications-games=The icon for the “Games” sub-menu of the Programs menu
applications-graphics=The icon for the “Graphics” sub-menu of the Programs menu
applications-internet=The icon for the “Internet” sub-menu of the Programs menu
applications-multimedia=The icon for the “Multimedia” sub-menu of the Programs menu
applications-office=The icon for the “Office” sub-menu of the Programs menu
applications-other=The icon for the “Other” sub-menu of the Programs menu
applications-science=The icon for the “Science” sub-menu of the Programs menu
applications-system=The icon for the “System Tools” sub-menu of the Programs menu
applications-utilities=The icon for the “Utilities” sub-menu of the Programs menu
preferences-desktop=The icon for the “Desktop Preferences” category
preferences-desktop-peripherals=The icon for the “Peripherals” sub-category of the “Desktop Preferences” category
preferences-desktop-personal=The icon for the “Personal” sub-category of the “Desktop Preferences” category
preferences-other=The icon for the “Other” preferences category
preferences-system=The icon for the “System Preferences” category
preferences-system-network=The icon for the “Network” sub-category of the “System Preferences” category
system-help=The icon for the “Help” system category
battery=The icon used for the system battery device
computer-apple-ipad=
colorimeter-colorhug=
drive-harddisk=The icon used for hard disk drives
drive-harddisk-ieee1394=
drive-harddisk-system=
drive-multidisk=
media-optical-bd=
media-optical-cd-audio=
media-optical-dvd=
media-tape=The icon used for generic physical tape media
media-zip=
modem=The icon used for modem devices
multimedia-player-apple-ipod-touch=
network-vpn=
pda=This is the fallback icon for Personal Digital Assistant devices. Primary use of this icon is for PDA devices connected to the PC. Connection medium is not an important aspect of the icon. The metaphor for this fallback icon should be a generic PDA device icon
phone-apple-iphone=
uninterruptible-power-supply=
emblem-default=The icon used as an emblem to specify the default selection of a printer for example
emblem-documents=The icon used as an emblem for the directory where a user's documents are stored
emblem-downloads=The icon used as an emblem for the directory where a user's downloads from the internet are stored
emblem-favorite=The icon used as an emblem for files and directories that the user marks as favorites
emblem-generic=
emblem-important=The icon used as an emblem for files and directories that are marked as important by the user
emblem-mail=The icon used as an emblem to specify the directory where the user's electronic mail is stored
emblem-new=
emblem-ok=
emblem-package=
emblem-photos=The icon used as an emblem to specify the directory where the user stores photographs
emblem-readonly=The icon used as an emblem for files and directories which can not be written to by the user
emblem-symbolic-link=The icon used as an emblem for files and direcotires that are links to other files or directories on the filesystem
emblem-synchronized=The icon used as an emblem for files or directories that are configured to be synchronized to another device
emblem-unreadable=The icon used as an emblem for files and directories that are inaccessible.
emblem-urgent=
emblem-videos=
emblem-web=
folder-documents=
folder-download=The icon representing the location in the file system where downloaded files are stored
folder-music=
folder-pictures=
folder-publicshare=
folder-remote=The icon used for normal directories on a remote filesystem
folder-saved-search=
folder-templates=
folder-videos=
network-server=The icon used for individual host machines under the “Network Servers” place in the file manager
network-workgroup=The icon for the “Network Servers” place in the desktop's file manager, and workgroups within the network
start-here=The icon used by the desktop's main menu for accessing places, applications, and other features
user-bookmarks=The icon for the user's special “Bookmarks” place
user-desktop=The icon for the special “Desktop” directory of the user
user-home=The icon for the special “Home” directory of the user
airplane-mode=
battery-caution-charging=
battery-caution=The icon used when the battery is below 40%
battery-empty-charging=
battery-empty=
battery-full-charged=
battery-full-charging=
battery-full=
battery-good-charging=
battery-good=
battery-low-charging=
battery-low=The icon used when the battery is below 20%
battery-missing=
bluetooth-active=
bluetooth-disabled=
channel-insecure=
channel-secure=
computer-fail=
display-brightness=
keyboard-brightness=
folder-drag-accept=The icon used for a folder while an object is being dragged onto it, that is of a type that the directory can contain
folder-open=The icon used for folders, while their contents are being displayed within the same window. This icon would normally be shown in a tree or list view, next to the main view of a folder's contents
folder-visiting=The icon used for folders, while their contents are being displayed in another window. This icon would typically be used when using multiple windows to navigate the hierarchy, such as in Nautilus's spatial mode
image-loading=The icon used when another image is being loaded, such as thumnails for larger images in the file manager
image-missing=The icon used when another image could not be loaded
mail-signed=The icon used for an electronic mail that contains a signature
mail-signed-verified=The icon used for an electronic mail that contains a signature which has also been verified by the security system
network-cellular-3g=
network-cellular-4g=
network-cellular-edge=
network-cellular-gprs=
network-cellular-umts=
network-cellular-acquiring=
network-cellular-connected=
network-cellular-no-route=
network-cellular-offline=
network-cellular-signal-excellent=
network-cellular-signal-good=
network-cellular-signal-ok=
network-cellular-signal-weak=
network-cellular-signal-none=
network-vpn-acquiring=
network-vpn=
network-wired-acquiring=
network-wired-disconnected=
network-wired-no-route=
network-wired-offline=
network-wireless-acquiring=
network-wireless-connected=
network-wireless-encrypted=
network-wireless-hotspot=
network-wireless-no-route=
network-wireless-offline=
network-wireless-signal-excellent=
network-wireless-signal-good=
network-wireless-signal-ok=
network-wireless-signal-weak=
network-wireless-signal-none=
rotation-allowed=
rotation-locked=
software-update-available=The icon used when an update is available for software installed on the computing device, through the system software update program
software-update-urgent=The icon used when an urgent update is available through the system software update program
sync-error=The icon used when an error occurs while attempting to synchronize data from the computing device, to another device
sync-synchronizing=The icon used while data is successfully synchronizing to another device
touchpad-disabled=
trophy-bronze=
trophy-silver=
trophy-gold=
night-light=
daytime-sunrise=
daytime-sunset=
on=
off=
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gtk/iconbrowser/gtk">
<file preprocess="xml-stripblanks">window.ui</file>
<file>icon.list</file>
</gresource>
</gresources>
+160
View File
@@ -0,0 +1,160 @@
#include "config.h"
#include <gtk/gtk.h>
#include "iconbrowserapp.h"
#include "iconbrowserwin.h"
#include "profile_conf.h"
struct _IconBrowserApp
{
GtkApplication parent;
};
struct _IconBrowserAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(IconBrowserApp, icon_browser_app, GTK_TYPE_APPLICATION);
static void
icon_browser_app_init (IconBrowserApp *app)
{
}
static void
quit_activated (GSimpleAction *action,
GVariant *parameter,
gpointer app)
{
g_application_quit (G_APPLICATION (app));
}
static void
inspector_activated (GSimpleAction *action,
GVariant *parameter,
gpointer app)
{
gtk_window_set_interactive_debugging (TRUE);
}
static void
about_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkApplication *app = user_data;
const char *authors[] = {
"The GTK Team",
NULL
};
char *icon_theme;
char *version;
GString *s;
char *os_name;
char *os_version;
g_object_get (gtk_settings_get_default (),
"gtk-icon-theme-name", &icon_theme,
NULL);
s = g_string_new ("");
os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
os_version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID);
if (os_name && os_version)
g_string_append_printf (s, "OS\t%s %s\n\n", os_name, os_version);
g_string_append (s, "System libraries\n");
g_string_append_printf (s, "\tGLib\t%d.%d.%d\n",
glib_major_version,
glib_minor_version,
glib_micro_version);
g_string_append_printf (s, "\tPango\t%s\n",
pango_version_string ());
g_string_append_printf (s, "\tGTK \t%d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
g_string_append_printf (s, "\nIcon theme\n\t%s", icon_theme);
version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d",
PACKAGE_VERSION,
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
"program-name", g_strcmp0 (PROFILE, "devel") == 0
? "GTK Icon Browser (Development)"
: "GTK Icon Browser",
"version", version,
"copyright", "© 1997—2021 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to browse themed icons",
"authors", authors,
"logo-icon-name", "org.gtk.IconBrowser4",
"title", "About GTK Icon Browser",
"system-information", s->str,
NULL);
g_string_free (s, TRUE);
g_free (version);
g_free (icon_theme);
g_free (os_name);
g_free (os_version);
}
static GActionEntry app_entries[] =
{
{ "quit", quit_activated, NULL, NULL, NULL },
{ "inspector", inspector_activated, NULL, NULL, NULL },
{ "about", about_activated, NULL, NULL, NULL }
};
static void
icon_browser_app_startup (GApplication *app)
{
const char *quit_accels[2] = { "<Ctrl>Q", NULL };
G_APPLICATION_CLASS (icon_browser_app_parent_class)->startup (app);
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries, G_N_ELEMENTS (app_entries),
app);
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
"app.quit",
quit_accels);
}
static void
icon_browser_app_activate (GApplication *app)
{
IconBrowserWindow *win;
win = icon_browser_window_new (ICON_BROWSER_APP (app));
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.IconBrowser4");
gtk_window_present (GTK_WINDOW (win));
}
static void
icon_browser_app_class_init (IconBrowserAppClass *class)
{
G_APPLICATION_CLASS (class)->startup = icon_browser_app_startup;
G_APPLICATION_CLASS (class)->activate = icon_browser_app_activate;
}
IconBrowserApp *
icon_browser_app_new (void)
{
return g_object_new (ICON_BROWSER_APP_TYPE,
"application-id", "org.gtk.IconBrowser4",
NULL);
}
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include <gtk/gtk.h>
#define ICON_BROWSER_APP_TYPE (icon_browser_app_get_type ())
#define ICON_BROWSER_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ICON_BROWSER_APP_TYPE, IconBrowserApp))
typedef struct _IconBrowserApp IconBrowserApp;
typedef struct _IconBrowserAppClass IconBrowserAppClass;
GType icon_browser_app_get_type (void);
IconBrowserApp *icon_browser_app_new (void);
+156
View File
@@ -0,0 +1,156 @@
#include "iconbrowsercontext.h"
struct _IbContext
{
GObject parent_instance;
char *id;
char *name;
char *description;
};
struct _IbContextClass
{
GObjectClass parent_class;
};
enum {
PROP_ID = 1,
PROP_NAME,
PROP_DESCRIPTION,
PROP_NUM_PROPERTIES
};
G_DEFINE_TYPE (IbContext, ib_context, G_TYPE_OBJECT)
static void
ib_context_init (IbContext *context)
{
}
static void
ib_context_finalize (GObject *object)
{
IbContext *context = IB_CONTEXT (object);
g_free (context->id);
g_free (context->name);
g_free (context->description);
G_OBJECT_CLASS (ib_context_parent_class)->finalize (object);
}
static void
ib_context_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
IbContext *context = IB_CONTEXT (object);
switch (property_id)
{
case PROP_ID:
g_free (context->id);
context->id = g_value_dup_string (value);
break;
case PROP_NAME:
g_free (context->name);
context->name = g_value_dup_string (value);
break;
case PROP_DESCRIPTION:
g_free (context->description);
context->description = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
ib_context_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
IbContext *context = IB_CONTEXT (object);
switch (property_id)
{
case PROP_ID:
g_value_set_string (value, context->id);
break;
case PROP_NAME:
g_value_set_string (value, context->name);
break;
case PROP_DESCRIPTION:
g_value_set_string (value, context->description);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
ib_context_class_init (IbContextClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GParamSpec *pspec;
object_class->finalize = ib_context_finalize;
object_class->set_property = ib_context_set_property;
object_class->get_property = ib_context_get_property;
pspec = g_param_spec_string ("id", "Id", "Id",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_ID, pspec);
pspec = g_param_spec_string ("name", "Name", "Name",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_NAME, pspec);
pspec = g_param_spec_string ("description", "Description", "Description",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_DESCRIPTION, pspec);
}
IbContext *
ib_context_new (const char *id,
const char *name,
const char *description)
{
return g_object_new (IB_TYPE_CONTEXT,
"id", id,
"name", name,
"description", description,
NULL);
}
const char *
ib_context_get_id (IbContext *context)
{
return context->id;
}
const char *
ib_context_get_name (IbContext *context)
{
return context->name;
}
const char *
ib_context_get_description (IbContext *context)
{
return context->description;
}
+14
View File
@@ -0,0 +1,14 @@
#pragma once
#include <gtk.h>
#define IB_TYPE_CONTEXT (ib_context_get_type ())
G_DECLARE_FINAL_TYPE (IbContext, ib_context, IB, CONTEXT, GObject)
IbContext *ib_context_new (const char *id,
const char *name,
const char *description);
const char *ib_context_get_id (IbContext *context);
const char *ib_context_get_name (IbContext *context);
const char *ib_context_get_description (IbContext *context);
+228
View File
@@ -0,0 +1,228 @@
#include "iconbrowsericon.h"
struct _IbIcon
{
GObject parent_instance;
gboolean use_symbolic;
char *regular_name;
char *symbolic_name;
char *description;
char *context;
};
struct _IbIconClass
{
GObjectClass parent_class;
};
enum {
PROP_NAME = 1,
PROP_REGULAR_NAME,
PROP_SYMBOLIC_NAME,
PROP_USE_SYMBOLIC,
PROP_DESCRIPTION,
PROP_CONTEXT,
PROP_NUM_PROPERTIES
};
G_DEFINE_TYPE (IbIcon, ib_icon, G_TYPE_OBJECT)
static void
ib_icon_init (IbIcon *icon)
{
}
static void
ib_icon_finalize (GObject *object)
{
IbIcon *icon = IB_ICON (object);
g_free (icon->regular_name);
g_free (icon->symbolic_name);
g_free (icon->description);
g_free (icon->context);
G_OBJECT_CLASS (ib_icon_parent_class)->finalize (object);
}
static void
ib_icon_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
IbIcon *icon = IB_ICON (object);
switch (property_id)
{
case PROP_REGULAR_NAME:
g_free (icon->regular_name);
icon->regular_name = g_value_dup_string (value);
if (!icon->use_symbolic)
g_object_notify (object, "name");
break;
case PROP_SYMBOLIC_NAME:
g_free (icon->symbolic_name);
icon->symbolic_name = g_value_dup_string (value);
if (icon->use_symbolic)
g_object_notify (object, "name");
break;
case PROP_USE_SYMBOLIC:
icon->use_symbolic = g_value_get_boolean (value);
g_object_notify (object, "name");
break;
case PROP_DESCRIPTION:
g_free (icon->description);
icon->description = g_value_dup_string (value);
break;
case PROP_CONTEXT:
g_free (icon->context);
icon->context = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
ib_icon_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
IbIcon *icon = IB_ICON (object);
switch (property_id)
{
case PROP_NAME:
g_value_set_string (value, ib_icon_get_name (icon));
break;
case PROP_REGULAR_NAME:
g_value_set_string (value, icon->regular_name);
break;
case PROP_SYMBOLIC_NAME:
g_value_set_string (value, icon->symbolic_name);
break;
case PROP_USE_SYMBOLIC:
g_value_set_boolean (value, icon->use_symbolic);
break;
case PROP_DESCRIPTION:
g_value_set_string (value, icon->description);
break;
case PROP_CONTEXT:
g_value_set_string (value, icon->context);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
ib_icon_class_init (IbIconClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GParamSpec *pspec;
object_class->finalize = ib_icon_finalize;
object_class->set_property = ib_icon_set_property;
object_class->get_property = ib_icon_get_property;
pspec = g_param_spec_string ("name", "Name", "Name",
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_NAME, pspec);
pspec = g_param_spec_string ("regular-name", "Regular Name", "Regular Name",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_REGULAR_NAME, pspec);
pspec = g_param_spec_string ("symbolic-name", "Symbolic Name", "Symbolic Name",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_SYMBOLIC_NAME, pspec);
pspec = g_param_spec_boolean ("use-symbolic", "Use Symbolic", "Use Symbolic",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_USE_SYMBOLIC, pspec);
pspec = g_param_spec_string ("description", "Description", "Description",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_DESCRIPTION, pspec);
pspec = g_param_spec_string ("context", "Context", "Context",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_CONTEXT, pspec);
}
IbIcon *
ib_icon_new (const char *regular_name,
const char *symbolic_name,
const char *description,
const char *context)
{
return g_object_new (IB_TYPE_ICON,
"regular-name", regular_name,
"symbolic-name", symbolic_name,
"description", description,
"context", context,
NULL);
}
const char *
ib_icon_get_name (IbIcon *icon)
{
if (icon->use_symbolic)
return icon->symbolic_name;
else
return icon->regular_name;
}
const char *
ib_icon_get_regular_name (IbIcon *icon)
{
return icon->regular_name;
}
const char *
ib_icon_get_symbolic_name (IbIcon *icon)
{
return icon->symbolic_name;
}
gboolean
ib_icon_get_use_symbolic (IbIcon *icon)
{
return icon->use_symbolic;
}
const char *
ib_icon_get_description (IbIcon *icon)
{
return icon->description;
}
const char *
ib_icon_get_context (IbIcon *icon)
{
return icon->context;
}
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include <gtk.h>
#define IB_TYPE_ICON (ib_icon_get_type ())
G_DECLARE_FINAL_TYPE (IbIcon, ib_icon, IB, ICON, GObject)
IbIcon *ib_icon_new (const char *regular_name,
const char *symbolic_name,
const char *description,
const char *context);
const char *ib_icon_get_name (IbIcon *icon);
const char *ib_icon_get_regular_name (IbIcon *icon);
const char *ib_icon_get_symbolic_name (IbIcon *icon);
gboolean ib_icon_get_use_symbolic (IbIcon *icon);
const char *ib_icon_get_description (IbIcon *icon);
const char *ib_icon_get_context (IbIcon *icon);
+460
View File
@@ -0,0 +1,460 @@
#include <string.h>
#include "iconbrowserapp.h"
#include "iconbrowserwin.h"
#include "iconbrowsericon.h"
#include "iconbrowsercontext.h"
#include <gtk/gtk.h>
struct _IconBrowserWindow
{
GtkApplicationWindow parent;
GtkWidget *symbolic_radio;
GtkWidget *searchbar;
GListModel *icon_filter_model;
GListStore *icon_store;
GListModel *context_model;
GListStore *context_store;
GtkFilter *name_filter;
GtkFilter *search_mode_filter;
GtkWidget *details;
GtkWidget *image1;
GtkWidget *image2;
GtkWidget *image3;
GtkWidget *image4;
GtkWidget *image5;
GtkWidget *image6;
GtkWidget *image7;
GtkWidget *image8;
GtkWidget *label8;
GtkWidget *description;
};
struct _IconBrowserWindowClass
{
GtkApplicationWindowClass parent_class;
};
G_DEFINE_TYPE(IconBrowserWindow, icon_browser_window, GTK_TYPE_APPLICATION_WINDOW);
static GtkIconTheme *
icon_browser_window_get_icon_theme (IconBrowserWindow *win)
{
return gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (win)));
}
static void
add_icon (IconBrowserWindow *win,
const char *name,
const char *description,
const char *context)
{
GtkIconTheme *icon_theme = icon_browser_window_get_icon_theme (win);
char *regular_name;
char *symbolic_name;
IbIcon *icon;
regular_name = g_strdup (name);
if (!gtk_icon_theme_has_icon (icon_theme, regular_name))
{
g_free (regular_name);
regular_name = NULL;
}
symbolic_name = g_strconcat (name, "-symbolic", NULL);
if (!gtk_icon_theme_has_icon (icon_theme, symbolic_name))
{
g_free (symbolic_name);
symbolic_name = NULL;
}
icon = ib_icon_new (regular_name, symbolic_name, description, context);
g_object_bind_property (win->symbolic_radio, "active",
icon, "use-symbolic",
G_BINDING_DEFAULT);
g_list_store_append (win->icon_store, icon);
g_object_unref (icon);
}
static void
add_context (IconBrowserWindow *win,
const char *id,
const char *name,
const char *description)
{
IbContext *context;
context = ib_context_new (id, name, description);
g_list_store_append (win->context_store, context);
g_object_unref (context);
}
static void
populate (IconBrowserWindow *win)
{
GFile *file;
GKeyFile *kf;
char *data;
gsize length;
char **groups;
int i;
file = g_file_new_for_uri ("resource:/org/gtk/iconbrowser/gtk/icon.list");
g_file_load_contents (file, NULL, &data, &length, NULL, NULL);
kf = g_key_file_new ();
g_key_file_load_from_data (kf, data, length, G_KEY_FILE_NONE, NULL);
groups = g_key_file_get_groups (kf, &length);
for (i = 0; i < length; i++)
{
const char *context;
const char *name;
const char *description;
char **keys;
gsize len;
int j;
context = groups[i];
name = g_key_file_get_string (kf, context, "Name", NULL);
description = g_key_file_get_string (kf, context, "Description", NULL);
add_context (win, context, name, description);
keys = g_key_file_get_keys (kf, context, &len, NULL);
for (j = 0; j < len; j++)
{
const char *key = keys[j];
const char *value;
if (strcmp (key, "Name") == 0 || strcmp (key, "Description") == 0)
continue;
value = g_key_file_get_string (kf, context, key, NULL);
add_icon (win, key, value, context);
}
g_strfreev (keys);
}
g_strfreev (groups);
}
static gboolean
filter_by_icon_name (gpointer item,
gpointer data)
{
return ib_icon_get_name (IB_ICON (item)) != NULL;
}
static void
symbolic_toggled (IconBrowserWindow *win)
{
gtk_filter_changed (win->name_filter, GTK_FILTER_CHANGE_DIFFERENT);
}
static void
copy_to_clipboard (GtkButton *button,
IconBrowserWindow *win)
{
GdkClipboard *clipboard;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (win));
gdk_clipboard_set_text (clipboard, gtk_window_get_title (GTK_WINDOW (win->details)));
}
static void
set_image (GtkWidget *image, const char *name, int size)
{
gtk_image_set_from_icon_name (GTK_IMAGE (image), name);
gtk_image_set_pixel_size (GTK_IMAGE (image), size);
}
static void
item_activated (GtkGridView *view,
guint position,
IconBrowserWindow *win)
{
GListModel *model = G_LIST_MODEL (gtk_grid_view_get_model (view));
IbIcon *icon = g_list_model_get_item (model, position);
const char *name;
const char *description;
gboolean symbolic;
name = ib_icon_get_name (icon);
description = ib_icon_get_description (icon);
symbolic = ib_icon_get_use_symbolic (icon);
gtk_window_set_title (GTK_WINDOW (win->details), name);
set_image (win->image1, name, 8);
set_image (win->image2, name, 16);
set_image (win->image3, name, 18);
set_image (win->image4, name, 24);
set_image (win->image5, name, 32);
set_image (win->image6, name, 48);
set_image (win->image7, name, 64);
gtk_widget_set_visible (win->image8, symbolic);
gtk_widget_set_visible (win->label8, symbolic);
if (symbolic)
set_image (win->image8, name, 64);
gtk_widget_set_visible (win->description, description && description[0]);
if (description && description[0])
gtk_label_set_text (GTK_LABEL (win->description), description);
gtk_window_present (GTK_WINDOW (win->details));
g_object_unref (icon);
}
static GdkPaintable *
get_image_paintable (GtkImage *image)
{
const char *icon_name;
GtkIconTheme *icon_theme;
GtkIconPaintable *icon;
int size;
switch (gtk_image_get_storage_type (image))
{
case GTK_IMAGE_PAINTABLE:
return g_object_ref (gtk_image_get_paintable (image));
case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (image);
size = gtk_image_get_pixel_size (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
icon = gtk_icon_theme_lookup_icon (icon_theme,
icon_name,
NULL,
size, 1,
gtk_widget_get_direction (GTK_WIDGET (image)),
0);
if (icon == NULL)
{
g_print ("no icon for %s\n", icon_name);
return NULL;
}
return GDK_PAINTABLE (icon);
case GTK_IMAGE_GICON:
case GTK_IMAGE_EMPTY:
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
return NULL;
}
}
static void
drag_begin (GtkDragSource *source,
GdkDrag *drag,
GtkWidget *widget)
{
GdkPaintable *paintable;
paintable = get_image_paintable (GTK_IMAGE (widget));
if (paintable)
{
int w, h;
w = gdk_paintable_get_intrinsic_width (paintable);
h = gdk_paintable_get_intrinsic_height (paintable);
gtk_drag_source_set_icon (source, paintable, w, h);
g_object_unref (paintable);
}
}
static GdkContentProvider *
drag_prepare_texture (GtkDragSource *source,
double x,
double y,
GtkWidget *widget)
{
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (widget));
GtkSnapshot *snapshot;
double width, height;
GskRenderNode *node;
GskRenderer *renderer;
GdkTexture *texture;
GdkContentProvider *ret;
if (!GDK_IS_PAINTABLE (paintable))
return NULL;
snapshot = gtk_snapshot_new ();
width = gdk_paintable_get_intrinsic_width (paintable);
height = gdk_paintable_get_intrinsic_height (paintable);
gdk_paintable_snapshot (paintable, snapshot, width, height);
node = gtk_snapshot_free_to_node (snapshot);
renderer = gtk_native_get_renderer (gtk_widget_get_native (widget));
texture = gsk_renderer_render_texture (renderer, node, &GRAPHENE_RECT_INIT (0, 0, width, height));
ret = gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, texture);
g_object_unref (texture);
gsk_render_node_unref (node);
return ret;
}
static GdkContentProvider *
drag_prepare_file (GtkDragSource *source,
double x,
double y,
GtkWidget *widget)
{
GdkContentProvider *content;
GtkIconTheme *icon_theme;
const char *name;
GtkIconPaintable *info;
name = gtk_image_get_icon_name (GTK_IMAGE (widget));
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
info = gtk_icon_theme_lookup_icon (icon_theme,
name,
NULL,
32, 1,
gtk_widget_get_direction (widget),
0);
content = gdk_content_provider_new_typed (G_TYPE_FILE, gtk_icon_paintable_get_file (info));
g_object_unref (info);
return content;
}
static void
setup_image_dnd (GtkWidget *image)
{
GtkDragSource *source;
source = gtk_drag_source_new ();
g_signal_connect (source, "prepare", G_CALLBACK (drag_prepare_texture), image);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
}
static void
setup_scalable_image_dnd (GtkWidget *image)
{
GtkDragSource *source;
source = gtk_drag_source_new ();
g_signal_connect (source, "prepare", G_CALLBACK (drag_prepare_file), image);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
}
static void
search_mode_toggled (GtkSearchBar *searchbar,
GParamSpec *pspec,
IconBrowserWindow *win)
{
if (gtk_search_bar_get_search_mode (searchbar))
gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (win->context_model), GTK_INVALID_LIST_POSITION);
else if (gtk_single_selection_get_selected (GTK_SINGLE_SELECTION (win->context_model)) == GTK_INVALID_LIST_POSITION)
gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (win->context_model), 0);
gtk_filter_changed (win->search_mode_filter, GTK_FILTER_CHANGE_DIFFERENT);
}
static void
selected_name_changed (GtkSingleSelection *selection,
GParamSpec *pspec,
IconBrowserWindow *win)
{
if (gtk_single_selection_get_selected (selection) != GTK_INVALID_LIST_POSITION)
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (win->searchbar), FALSE);
}
static void
icon_browser_window_init (IconBrowserWindow *win)
{
GtkFilter *filter;
gtk_widget_init_template (GTK_WIDGET (win));
setup_image_dnd (win->image1);
setup_image_dnd (win->image2);
setup_image_dnd (win->image3);
setup_image_dnd (win->image4);
setup_image_dnd (win->image5);
setup_image_dnd (win->image6);
setup_image_dnd (win->image7);
setup_scalable_image_dnd (win->image8);
gtk_window_set_transient_for (GTK_WINDOW (win->details), GTK_WINDOW (win));
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (win->searchbar), GTK_WIDGET (win));
populate (win);
filter = gtk_filter_list_model_get_filter (GTK_FILTER_LIST_MODEL (win->icon_filter_model));
win->name_filter = GTK_FILTER (gtk_custom_filter_new (filter_by_icon_name, NULL, NULL));
gtk_multi_filter_append (GTK_MULTI_FILTER (filter), g_object_ref (win->name_filter));
g_signal_connect (win->searchbar, "notify::search-mode-enabled", G_CALLBACK (search_mode_toggled), win);
g_signal_connect (win->context_model, "notify::selected", G_CALLBACK (selected_name_changed), win);
}
static void
icon_browser_window_dispose (GObject *object)
{
gtk_widget_dispose_template (GTK_WIDGET (object), ICON_BROWSER_WINDOW_TYPE);
G_OBJECT_CLASS (icon_browser_window_parent_class)->dispose (object);
}
static void
icon_browser_window_finalize (GObject *object)
{
IconBrowserWindow *win = ICON_BROWSER_WINDOW (object);
g_clear_object (&win->name_filter);
G_OBJECT_CLASS (icon_browser_window_parent_class)->finalize (object);
}
static void
icon_browser_window_class_init (IconBrowserWindowClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = icon_browser_window_dispose;
object_class->finalize = icon_browser_window_finalize;
g_type_ensure (IB_TYPE_ICON);
g_type_ensure (IB_TYPE_CONTEXT);
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
"/org/gtk/iconbrowser/gtk/window.ui");
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, symbolic_radio);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, searchbar);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, icon_store);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, icon_filter_model);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, context_model);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, context_store);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, details);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image1);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image2);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image3);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image4);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image5);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image6);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image7);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image8);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, label8);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, description);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, search_mode_filter);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), item_activated);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), copy_to_clipboard);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), symbolic_toggled);
}
IconBrowserWindow *
icon_browser_window_new (IconBrowserApp *app)
{
return g_object_new (ICON_BROWSER_WINDOW_TYPE, "application", app, NULL);
}
+16
View File
@@ -0,0 +1,16 @@
#pragma once
#include <gtk/gtk.h>
#include "iconbrowserapp.h"
#define ICON_BROWSER_WINDOW_TYPE (icon_browser_window_get_type ())
#define ICON_BROWSER_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ICON_BROWSER_WINDOW_TYPE, IconBrowserWindow))
typedef struct _IconBrowserWindow IconBrowserWindow;
typedef struct _IconBrowserWindowClass IconBrowserWindowClass;
GType icon_browser_window_get_type (void);
IconBrowserWindow *icon_browser_window_new (IconBrowserApp *app);
+8
View File
@@ -0,0 +1,8 @@
#include <gtk/gtk.h>
#include <iconbrowserapp.h>
int
main (int argc, char *argv[])
{
return g_application_run (G_APPLICATION (icon_browser_app_new ()), argc, argv);
}
+41
View File
@@ -0,0 +1,41 @@
iconbrowser_sources = [
'main.c',
'iconbrowserapp.c',
'iconbrowserwin.c',
'iconbrowsericon.c',
'iconbrowsercontext.c'
]
iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
'iconbrowser.gresource.xml',
source_dir: meson.current_source_dir(),
)
executable('gtk4-icon-browser',
sources: [iconbrowser_sources, iconbrowser_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, profile_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: true,
)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size, install_dir: icontheme_dir)
endforeach
# desktop file
install_data('org.gtk.IconBrowser4.desktop', install_dir: gtk_applicationsdir)
# appdata
configure_file(
input: 'org.gtk.IconBrowser4.appdata.xml.in',
output: 'org.gtk.IconBrowser4.appdata.xml',
configuration: appdata_config,
install_dir: gtk_appdatadir
)
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.IconBrowser4</id>
<launchable type="desktop-id">org.gtk.IconBrowser4.desktop</launchable>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.1-or-later</project_license>
<name>GTK Icon Browser</name>
<summary>Program to browse themed icons</summary>
<description>
<p>
GTK Icon Browser is a simple application to show themed icons that
are available on the system.
</p>
</description>
<screenshots>
<screenshot>
<image>https://static.gnome.org/appdata/gtk4-icon-browser/gtk-icon-browser1.png</image>
<caption>Icon Browser</caption>
</screenshot>
<screenshot>
<image>https://static.gnome.org/appdata/gtk4-icon-browser/gtk-icon-browser2.png</image>
<caption>Search</caption>
</screenshot>
</screenshots>
<kudos>
<kudo>HiDpiIcon</kudo>
<kudo>ModernToolkit</kudo>
</kudos>
<url type="homepage">https://www.gtk.org</url>
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@">
<description>
<p>A new build of GTK.</p>
</description>
</release>
</releases>
</component>
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Icon Browser
Comment=An application that shows themed icons
Exec=gtk4-icon-browser
Icon=org.gtk.IconBrowser4
Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
+482
View File
@@ -0,0 +1,482 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="gear_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Inspector</attribute>
<attribute name="action">app.inspector</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About GTK Icon Browser</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
<template class="IconBrowserWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Icon Browser</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<child type="title">
<object class="GtkBox">
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkToggleButton" id="normal_radio">
<property name="focus-on-click">0</property>
<property name="label" translatable="yes">Normal</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="symbolic_radio">
<property name="focus-on-click">0</property>
<property name="label" translatable="yes">Symbolic</property>
<property name="group">normal_radio</property>
<signal name="notify::active" handler="symbolic_toggled" swapped="yes" after="yes"/>
</object>
</child>
</object>
</child>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="focus-on-click">0</property>
<property name="valign">center</property>
<property name="menu-model">gear_menu</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
<child type="end">
<object class="GtkToggleButton" id="search">
<property name="focus-on-click">0</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="search-icon">
<property name="icon-name">edit-find-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<child>
<object class="GtkScrolledWindow">
<style>
<class name="sidebar"/>
</style>
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkListView">
<style>
<class name="navigation-sidebar"/>
</style>
<property name="model">
<object class="GtkSingleSelection" id="context_model">
<property name="model">
<object class="GListStore" id="context_store">
<property name="item-type">IbContext</property>
</object>
</property>
</object>
</property>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes">
<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="name" type="IbContext">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="content_box">
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="searchbar">
<property name="search-mode-enabled" bind-source="search" bind-property="active" bind-flags="bidirectional"/>
<child>
<object class="GtkSearchEntry" id="searchentry">
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="sw">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkGridView" id="list">
<style>
<class name="content-view"/>
</style>
<signal name="activate" handler="item_activated"/>
<property name="single-click-activate">1</property>
<property name="model">
<object class="GtkNoSelection">
<property name="model">
<object class="GtkFilterListModel" id="icon_filter_model">
<property name="filter">
<object class="GtkEveryFilter">
<child>
<object class="GtkStringFilter">
<property name="expression">
<lookup name="name" type="IbIcon"/>
</property>
<binding name="search">
<lookup name="text" type="GtkSearchEntry">
searchentry
</lookup>
</binding>
</object>
</child>
<child>
<object class="GtkAnyFilter">
<child>
<object class="GtkBoolFilter" id="search_mode_filter">
<property name="expression">
<lookup name="search-mode-enabled">
searchbar
</lookup>
</property>
</object>
</child>
<child>
<object class="GtkStringFilter">
<property name="ignore-case">0</property>
<property name="match-mode">exact</property>
<property name="expression">
<lookup name="context" type="IbIcon"/>
</property>
<binding name="search">
<lookup name="id" type="IbContext">
<lookup name="selected-item" type="GtkSingleSelection">
context_model
</lookup>
</lookup>
</binding>
</object>
</child>
</object>
</child>
</object>
</property>
<property name="model">
<object class="GListStore" id="icon_store">
<property name="item-type">IbIcon</property>
</object>
</property>
</object>
</property>
</object>
</property>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes">
<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkImage">
<property name="pixel-size">48</property>
<binding name="icon-name">
<lookup name="name" type="IbIcon">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
<child>
<object class="GtkLabel">
<binding name="label">
<lookup name="name" type="IbIcon">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
<object class="GtkDialog" id="details">
<property name="modal">1</property>
<property name="use-header-bar">1</property>
<property name="resizable">0</property>
<property name="hide-on-close">1</property>
<child internal-child="content_area">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid">
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="row-spacing">18</property>
<property name="column-spacing">18</property>
<property name="halign">center</property>
<child>
<object class="GtkImage" id="image1">
<property name="halign">center</property>
<property name="valign">end</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image2">
<property name="halign">center</property>
<property name="valign">end</property>
<layout>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image3">
<property name="halign">center</property>
<property name="valign">end</property>
<layout>
<property name="column">2</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image4">
<property name="halign">center</property>
<property name="valign">end</property>
<layout>
<property name="column">3</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image5">
<property name="halign">center</property>
<property name="valign">end</property>
<layout>
<property name="column">4</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image6">
<property name="halign">center</property>
<property name="valign">end</property>
<layout>
<property name="column">5</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image7">
<property name="halign">center</property>
<property name="valign">end</property>
<layout>
<property name="column">6</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image8">
<property name="halign">center</property>
<property name="valign">end</property>
<layout>
<property name="column">7</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">8×8</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">16×16</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">1</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">18×18</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">2</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">24×24</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">3</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">32×32</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">4</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">48×48</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">5</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">64×64</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">6</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label8">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">scalable</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="column">7</property>
<property name="row">2</property>
</layout>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Copy to Clipboard</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<signal name="clicked" handler="copy_to_clipboard"/>
</object>
</child>
<child>
<object class="GtkLabel" id="description">
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="wrap">1</property>
<property name="max-width-chars">60</property>
<property name="valign">start</property>
</object>
</child>
</object>
</child>
</object>
</interface>
+3 -7
View File
@@ -112,7 +112,7 @@ activate_about (GSimpleAction *action,
? "GTK Node Editor (Development)"
: "GTK Node Editor",
"version", version,
"copyright", "© 2019—2024 The GTK Team",
"copyright", "© 2019—2021 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to test GTK rendering",
@@ -121,12 +121,8 @@ activate_about (GSimpleAction *action,
"title", "About GTK Node Editor",
"system-information", s->str,
NULL);
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
"Artwork by", (const char *[]) { "Jakub Steiner", NULL });
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
"Maintained by", (const char *[]) { "The GTK Team", NULL });
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
"Artwork by", (const char *[]) { "Jakub Steiner", NULL });
gtk_window_present (GTK_WINDOW (dialog));
+16 -6
View File
@@ -576,6 +576,18 @@ activate_about (GSimpleAction *action,
int i;
char *os_name;
char *os_version;
const char *authors[] = {
"Alexander Larsson",
NULL
};
const char *artists[] = {
"Jakub Steiner",
NULL
};
const char *maintainers[] = {
"The GTK Team",
NULL
};
GtkWidget *dialog;
os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
@@ -619,21 +631,19 @@ activate_about (GSimpleAction *action,
? "GTK Print Editor (Development)"
: "GTK Print Editor",
"version", version,
"copyright", "© 2006-2024 Red Hat, Inc",
"copyright", "© 2006-2021 Red Hat, Inc",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK printing",
"authors", (const char *[]) { "Alexander Larsson", NULL },
"authors", authors,
"logo-icon-name", "org.gtk.PrintEditor4",
"title", "About GTK Print Editor",
"system-information", sysinfo->str,
NULL);
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
_("Artwork by"), (const char *[]) { "Jakub Steiner", NULL });
_("Artwork by"), artists);
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
_("Maintained by"), (const char *[]) { "The GTK Team", NULL });
_("Maintained by"), maintainers);
gtk_window_present (GTK_WINDOW (dialog));
+12 -3
View File
@@ -294,6 +294,15 @@ activate_about (GSimpleAction *action,
GtkApplication *app = user_data;
GtkWindow *window;
GtkWidget *button;
const char *authors[] = {
"Andrea Cimitan",
"Cosimo Cecchi",
NULL
};
const char *maintainers[] = {
"The GTK Team",
NULL
};
char *version;
char *os_name;
char *os_version;
@@ -338,18 +347,18 @@ activate_about (GSimpleAction *action,
? "GTK Widget Factory (Development)"
: "GTK Widget Factory",
"version", version,
"copyright", "© 1997—2024 The GTK Team",
"copyright", "© 1997—2021 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK themes and widgets",
"authors", (const char *[]) { "Andrea Cimitan", "Cosimo Cecchi", NULL },
"authors", authors,
"logo-icon-name", "org.gtk.WidgetFactory4",
"title", "About GTK Widget Factory",
"system-information", s->str,
NULL);
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
_("Maintained by"), (const char *[]) { "The GTK Team", NULL });
_("Maintained by"), maintainers);
gtk_window_present (GTK_WINDOW (dialog));
+1 -13
View File
@@ -38,7 +38,7 @@ if get_option('documentation')
gdk_gir[0],
],
depends: gdk_gir[0],
suite: ['docs'],
suite: ['docs', 'failing'],
)
if x11_enabled
@@ -69,18 +69,6 @@ if get_option('documentation')
install: true,
install_dir: docs_dir,
)
test('doc-check-gdk-x11',
gidocgen,
args: [
'check',
'--config', gdk4x11_toml,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
gdk_x11_gir[0],
],
depends: gdk_x11_gir[0],
suite: ['docs', 'failing'],
)
endif
if wayland_enabled
+1 -2
View File
@@ -205,8 +205,7 @@ Other libraries, such as libadwaita, may provide replacements as well.
## gtk_show_uri is being replaced
Instead of `gtk_show_uri()`, you should use [class@Gtk.UriLauncher]
or [class@Gtk.FileLauncher].
Instead of `gtk_show_uri()`, you should use [class@Gtk.UriLauncher]or [class@Gtk.FileLauncher].
## GtkStatusbar is going away
+21 -31
View File
@@ -181,21 +181,15 @@ matrix3d() production to specify all 16 values individually.
### conic-gradient
| property | syntax | default | printed |
| ----------------- | --------------- | -------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25, 25 | always |
| rotation | `<number>` | 0 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
| interpolation | `<color-state>` | srgb | non-default |
| hue-interpolation | `<hue-interp>` | shorter | non-default |
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25, 25 | always |
| rotation | `<number>` | 0 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_conic_gradient_node_new()` with the given properties.
Possible values for the hue-interpolation property are:
hue-interpolation: shorter | longer | increasing | decreasing
### cross-fade
| property | syntax | default | printed |
@@ -264,14 +258,12 @@ Creates a node like `gsk_inset_shadow_node_new()` with the given properties.
### linear-gradient
| property | syntax | default | printed |
| ----------------- | --------------- | -------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| start | `<point>` | 0 0 | always |
| end | `<point>` | 0 50 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
| interpolation | `<color-state>` | srgb | non-default |
| hue-interpolation | `<hue-interp>` | shorter | non-default |
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| start | `<point>` | 0 0 | always |
| end | `<point>` | 0 50 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
@@ -313,17 +305,15 @@ Creates a node like `gsk_outset_shadow_node_new()` with the given properties.
### radial-gradient
| property | syntax | default | printed |
| ----------------- | --------------- | -------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25 25 | always |
| hradius | `<number>` | 25 | always |
| vradius | `<number>` | 25 | always |
| start | `<number>` | 0 | always |
| end | `<number>` | 1 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
| interpolation | `<color-state>` | srgb | non-default |
| hue-interpolation | `<hue-interp>` | shorter | non-default |
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25 25 | always |
| hradius | `<number>` | 25 | always |
| vradius | `<number>` | 25 | always |
| start | `<number>` | 0 | always |
| end | `<number>` | 1 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_radial_gradient_node_new()` with the given properties.
+4 -9
View File
@@ -113,12 +113,6 @@ static int gdk_initialized = 0; /* 1 if the library is initi
* 0 otherwise.
*/
gboolean
gdk_is_initialized (void)
{
return gdk_initialized != 0;
}
static const GdkDebugKey gdk_debug_keys[] = {
{ "misc", GDK_DEBUG_MISC, "Miscellaneous information" },
{ "events", GDK_DEBUG_EVENTS, "Information about events" },
@@ -366,12 +360,13 @@ gdk_display_open_default (void)
{
GdkDisplay *display;
gdk_ensure_initialized ();
g_return_val_if_fail (gdk_initialized, NULL);
display = gdk_display_get_default ();
if (display)
return display;
if (!display)
display = gdk_display_open (NULL);
display = gdk_display_open (NULL);
return display;
}
-12
View File
@@ -122,18 +122,6 @@ gdk_cairo_pattern_add_color_stop_rgba_ccs (cairo_pattern_t *pattern,
cairo_pattern_add_color_stop_rgba (pattern, offset, color[0], color[1], color[2], color[3]);
}
static inline void
gdk_cairo_pattern_add_color_stop_color (cairo_pattern_t *pattern,
GdkColorState *ccs,
double offset,
const GdkColor *color)
{
float values[4];
gdk_color_to_float (color, ccs, values);
cairo_pattern_add_color_stop_rgba (pattern, offset, values[0], values[1], values[2], values[3]);
}
static inline void
gdk_cairo_rect (cairo_t *cr,
const graphene_rect_t *rect)
+1 -1
View File
@@ -478,4 +478,4 @@ gdk_cicp_params_get_cicp (GdkCicpParams *self)
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
-50
View File
@@ -233,53 +233,3 @@ static const float srgb_to_rec2020[9] = {
0.069108, 0.919519, 0.011360,
0.016394, 0.088011, 0.895380,
};
/* oklab conversion */
static float
from_oklab_nl (float v)
{
return v * v * v;
}
static float
to_oklab_nl (float v)
{
return cbrtf (v);
}
static const float oklab_to_lms[9] = {
1, 0.3963377774, 0.2158037573,
1, -0.1055613458, -0.0638541728,
1, -0.0894841775, -1.2914855480
};
static const float lms_to_srgb[9] = {
4.0767416621, -3.3077115913, 0.2309699292,
-1.2684380046, 2.6097574011, -0.3413193965,
-0.0041960863, -0.7034186147, 1.7076147010,
};
static const float srgb_to_lms[9] = {
0.4122214708, 0.5363325363, 0.0514459929,
0.2119034982, 0.6806995451, 0.1073969566,
0.0883024619, 0.2817188376, 0.6299787005,
};
static const float lms_to_oklab[9] = {
0.2104542553, 0.7936177850, -0.0040720468,
1.9779984951, -2.4285922050, 0.4505937099,
0.0259040371, 0.7827717662, -0.8086757660,
};
static const float rec2020_to_lms[9] = {
0.616645, 0.360250, 0.023064,
0.265075, 0.635874, 0.099059,
0.100076, 0.203907, 0.696161,
};
static const float lms_to_rec2020[9] = {
2.140325, -1.246734, 0.106491,
-0.884665, 2.163141, -0.278489,
-0.048559, -0.454366, 1.502711,
};
+68 -278
View File
@@ -172,41 +172,6 @@ gdk_color_state_get_rec2100_linear (void)
return GDK_COLOR_STATE_REC2100_LINEAR;
}
/**
* gdk_color_state_get_oklab:
*
* Returns the color state object representing the oklab color space.
*
* This is a perceptually uniform color state.
*
* Returns: the color state object for oklab
*
* Since: 4.18
*/
GdkColorState *
gdk_color_state_get_oklab (void)
{
return GDK_COLOR_STATE_OKLAB;
}
/**
* gdk_color_state_get_oklch:
*
* Returns the color state object representing the oklch color space.
*
* This is the polar variant of oklab, in which the hue is encoded as
* a polar coordinate.
*
* Returns: the color state object for oklch
*
* Since: 4.18
*/
GdkColorState *
gdk_color_state_get_oklch (void)
{
return GDK_COLOR_STATE_OKLCH;
}
/**
* gdk_color_state_equal:
* @self: a `GdkColorState`
@@ -258,171 +223,56 @@ gdk_color_state_create_cicp_params (GdkColorState *self)
/* {{{ Conversion functions */
typedef float (* GdkTransferFunc) (float v);
typedef void (* GdkConvertFunc) (GdkColorState *self,
float values[4]);
typedef const float GdkColorMatrix[9];
#define IDENTITY ((float*)0)
#define NONE ((GdkTransferFunc)0)
#define CONVERT_FUNC(name) \
#define TRANSFORM(name, eotf, matrix, oetf) \
static void \
gdk_convert_ ## name (GdkColorState *self, \
float (*values)[4], \
gsize n_values) \
name (GdkColorState *self, \
float (*values)[4], \
gsize n_values) \
{ \
for (gsize i = 0; i < n_values; i++) \
{ \
name (self, values[i]); \
if (eotf != NONE) \
{ \
values[i][0] = eotf (values[i][0]); \
values[i][1] = eotf (values[i][1]); \
values[i][2] = eotf (values[i][2]); \
} \
if (matrix != IDENTITY) \
{ \
float res[3]; \
res[0] = matrix[0] * values[i][0] + matrix[1] * values[i][1] + matrix[2] * values[i][2]; \
res[1] = matrix[3] * values[i][0] + matrix[4] * values[i][1] + matrix[5] * values[i][2]; \
res[2] = matrix[6] * values[i][0] + matrix[7] * values[i][1] + matrix[8] * values[i][2]; \
values[i][0] = res[0]; \
values[i][1] = res[1]; \
values[i][2] = res[2]; \
} \
if (oetf != NONE) \
{ \
values[i][0] = oetf (values[i][0]); \
values[i][1] = oetf (values[i][1]); \
values[i][2] = oetf (values[i][2]); \
} \
} \
}
#define TRANSFORM(name, eotf, matrix, nonlinear, matrix2, oetf) \
static inline void \
name (GdkColorState *self, \
float values[4]) \
{ \
if (eotf != NONE) \
{ \
values[0] = eotf (values[0]); \
values[1] = eotf (values[1]); \
values[2] = eotf (values[2]); \
} \
if (matrix != IDENTITY) \
{ \
float res[3]; \
res[0] = matrix[0] * values[0] + matrix[1] * values[1] + matrix[2] * values[2]; \
res[1] = matrix[3] * values[0] + matrix[4] * values[1] + matrix[5] * values[2]; \
res[2] = matrix[6] * values[0] + matrix[7] * values[1] + matrix[8] * values[2]; \
values[0] = res[0]; \
values[1] = res[1]; \
values[2] = res[2]; \
} \
if (nonlinear != NONE) \
{ \
values[0] = nonlinear (values[0]); \
values[1] = nonlinear (values[1]); \
values[2] = nonlinear (values[2]); \
} \
if (matrix2 != IDENTITY) \
{ \
float res[3]; \
res[0] = matrix2[0] * values[0] + matrix2[1] * values[1] + matrix2[2] * values[2]; \
res[1] = matrix2[3] * values[0] + matrix2[4] * values[1] + matrix2[5] * values[2]; \
res[2] = matrix2[6] * values[0] + matrix2[7] * values[1] + matrix2[8] * values[2]; \
values[0] = res[0]; \
values[1] = res[1]; \
values[2] = res[2]; \
} \
if (oetf != NONE) \
{ \
values[0] = oetf (values[0]); \
values[1] = oetf (values[1]); \
values[2] = oetf (values[2]); \
} \
} \
CONVERT_FUNC (name)
#define TRANSFORM_PAIR(name, func1, func2) \
static inline void \
name (GdkColorState *self, \
float values[4]) \
{ \
func1 (self, values); \
func2 (self, values); \
} \
CONVERT_FUNC (name)
TRANSFORM(srgb_to_srgb_linear, srgb_eotf, IDENTITY, NONE, IDENTITY, NONE)
TRANSFORM(srgb_linear_to_srgb, NONE, IDENTITY, NONE, IDENTITY, srgb_oetf)
TRANSFORM(rec2100_pq_to_rec2100_linear, pq_eotf, IDENTITY, NONE, IDENTITY, NONE)
TRANSFORM(rec2100_linear_to_rec2100_pq, NONE, IDENTITY, NONE, IDENTITY, pq_oetf)
TRANSFORM(srgb_linear_to_rec2100_linear, NONE, srgb_to_rec2020, NONE, IDENTITY, NONE)
TRANSFORM(rec2100_linear_to_srgb_linear, NONE, rec2020_to_srgb, NONE, IDENTITY, NONE)
TRANSFORM(srgb_to_rec2100_linear, srgb_eotf, srgb_to_rec2020, NONE, IDENTITY, NONE)
TRANSFORM(rec2100_pq_to_srgb_linear, pq_eotf, rec2020_to_srgb, NONE, IDENTITY, NONE)
TRANSFORM(srgb_linear_to_rec2100_pq, NONE, srgb_to_rec2020, NONE, IDENTITY, pq_oetf)
TRANSFORM(rec2100_linear_to_srgb, NONE, rec2020_to_srgb, NONE, IDENTITY, srgb_oetf)
TRANSFORM(srgb_to_rec2100_pq, srgb_eotf, srgb_to_rec2020, NONE, IDENTITY, pq_oetf)
TRANSFORM(rec2100_pq_to_srgb, pq_eotf, rec2020_to_srgb, NONE, IDENTITY, srgb_oetf)
TRANSFORM(oklab_to_srgb_linear, NONE, oklab_to_lms, from_oklab_nl, lms_to_srgb, NONE)
TRANSFORM(oklab_to_srgb, NONE, oklab_to_lms, from_oklab_nl, lms_to_srgb, srgb_oetf)
TRANSFORM(oklab_to_rec2100_linear, NONE, oklab_to_lms, from_oklab_nl, lms_to_rec2020, NONE)
TRANSFORM(oklab_to_rec2100_pq, NONE, oklab_to_lms, from_oklab_nl, lms_to_rec2020, pq_oetf)
TRANSFORM(srgb_linear_to_oklab, NONE, srgb_to_lms, to_oklab_nl, lms_to_oklab, NONE)
TRANSFORM(srgb_to_oklab, srgb_eotf, srgb_to_lms, to_oklab_nl, lms_to_oklab, NONE)
TRANSFORM(rec2100_linear_to_oklab, NONE, rec2020_to_lms, to_oklab_nl, lms_to_oklab, NONE)
TRANSFORM(rec2100_pq_to_oklab, pq_eotf, rec2020_to_lms, to_oklab_nl, lms_to_oklab, NONE)
#define DEG_TO_RAD(x) ((x) * G_PI / 180)
#define RAD_TO_DEG(x) ((x) * 180 / G_PI)
static inline void
_sincosf (float angle,
float *out_s,
float *out_c)
{
#ifdef HAVE_SINCOSF
sincosf (angle, out_s, out_c);
#else
*out_s = sinf (angle);
*out_c = cosf (angle);
#endif
}
static void
oklch_to_oklab (GdkColorState *self,
float values[4])
{
float L, C, H, a, b;
L = values[0];
C = values[1];
H = values[2];
_sincosf (DEG_TO_RAD (H), &b, &a);
a *= C;
b *= C;
values[0] = L;
values[1] = a;
values[2] = b;
}
static void
oklab_to_oklch (GdkColorState *self,
float values[4])
{
float L, a, b, C, H;
L = values[0];
a = values[1];
b = values[2];
C = hypotf (a, b);
H = RAD_TO_DEG (atan2 (b, a));
H = fmod (H, 360);
if (H < 0)
H += 360;
values[0] = L;
values[1] = C;
values[2] = H;
}
CONVERT_FUNC (oklch_to_oklab)
CONVERT_FUNC (oklab_to_oklch)
TRANSFORM_PAIR (srgb_to_oklch, srgb_to_oklab, oklab_to_oklch)
TRANSFORM_PAIR (srgb_linear_to_oklch, srgb_linear_to_oklab, oklab_to_oklch)
TRANSFORM_PAIR (rec2100_pq_to_oklch, rec2100_pq_to_oklab, oklab_to_oklch)
TRANSFORM_PAIR (rec2100_linear_to_oklch, rec2100_linear_to_oklab, oklab_to_oklch)
TRANSFORM_PAIR (oklch_to_srgb, oklch_to_oklab, oklab_to_srgb)
TRANSFORM_PAIR (oklch_to_srgb_linear, oklch_to_oklab, oklab_to_srgb_linear)
TRANSFORM_PAIR (oklch_to_rec2100_pq, oklch_to_oklab, oklab_to_rec2100_pq)
TRANSFORM_PAIR (oklch_to_rec2100_linear, oklch_to_oklab, oklab_to_rec2100_pq)
TRANSFORM(gdk_default_srgb_to_srgb_linear, srgb_eotf, IDENTITY, NONE);
TRANSFORM(gdk_default_srgb_linear_to_srgb, NONE, IDENTITY, srgb_oetf)
TRANSFORM(gdk_default_rec2100_pq_to_rec2100_linear, pq_eotf, IDENTITY, NONE)
TRANSFORM(gdk_default_rec2100_linear_to_rec2100_pq, NONE, IDENTITY, pq_oetf)
TRANSFORM(gdk_default_srgb_linear_to_rec2100_linear, NONE, srgb_to_rec2020, NONE)
TRANSFORM(gdk_default_rec2100_linear_to_srgb_linear, NONE, rec2020_to_srgb, NONE)
TRANSFORM(gdk_default_srgb_to_rec2100_linear, srgb_eotf, srgb_to_rec2020, NONE)
TRANSFORM(gdk_default_rec2100_pq_to_srgb_linear, pq_eotf, rec2020_to_srgb, NONE)
TRANSFORM(gdk_default_srgb_linear_to_rec2100_pq, NONE, srgb_to_rec2020, pq_oetf)
TRANSFORM(gdk_default_rec2100_linear_to_srgb, NONE, rec2020_to_srgb, srgb_oetf)
TRANSFORM(gdk_default_srgb_to_rec2100_pq, srgb_eotf, srgb_to_rec2020, pq_oetf)
TRANSFORM(gdk_default_rec2100_pq_to_srgb, pq_eotf, rec2020_to_srgb, srgb_oetf)
/* }}} */
/* {{{ Default implementation */
@@ -478,9 +328,6 @@ gdk_default_color_state_get_cicp (GdkColorState *color_state)
{
GdkDefaultColorState *self = (GdkDefaultColorState *) color_state;
if (self->cicp.color_primaries == 0)
return NULL;
return &self->cicp;
}
@@ -572,11 +419,9 @@ GdkDefaultColorState gdk_default_color_states[] = {
.name = "srgb",
.no_srgb = GDK_COLOR_STATE_SRGB_LINEAR,
.convert_to = {
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_srgb_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_srgb_to_rec2100_pq,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_srgb_to_rec2100_linear,
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_srgb_to_oklab,
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_srgb_to_oklch,
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_srgb_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_srgb_to_rec2100_pq,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_srgb_to_rec2100_linear,
},
.clamp = gdk_color_state_clamp_0_1,
.cicp = { 1, 13, 0, 1 },
@@ -592,11 +437,9 @@ GdkDefaultColorState gdk_default_color_states[] = {
.name = "srgb-linear",
.no_srgb = NULL,
.convert_to = {
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_srgb_linear_to_srgb,
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_srgb_linear_to_rec2100_pq,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_srgb_linear_to_rec2100_linear,
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_srgb_linear_to_oklab,
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_srgb_linear_to_oklch,
[GDK_COLOR_STATE_ID_SRGB] = gdk_default_srgb_linear_to_srgb,
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_srgb_linear_to_rec2100_pq,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_srgb_linear_to_rec2100_linear,
},
.clamp = gdk_color_state_clamp_0_1,
.cicp = { 1, 8, 0, 1 },
@@ -612,11 +455,9 @@ GdkDefaultColorState gdk_default_color_states[] = {
.name = "rec2100-pq",
.no_srgb = NULL,
.convert_to = {
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_rec2100_pq_to_srgb,
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_rec2100_pq_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_rec2100_pq_to_rec2100_linear,
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_rec2100_pq_to_oklab,
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_rec2100_pq_to_oklch,
[GDK_COLOR_STATE_ID_SRGB] = gdk_default_rec2100_pq_to_srgb,
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_rec2100_pq_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_rec2100_pq_to_rec2100_linear,
},
.clamp = gdk_color_state_clamp_0_1,
.cicp = { 9, 16, 0, 1 },
@@ -632,54 +473,16 @@ GdkDefaultColorState gdk_default_color_states[] = {
.name = "rec2100-linear",
.no_srgb = NULL,
.convert_to = {
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_rec2100_linear_to_srgb,
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_rec2100_linear_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_rec2100_linear_to_rec2100_pq,
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_rec2100_linear_to_oklab,
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_rec2100_linear_to_oklch,
[GDK_COLOR_STATE_ID_SRGB] = gdk_default_rec2100_linear_to_srgb,
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_rec2100_linear_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_rec2100_linear_to_rec2100_pq,
},
.clamp = gdk_color_state_clamp_unbounded,
.cicp = { 9, 8, 0, 1 },
},
[GDK_COLOR_STATE_ID_OKLAB] = {
.parent = {
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
.ref_count = 0,
.depth = GDK_MEMORY_FLOAT16,
.rendering_color_state = GDK_COLOR_STATE_SRGB,
},
.name = "oklab",
.no_srgb = NULL,
.convert_to = {
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_oklab_to_srgb,
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_oklab_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_oklab_to_rec2100_pq,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_oklab_to_rec2100_linear,
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_oklab_to_oklch,
},
.cicp = { 0, 0, 0, 0 },
},
[GDK_COLOR_STATE_ID_OKLCH] = {
.parent = {
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
.ref_count = 0,
.depth = GDK_MEMORY_FLOAT16,
.rendering_color_state = GDK_COLOR_STATE_SRGB,
},
.name = "oklch",
.no_srgb = NULL,
.convert_to = {
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_oklch_to_srgb,
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_oklch_to_srgb_linear,
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_oklch_to_rec2100_pq,
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_oklch_to_rec2100_linear,
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_oklch_to_oklab,
},
.cicp = { 0, 0, 0, 0 },
},
};
/* }}} */
/* }}} */
/* {{{ Cicp implementation */
typedef struct _GdkCicpColorState GdkCicpColorState;
@@ -706,22 +509,17 @@ struct _GdkCicpColorState
#define cicp ((GdkCicpColorState *)self)
TRANSFORM(cicp_to_srgb, cicp->eotf, cicp->to_srgb, NONE, IDENTITY, srgb_oetf)
TRANSFORM(cicp_to_srgb_linear, cicp->eotf, cicp->to_srgb, NONE, IDENTITY, NONE)
TRANSFORM(cicp_to_rec2100_pq, cicp->eotf, cicp->to_rec2020, NONE, IDENTITY, pq_oetf)
TRANSFORM(cicp_to_rec2100_linear, cicp->eotf, cicp->to_rec2020, NONE, IDENTITY, NONE)
TRANSFORM(cicp_from_srgb, srgb_eotf, cicp->from_srgb, NONE, IDENTITY, cicp->oetf)
TRANSFORM(cicp_from_srgb_linear, NONE, cicp->from_srgb, NONE, IDENTITY, cicp->oetf)
TRANSFORM(cicp_from_rec2100_pq, pq_eotf, cicp->from_rec2020, NONE, IDENTITY, cicp->oetf)
TRANSFORM(cicp_from_rec2100_linear, NONE, cicp->from_rec2020, NONE, IDENTITY, cicp->oetf)
TRANSFORM(gdk_cicp_to_srgb, cicp->eotf, cicp->to_srgb, srgb_oetf)
TRANSFORM(gdk_cicp_to_srgb_linear, cicp->eotf, cicp->to_srgb, NONE)
TRANSFORM(gdk_cicp_to_rec2100_pq, cicp->eotf, cicp->to_rec2020, pq_oetf)
TRANSFORM(gdk_cicp_to_rec2100_linear, cicp->eotf, cicp->to_rec2020, NONE)
TRANSFORM(gdk_cicp_from_srgb, srgb_eotf, cicp->from_srgb, cicp->oetf)
TRANSFORM(gdk_cicp_from_srgb_linear, NONE, cicp->from_srgb, cicp->oetf)
TRANSFORM(gdk_cicp_from_rec2100_pq, pq_eotf, cicp->from_rec2020, cicp->oetf)
TRANSFORM(gdk_cicp_from_rec2100_linear, NONE, cicp->from_rec2020, cicp->oetf)
#undef cicp
TRANSFORM_PAIR (cicp_to_oklab, cicp_to_srgb_linear, srgb_linear_to_oklab)
TRANSFORM_PAIR (cicp_from_oklab, oklab_to_srgb_linear, cicp_from_srgb_linear)
TRANSFORM_PAIR (cicp_to_oklch, cicp_to_srgb_linear, srgb_linear_to_oklch)
TRANSFORM_PAIR (cicp_from_oklch, oklch_to_srgb_linear, cicp_from_srgb_linear)
/* }}} */
/* {{{ Vfuncs */
@@ -774,17 +572,13 @@ gdk_cicp_color_state_get_convert_to (GdkColorState *self,
switch (GDK_DEFAULT_COLOR_STATE_ID (target))
{
case GDK_COLOR_STATE_ID_SRGB:
return gdk_convert_cicp_to_srgb;
return gdk_cicp_to_srgb;
case GDK_COLOR_STATE_ID_SRGB_LINEAR:
return gdk_convert_cicp_to_srgb_linear;
return gdk_cicp_to_srgb_linear;
case GDK_COLOR_STATE_ID_REC2100_PQ:
return gdk_convert_cicp_to_rec2100_pq;
return gdk_cicp_to_rec2100_pq;
case GDK_COLOR_STATE_ID_REC2100_LINEAR:
return gdk_convert_cicp_to_rec2100_linear;
case GDK_COLOR_STATE_ID_OKLAB:
return gdk_convert_cicp_to_oklab;
case GDK_COLOR_STATE_ID_OKLCH:
return gdk_convert_cicp_to_oklch;
return gdk_cicp_to_rec2100_linear;
case GDK_COLOR_STATE_N_IDS:
default:
@@ -804,17 +598,13 @@ gdk_cicp_color_state_get_convert_from (GdkColorState *self,
switch (GDK_DEFAULT_COLOR_STATE_ID (source))
{
case GDK_COLOR_STATE_ID_SRGB:
return gdk_convert_cicp_from_srgb;
return gdk_cicp_from_srgb;
case GDK_COLOR_STATE_ID_SRGB_LINEAR:
return gdk_convert_cicp_from_srgb_linear;
return gdk_cicp_from_srgb_linear;
case GDK_COLOR_STATE_ID_REC2100_PQ:
return gdk_convert_cicp_from_rec2100_pq;
return gdk_cicp_from_rec2100_pq;
case GDK_COLOR_STATE_ID_REC2100_LINEAR:
return gdk_convert_cicp_from_rec2100_linear;
case GDK_COLOR_STATE_ID_OKLAB:
return gdk_convert_cicp_from_oklab;
case GDK_COLOR_STATE_ID_OKLCH:
return gdk_convert_cicp_from_oklch;
return gdk_cicp_from_rec2100_linear;
case GDK_COLOR_STATE_N_IDS:
default:
@@ -1068,4 +858,4 @@ gdk_color_state_clamp (GdkColorState *self,
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -7
View File
@@ -49,12 +49,6 @@ GdkColorState * gdk_color_state_get_rec2100_pq (void);
GDK_AVAILABLE_IN_4_16
GdkColorState * gdk_color_state_get_rec2100_linear (void);
GDK_AVAILABLE_IN_4_16
GdkColorState * gdk_color_state_get_oklab (void);
GDK_AVAILABLE_IN_4_16
GdkColorState * gdk_color_state_get_oklch (void);
GDK_AVAILABLE_IN_4_16
gboolean gdk_color_state_equal (GdkColorState *self,
GdkColorState *other);
@@ -63,6 +57,6 @@ GDK_AVAILABLE_IN_4_16
GdkCicpParams *gdk_color_state_create_cicp_params (GdkColorState *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkColorState, gdk_color_state_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkColorState, gdk_color_state_unref);
G_END_DECLS
-4
View File
@@ -13,8 +13,6 @@ typedef enum
GDK_COLOR_STATE_ID_SRGB_LINEAR,
GDK_COLOR_STATE_ID_REC2100_PQ,
GDK_COLOR_STATE_ID_REC2100_LINEAR,
GDK_COLOR_STATE_ID_OKLAB,
GDK_COLOR_STATE_ID_OKLCH,
GDK_COLOR_STATE_N_IDS
} GdkColorStateId;
@@ -75,8 +73,6 @@ extern GdkDefaultColorState gdk_default_color_states[GDK_COLOR_STATE_N_IDS];
#define GDK_COLOR_STATE_SRGB_LINEAR ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_SRGB_LINEAR])
#define GDK_COLOR_STATE_REC2100_PQ ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_REC2100_PQ])
#define GDK_COLOR_STATE_REC2100_LINEAR ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_REC2100_LINEAR])
#define GDK_COLOR_STATE_OKLAB ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_OKLAB])
#define GDK_COLOR_STATE_OKLCH ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_OKLCH])
#define GDK_IS_DEFAULT_COLOR_STATE(c) ((GdkDefaultColorState *) (c) >= &gdk_default_color_states[0] && \
(GdkDefaultColorState *) (c) < &gdk_default_color_states[GDK_COLOR_STATE_N_IDS])
+2 -3
View File
@@ -1198,9 +1198,8 @@ gdk_display_get_app_launch_context (GdkDisplay *display)
GdkDisplay *
gdk_display_open (const char *display_name)
{
gdk_ensure_initialized ();
return gdk_display_manager_open_display (gdk_display_manager_get (), display_name);
return gdk_display_manager_open_display (gdk_display_manager_get (),
display_name);
}
gulong
-5
View File
@@ -28,7 +28,6 @@
#include "gdkdisplaymanagerprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkkeysprivate.h"
#include "gdkprivate.h"
#include <glib/gi18n-lib.h>
#ifdef GDK_WINDOWING_X11
@@ -295,8 +294,6 @@ gdk_display_manager_get (void)
{
static GdkDisplayManager *manager = NULL;
gdk_ensure_initialized ();
if (manager == NULL)
manager = g_object_new (GDK_TYPE_DISPLAY_MANAGER, NULL);
@@ -332,8 +329,6 @@ gdk_display_manager_get_default_display (GdkDisplayManager *manager)
GdkDisplay *
gdk_display_get_default (void)
{
gdk_ensure_initialized ();
return gdk_display_manager_get_default_display (gdk_display_manager_get ());
}
+1 -1
View File
@@ -55,6 +55,6 @@ GDK_AVAILABLE_IN_4_14
gboolean gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
const GdkDmabufFormats *formats2);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GdkDmabufFormats, gdk_dmabuf_formats_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GdkDmabufFormats, gdk_dmabuf_formats_unref);
G_END_DECLS
+1 -1
View File
@@ -3444,4 +3444,4 @@ gdk_grab_broken_event_get_implicit (GdkEvent *event)
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+10 -6
View File
@@ -382,6 +382,8 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
if (ctx == EGL_NO_CONTEXT)
return 0;
GDK_DISPLAY_DEBUG (display, OPENGL, "Created EGL context[%p]", ctx);
priv->egl_context = ctx;
gdk_gl_context_set_version (context, &supported_versions[j]);
gdk_gl_context_set_is_legacy (context, legacy);
@@ -1750,20 +1752,22 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
{
int i, max_texture_size;
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
gdk_debug_message ("%s version: %d.%d (%s)",
gdk_debug_message ("%s version: %d.%d (%s)\n"
"* GLSL version: %s\n"
"* Max texture size: %d\n",
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
priv->is_legacy ? "legacy" : "core");
gdk_debug_message ("GLSL version: %s", glGetString (GL_SHADING_LANGUAGE_VERSION));
gdk_debug_message ("Max texture size: %d", max_texture_size);
priv->is_legacy ? "legacy" : "core",
glGetString (GL_SHADING_LANGUAGE_VERSION),
max_texture_size);
gdk_debug_message ("Enabled features (use GDK_GL_DISABLE env var to disable):");
for (i = 0; i < G_N_ELEMENTS (gdk_gl_feature_keys); i++)
{
gdk_debug_message (" %s: %s",
gdk_gl_feature_keys[i].key,
(priv->features & gdk_gl_feature_keys[i].value) ? "" :
(priv->features & gdk_gl_feature_keys[i].value) ? "YES" :
((disabled_features & gdk_gl_feature_keys[i].value) ? "disabled via env var" :
(((supported_features & gdk_gl_feature_keys[i].value) == 0) ? "" :
(((supported_features & gdk_gl_feature_keys[i].value) == 0) ? "not supported" :
"Hum, what? This should not happen.")));
}
}
-7
View File
@@ -5,13 +5,6 @@
/* Private API for use in GTK+ */
void gdk_pre_parse (void);
gboolean gdk_is_initialized (void);
#define gdk_ensure_initialized() \
G_STMT_START { \
if (!gdk_is_initialized ()) \
g_error ("%s() was called before gtk_init()", G_STRFUNC); \
} G_STMT_END
gboolean gdk_running_in_sandbox (void);
gboolean gdk_should_use_portal (void);
+9 -59
View File
@@ -35,7 +35,7 @@
#include <math.h>
#ifdef GDK_RENDERING_VULKAN
static const GdkDebugKey gdk_vulkan_feature_keys[] = {
static const GdkDebugKey gsk_vulkan_feature_keys[] = {
{ "dmabuf", GDK_VULKAN_FEATURE_DMABUF, "Never import Dmabufs" },
{ "ycbcr", GDK_VULKAN_FEATURE_YCBCR, "Do not support Ycbcr textures (also disables dmabufs)" },
{ "semaphore-export", GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT, "Disable sync of exported dmabufs" },
@@ -419,10 +419,6 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
VkDevice device;
guint i;
GDK_DEBUG (VULKAN, "(Re)creating the swapchain for surface of size %dx%d",
gdk_surface_get_width (surface),
gdk_surface_get_height (surface));
device = gdk_vulkan_context_get_device (context);
/*
@@ -460,10 +456,6 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
GDK_DEBUG (VULKAN, "Using surface present mode %s",
surface_present_mode_to_string (present_mode));
GDK_DEBUG (VULKAN, "Using extent %dx%d",
capabilities.currentExtent.width,
capabilities.currentExtent.height);
/*
* Per https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/xhtml/vkspec.html#VkSurfaceCapabilitiesKHR
@@ -476,10 +468,6 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
capabilities.currentExtent.width = MAX (1, (int) ceil (gdk_surface_get_width (surface) * scale));
capabilities.currentExtent.height = MAX (1, (int) ceil (gdk_surface_get_height (surface) * scale));
GDK_DEBUG (VULKAN, "Effective extent %dx%d",
capabilities.currentExtent.width,
capabilities.currentExtent.height);
}
res = GDK_VK_CHECK (vkCreateSwapchainKHR, device,
@@ -566,20 +554,12 @@ physical_device_supports_extension (VkPhysicalDevice device,
{
VkExtensionProperties *extensions;
uint32_t n_device_extensions;
static gboolean first = TRUE;
GDK_VK_CHECK (vkEnumerateDeviceExtensionProperties, device, NULL, &n_device_extensions, NULL);
extensions = g_newa (VkExtensionProperties, n_device_extensions);
GDK_VK_CHECK (vkEnumerateDeviceExtensionProperties, device, NULL, &n_device_extensions, extensions);
if (first)
{
first = FALSE;
for (uint32_t i = 0; i < n_device_extensions; i++)
GDK_DEBUG (VULKAN, "%s", extensions[i].extensionName);
}
for (uint32_t i = 0; i < n_device_extensions; i++)
{
if (g_str_equal (extensions[i].extensionName, extension_name))
@@ -706,37 +686,7 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
{
GError *error = NULL;
if (acquire_result == VK_SUBOPTIMAL_KHR)
{
const VkPipelineStageFlags mask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
vkQueueSubmit (gdk_vulkan_context_get_queue (context),
1,
&(VkSubmitInfo) {
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
.waitSemaphoreCount = 1,
.pWaitSemaphores = &priv->draw_semaphore,
.pWaitDstStageMask = &mask,
},
VK_NULL_HANDLE);
vkQueueWaitIdle (gdk_vulkan_context_get_queue (context));
if (gdk_vulkan_context_has_feature (context, GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE))
{
PFN_vkReleaseSwapchainImagesEXT vkReleaseSwapchainImagesEXT;
vkReleaseSwapchainImagesEXT = (PFN_vkReleaseSwapchainImagesEXT) vkGetDeviceProcAddr (gdk_vulkan_context_get_device (context), "vkReleaseSwapchainImagesEXT");
vkReleaseSwapchainImagesEXT (gdk_vulkan_context_get_device (context),
&(VkReleaseSwapchainImagesInfoEXT) {
.sType = VK_STRUCTURE_TYPE_RELEASE_SWAPCHAIN_IMAGES_INFO_EXT,
.pNext = NULL,
.swapchain = priv->swapchain,
.imageIndexCount = 1,
.pImageIndices = &priv->draw_index,
});
}
}
GDK_DEBUG (VULKAN, "Recreating the swapchain");
if (gdk_vulkan_context_check_swapchain (context, &error))
continue;
@@ -1474,8 +1424,8 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
skip_features = gdk_parse_debug_var ("GDK_VULKAN_DISABLE",
"GDK_VULKAN_DISABLE can be set to a list of Vulkan features to disable.\n",
gdk_vulkan_feature_keys,
G_N_ELEMENTS (gdk_vulkan_feature_keys));
gsk_vulkan_feature_keys,
G_N_ELEMENTS (gsk_vulkan_feature_keys));
if (skip_features & GDK_VULKAN_FEATURE_YCBCR)
skip_features |= GDK_VULKAN_FEATURE_DMABUF;
@@ -1622,13 +1572,13 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
display->vulkan_features = features;
GDK_DISPLAY_DEBUG (display, VULKAN, "Enabled features (use GDK_VULKAN_DISABLE env var to disable):");
for (i = 0; i < G_N_ELEMENTS (gdk_vulkan_feature_keys); i++)
for (i = 0; i < G_N_ELEMENTS (gsk_vulkan_feature_keys); i++)
{
GDK_DISPLAY_DEBUG (display, VULKAN, " %s: %s",
gdk_vulkan_feature_keys[i].key,
(features & gdk_vulkan_feature_keys[i].value) ? "" :
((skip_features & gdk_vulkan_feature_keys[i].value) ? "disabled via env var" :
(((device_features & gdk_vulkan_feature_keys[i].value) == 0) ? "" :
gsk_vulkan_feature_keys[i].key,
(features & gsk_vulkan_feature_keys[i].value) ? "YES" :
((skip_features & gsk_vulkan_feature_keys[i].value) ? "disabled via env var" :
(((device_features & gsk_vulkan_feature_keys[i].value) == 0) ? "not supported" :
"Hum, what? This should not happen.")));
}
+1 -1
View File
@@ -298,4 +298,4 @@ gdk_save_jpeg (GdkTexture *texture)
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -653,4 +653,4 @@ gdk_save_png (GdkTexture *texture)
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -512,4 +512,4 @@ gdk_load_tiff (GBytes *input_bytes,
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+8
View File
@@ -146,6 +146,14 @@ typedef NSString *CALayerContentsGravity;
inManualResize = NO;
inMove = NO;
/* We need to deliver the event to the proper drag gestures or we
* will leave the window in inconsistent state that requires clicking
* in the window to cancel the gesture.
*
* TODO: Can we improve grab breaking to fix this?
*/
_gdk_macos_display_send_event ([self gdkDisplay], event);
_gdk_macos_display_break_all_grabs (GDK_MACOS_DISPLAY (display), time);
/* Reset gravity */
+1 -1
View File
@@ -391,7 +391,7 @@ _gdk_macos_pasteboard_register_drag_types (NSWindow *window)
/* Default to an url type (think gobject://internal)
* to support internal, GType-based DnD.
*/
if ([ret count] == 0)
if (n_mime_types == 0)
{
GdkContentFormats *formats;
gsize n_gtypes;
+8 -27
View File
@@ -548,12 +548,6 @@ gdk_registry_handle_global (void *data,
&wp_single_pixel_buffer_manager_v1_interface,
MIN (version, 1));
}
else if (strcmp (interface, xdg_system_bell_v1_interface.name) == 0)
{
display_wayland->system_bell =
wl_registry_bind (display_wayland->wl_registry, id,
&xdg_system_bell_v1_interface, 1);
}
g_hash_table_insert (display_wayland->known_globals,
GUINT_TO_POINTER (id), g_strdup (interface));
@@ -774,7 +768,6 @@ gdk_wayland_display_dispose (GObject *object)
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
g_clear_pointer (&display_wayland->dmabuf_formats_info, dmabuf_formats_info_free);
g_clear_pointer (&display_wayland->color, gdk_wayland_color_free);
g_clear_pointer (&display_wayland->system_bell, xdg_system_bell_v1_destroy);
g_clear_pointer (&display_wayland->shm, wl_shm_destroy);
g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy);
@@ -821,32 +814,23 @@ gdk_wayland_display_get_name (GdkDisplay *display)
void
gdk_wayland_display_system_bell (GdkDisplay *display,
GdkSurface *surface)
GdkSurface *window)
{
GdkWaylandDisplay *display_wayland;
struct gtk_surface1 *gtk_surface = NULL;
struct wl_surface *wl_surface = NULL;
struct gtk_surface1 *gtk_surface;
gint64 now_ms;
g_return_if_fail (GDK_IS_DISPLAY (display));
display_wayland = GDK_WAYLAND_DISPLAY (display);
if (!display_wayland->gtk_shell &&
!display_wayland->system_bell)
if (!display_wayland->gtk_shell)
return;
if (surface)
{
if (GDK_IS_WAYLAND_TOPLEVEL (surface))
{
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (surface);
gtk_surface = gdk_wayland_toplevel_get_gtk_surface (toplevel);
}
wl_surface = gdk_wayland_surface_get_wl_surface (surface);
}
if (window && GDK_IS_WAYLAND_TOPLEVEL (window))
gtk_surface = gdk_wayland_toplevel_get_gtk_surface (GDK_WAYLAND_TOPLEVEL (window));
else
gtk_surface = NULL;
now_ms = g_get_monotonic_time () / 1000;
if (now_ms - display_wayland->last_bell_time_ms < MIN_SYSTEM_BELL_DELAY_MS)
@@ -854,10 +838,7 @@ gdk_wayland_display_system_bell (GdkDisplay *display,
display_wayland->last_bell_time_ms = now_ms;
if (display_wayland->system_bell)
xdg_system_bell_v1_ring (display_wayland->system_bell, wl_surface);
else
gtk_shell1_system_bell (display_wayland->gtk_shell, gtk_surface);
gtk_shell1_system_bell (display_wayland->gtk_shell, gtk_surface);
}
static void
-2
View File
@@ -42,7 +42,6 @@
#include <gdk/wayland/presentation-time-client-protocol.h>
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
#include <gdk/wayland/xdg-dialog-v1-client-protocol.h>
#include <gdk/wayland/xdg-system-bell-v1-client-protocol.h>
#include <glib.h>
#include <gdk/gdkkeys.h>
@@ -107,7 +106,6 @@ struct _GdkWaylandDisplay
struct zxdg_shell_v6 *zxdg_shell_v6;
struct xdg_wm_dialog_v1 *xdg_wm_dialog;
struct gtk_shell1 *gtk_shell;
struct xdg_system_bell_v1 *system_bell;
struct wl_data_device_manager *data_device_manager;
struct wl_subcompositor *subcompositor;
struct zwp_pointer_gestures_v1 *pointer_gestures;
+1 -1
View File
@@ -1485,4 +1485,4 @@ _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
}
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -1482,4 +1482,4 @@ gdk_wayland_surface_get_wl_surface (GdkSurface *surface)
}
/* }}}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -2765,4 +2765,4 @@ gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
}
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
-5
View File
@@ -151,11 +151,6 @@ proto_sources = [
'stability': 'private',
'version': 4,
},
{
'name': 'xdg-system-bell',
'stability': 'private',
'version': 1,
},
]
gdk_wayland_gen_headers = []
@@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="xdg_system_bell_v1">
<copyright>
Copyright © 2016, 2023 Red Hat
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="xdg_system_bell_v1" version="1">
<description summary="system bell">
This global interface enables clients to ring the system bell.
Warning! The protocol described in this file is currently in the testing
phase. Backward compatible changes may be added together with the
corresponding interface version bump. Backward incompatible changes can
only be done by creating a new major version of the extension.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the system bell object">
Notify that the object will no longer be used.
</description>
</request>
<request name="ring">
<description summary="ring the system bell">
This requests rings the system bell on behalf of a client. How ringing
the bell is implemented is up to the compositor. It may be an audible
sound, a visual feedback of some kind, or any other thing including
nothing.
The passed surface should correspond to a toplevel like surface role,
or be null, meaning the client doesn't have a particular toplevel it
wants to associate the bell ringing with. See the xdg-shell protocol
extension for a toplevel like surface role.
</description>
<arg name="surface" type="object" interface="wl_surface"
allow-null="true" summary="associated surface"/>
</request>
</interface>
</protocol>
+200
View File
@@ -0,0 +1,200 @@
/* GTK - The GIMP Toolkit
*
* Copyright (C) 2024 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "apisets.h"
#include "procedures.h"
#include "gdkprivate-win32.h"
static struct api_set
api_sets[] = {
# define API_SET(id, name, os_version) \
{name, L"" name, NULL, FALSE, os_version},
API_SETS
# undef API_SET
};
static struct module
modules[] = {
# define MODULE(id, name, folder, flags) \
{L"" name, folder, flags, NULL, FALSE},
MODULES
# undef MODULE
};
static void
load_api_set_internal (struct api_set *api_set)
{
if (ptrIsApiSetImplemented)
if (!ptrIsApiSetImplemented (api_set->name_narrow))
return;
/* Use LOAD_LIBRARY_SEARCH_SYSTEM32 for security (if IsApiSetImplemented
* is not present)
*
* If we can't use IsApiSetImplemented, we should try loading the api set
* directly. However, if the OS is too old and the api set is unknown,
* LoadLibrary will look for a corresponding DLL file in the search paths.
* Here we use LOAD_LIBRARY_SEARCH_SYSTEM32 to restrict search to a safe
* folder. */
const DWORD flags = LOAD_LIBRARY_SEARCH_SYSTEM32;
api_set->module_handle = LoadLibraryEx (api_set->name_wide, NULL, flags);
if (api_set->module_handle == NULL)
{
DWORD code = GetLastError ();
if (code == ERROR_INVALID_PARAMETER)
{
/* LOAD_LIBRARY_SEARCH_SYSTEM32 is supported on Windows Vista/7
* only with update KB2533623 installed. If we can't use that
* flag, it's best to return early and rely on classic modules.
*/
return;
}
else if (code == ERROR_MOD_NOT_FOUND)
{
if (strncmp (api_set->name_narrow, "api", strlen ("api")) == 0 &&
api_set->os_version <= gdk_win32_get_os_version ())
{
g_message ("%s missing\n", api_set->name_narrow);
}
}
else
WIN32_API_FAILED ("LoadLibraryEx");
}
}
static void
load_api_set (struct api_set *api_set)
{
g_assert (api_set->module_handle == NULL);
g_assert (api_set->checked == false);
load_api_set_internal (api_set);
api_set->checked = true;
}
/** gdk_win32_get_api_set:
*/
struct api_set *
gdk_win32_get_api_set (int api_set_id)
{
if (api_set_id >= 0 && api_set_id < API_SET_COUNT)
{
struct api_set *api_set = &api_sets[api_set_id];
if (!api_set->checked)
load_api_set (api_set);
return api_set;
}
return NULL;
}
static void
load_module_internal (struct module *module)
{
if (module->flags & MODULE_FLAG_PACKAGED)
{
if (gdk_win32_check_app_packaged ())
{
g_assert (ptrLoadPackagedLibrary);
module->module_handle = ptrLoadPackagedLibrary (module->name, 0);
if (module->module_handle == NULL)
{
if (GetLastError () != ERROR_MOD_NOT_FOUND)
WIN32_API_FAILED ("LoadPackagedLibrary");
}
return;
}
else
{
/* TODO
*
* https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/framework-packages/use-the-dynamic-dependency-api
* https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time
* https://github.com/microsoft/WindowsAppSDK/issues/89
*/
}
}
switch (module->folder)
{
case FOLDER_APP:
if (can_use_app_folder < 0)
can_use_app_folder = check_can_use_app_folder ();
if (can_use_app_folder)
{
module->module_handle = gdk_win32_load_library_from_app_folder (module->name);
break;
}
G_GNUC_FALLTHROUGH;
case FOLDER_SYSTEM32:
module->module_handle = gdk_win32_load_library_from_system32 (module->name, false, true);
break;
}
}
static void
load_module (struct module *module)
{
g_assert (module->module_handle == NULL);
g_assert (module->checked == false);
load_module_internal (module);
module->checked = true;
}
/** gdk_win32_get_module:
*/
struct module *
gdk_win32_get_module (int module_id)
{
if (module_id >= 0 && module_id < MODULE_COUNT)
{
struct module *module = &modules[module_id];
if (!module->checked)
load_module (module);
return module;
}
return NULL;
}
// TODO:
// Check Dynamic-link library redirection
// Check .exe.manifest file alongside exe
// PSP_USEFUSIONCONTEXT
// Manifest and WinRT activatable classes?
// Check if GetProcAddress works in app container (do we really need a delay-load table for it to work?)
// (can it really access the calling module?)
// Is it possible to generate a synthetic delay-load import table?
+87
View File
@@ -0,0 +1,87 @@
/* GTK - The GIMP Toolkit
*
* Copyright (C) 2024 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "config.h"
#include "gdkmain-win32.h"
#include <windows.h>
#include <stdbool.h>
#undef API_SET
/* Api sets whose name starts with 'api' can be removed from the table once
* support for older OSes is dropped. On the countrary, api sets whose name
* starts with 'ext' must remain in the table because they are not present
* on all Windows editions (Core, Desktop, Hololens, etc.) */
#define API_SETS \
API_SET (API_CORE_APIQUERY_2 , "api-ms-win-core-apiquery-l2-1-0.dll" , OSVersionWindows10) \
API_SET (API_APPMODEL_RUNTIME_1 , "api-ms-win-appmodel-runtime-l1-1-0.dll" , OSVersionWindows8 ) \
API_SET (API_CORE_LIBRARYLOADER_2 , "api-ms-win-core-libraryloader-l2-1-0.dll" , OSVersionWindows8 ) \
#define MODULES \
MODULE (MODULE_KERNEL32 , "kernel32.dll" , FOLDER_SYSTEM32 , 0 ) \
MODULE (MODULE_USER32 , "user32.dll" , FOLDER_SYSTEM32 , 0 ) \
#define API_SET(id, name, os_version) id,
enum ApiSets {
API_SETS
API_SET_COUNT
};
#undef API_SET
#define MODULE(id, name, folder, flags) id,
enum Modules {
MODULES
MODULE_COUNT
};
#undef MODULE
struct api_set {
const char *name_narrow;
const wchar_t *name_wide;
HMODULE module_handle;
bool checked;
OSVersion os_version;
};
struct api_set * gdk_win32_get_api_set (int api_set_id);
enum ModuleFolder {
FOLDER_SYSTEM32,
FOLDER_APP,
};
#define MODULE_FLAG_PACKAGED (1U << 0)
#define MODULE_FLAG_DIRECT (1U << 1)
struct module {
const wchar_t *name;
enum ModuleFolder folder;
unsigned int flags;
HMODULE module_handle;
bool checked;
};
struct module * gdk_win32_get_module (int module_id);
+3 -2
View File
@@ -213,9 +213,10 @@ struct _GdkWin32Display
guint hasWglARBPixelFormat : 1;
guint hasGlWINSwapHint : 1;
struct {
struct wgl_quirks {
guint force_gdi_compatibility : 1;
guint disallow_swap_exchange : 1;
} wgl_quirks;
} *wgl_quirks;
#ifdef HAVE_EGL
guint hasEglKHRCreateContext : 1;
+18
View File
@@ -81,6 +81,23 @@
#include <stdint.h>
#define GDK_MOD2_MASK (1 << 4)
#ifndef XBUTTON1
#define XBUTTON1 1
#define XBUTTON2 2
#endif
#ifndef VK_XBUTTON1
#define VK_XBUTTON1 5
#define VK_XBUTTON2 6
#endif
#ifndef MK_XBUTTON1
#define MK_XBUTTON1 32
#define MK_XBUTTON2 64
#endif
/* Undefined flags: */
#define SWP_NOCLIENTSIZE 0x0800
#define SWP_NOCLIENTMOVE 0x1000
@@ -707,6 +724,7 @@ print_event_state (guint state)
CASE (LOCK);
CASE (CONTROL);
CASE (ALT);
CASE (MOD2);
CASE (BUTTON1);
CASE (BUTTON2);
CASE (BUTTON3);
+32 -16
View File
@@ -367,9 +367,10 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
attribs_add_static_array (&attribs, attribs_base);
attribs_commit (&attribs);
if (display_win32->wgl_quirks->force_gdi_compatibility)
attribs_add (&attribs, WGL_SUPPORT_GDI_ARB, GL_TRUE);
attribs_add (&attribs, WGL_SUPPORT_GDI_ARB, GL_TRUE);
attribs_commit (&attribs);
attribs_add_static_array (&attribs, attribs_ancillary_buffers);
@@ -394,7 +395,7 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
if (find_pixel_format_with_defined_swap_method (hdc, formats, count, &index, &swap_method))
{
if (!display_win32->wgl_quirks.disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
if (!display_win32->wgl_quirks->disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
{
format = formats[index];
goto done;
@@ -405,7 +406,7 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
const int swap_methods[] =
{
(display_win32->wgl_quirks.disallow_swap_exchange) ? 0 : WGL_SWAP_EXCHANGE_ARB,
(display_win32->wgl_quirks->disallow_swap_exchange) ? 0 : WGL_SWAP_EXCHANGE_ARB,
WGL_SWAP_COPY_ARB,
};
for (size_t i = 0; i < G_N_ELEMENTS (swap_methods); i++)
@@ -420,7 +421,7 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
&count));
if (find_pixel_format_with_defined_swap_method (hdc, formats, count, &index, &swap_method))
{
if (!display_win32->wgl_quirks.disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
if (!display_win32->wgl_quirks->disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
{
format = formats[index];
goto done;
@@ -449,16 +450,13 @@ get_distance (PIXELFORMATDESCRIPTOR *pfd,
int is_double_buffered = (pfd->dwFlags & PFD_DOUBLEBUFFER) != 0;
int is_swap_defined = (pfd->dwFlags & swap_flags) != 0;
int is_mono = (pfd->dwFlags & PFD_STEREO) == 0;
int is_transparent = (pfd->dwFlags & PFD_SUPPORT_GDI) != 0;
int ancillary_bits = pfd->cStencilBits + pfd->cDepthBits + pfd->cAccumBits;
int opacity_distance = !is_transparent * 5000;
int quality_distance = !is_double_buffered * 1000;
int performance_distance = !is_swap_defined * 200;
int memory_distance = !is_mono + ancillary_bits;
return opacity_distance +
quality_distance +
return quality_distance +
performance_distance +
memory_distance;
}
@@ -479,9 +477,10 @@ choose_pixel_format_opengl32 (GdkWin32Display *display_win32,
const DWORD skip_flags = PFD_GENERIC_FORMAT |
PFD_GENERIC_ACCELERATED;
const DWORD required_flags = PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL;
PFD_SUPPORT_OPENGL |
(display_win32->wgl_quirks->force_gdi_compatibility ? PFD_SUPPORT_GDI : 0);
const DWORD best_swap_flags = PFD_SWAP_COPY |
(display_win32->wgl_quirks.disallow_swap_exchange ? 0 : PFD_SWAP_EXCHANGE);
(display_win32->wgl_quirks->disallow_swap_exchange ? 0 : PFD_SWAP_EXCHANGE);
struct {
int index;
@@ -620,6 +619,18 @@ create_dummy_gl_window (void)
return hwnd;
}
static bool
check_driver_is_d3d12 (void)
{
const char *vendor = (const char *) glGetString (GL_VENDOR);
const char *renderer = (const char *) glGetString (GL_RENDERER);
return vendor != NULL &&
g_ascii_strncasecmp (vendor, "MICROSOFT", strlen ("MICROSOFT")) == 0 &&
renderer != NULL &&
g_ascii_strncasecmp (renderer, "D3D12", strlen ("D3D12")) == 0;
}
static bool
check_vendor_is_nvidia (void)
{
@@ -640,7 +651,9 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
if (!gdk_gl_backend_can_be_used (GDK_GL_WGL, error))
return NULL;
g_assert (display_win32->wgl_quirks == NULL);
display_win32->wgl_quirks = g_new0 (struct wgl_quirks, 1);
/* acquire and cache dummy Window (HWND & HDC) and
* dummy GL Context, it is used to query functions
* and used for other stuff as well
@@ -681,7 +694,8 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
display_win32->hasGlWINSwapHint =
epoxy_has_gl_extension ("GL_WIN_swap_hint");
display_win32->wgl_quirks.disallow_swap_exchange = check_vendor_is_nvidia ();
display_win32->wgl_quirks->force_gdi_compatibility = check_driver_is_d3d12 ();
display_win32->wgl_quirks->disallow_swap_exchange = check_vendor_is_nvidia ();
context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL,
"display", display,
@@ -700,6 +714,7 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
GDK_NOTE (OPENGL, g_print ("WGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Renderer: %s\n"
" - Quirks / force GDI compatiblity: %s\n"
" - Quirks / disallow swap exchange: %s\n"
" - Checked extensions:\n"
"\t* WGL_ARB_pixel_format: %s\n"
@@ -710,7 +725,8 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
major, minor,
glGetString (GL_VENDOR),
glGetString (GL_RENDERER),
display_win32->wgl_quirks.disallow_swap_exchange ? "enabled" : "disabled",
display_win32->wgl_quirks->force_gdi_compatibility ? "enabled" : "disabled",
display_win32->wgl_quirks->disallow_swap_exchange ? "enabled" : "disabled",
display_win32->hasWglARBPixelFormat ? "yes" : "no",
display_win32->hasWglARBCreateContext ? "yes" : "no",
display_win32->hasWglEXTSwapControl ? "yes" : "no",
@@ -1125,7 +1141,7 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
context_wgl->swap_method = SWAP_METHOD_COPY;
break;
case WGL_SWAP_EXCHANGE_ARB:
if (!display_win32->wgl_quirks.disallow_swap_exchange)
if (!display_win32->wgl_quirks->disallow_swap_exchange)
context_wgl->swap_method = SWAP_METHOD_EXCHANGE;
break;
}
@@ -1141,7 +1157,7 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
if (pfd.dwFlags & PFD_SWAP_COPY)
context_wgl->swap_method = SWAP_METHOD_COPY;
else if ((pfd.dwFlags & PFD_SWAP_EXCHANGE) && !display_win32->wgl_quirks.disallow_swap_exchange)
else if ((pfd.dwFlags & PFD_SWAP_EXCHANGE) && !display_win32->wgl_quirks->disallow_swap_exchange)
context_wgl->swap_method = SWAP_METHOD_EXCHANGE;
else
context_wgl->swap_method = SWAP_METHOD_UNDEFINED;
+366
View File
@@ -38,6 +38,14 @@
#include <windows.h>
#include <wintab.h>
#include <imm.h>
#include <shlwapi.h> /* for DLLVERSIONINFO */
#include "gdkmain-win32.h"
#include "apisets.h"
#include "procedures.h"
#include <stdarg.h>
#include <stdbool.h>
/* Whether GDK initialized COM */
gboolean
@@ -106,6 +114,361 @@ gdk_win32_ensure_ole (void)
return ole_initialized;
}
struct invoke_context
{
void (*callback)(void*);
void *user_data;
va_list setup_funcs;
};
typedef void (*invoke_setup_func_t)(invoke_context_t *);
#define gdk_win32_invoke_finish(context) \
do \
{ \
context->callback (context->user_data); \
} \
while (0)
#define gdk_win32_invoke_continue(context) \
do \
{ \
invoke_setup_func_t setup_func; \
setup_func = va_arg ((context)->setup_funcs, invoke_setup_func_t); \
\
if (setup_func) \
setup_func (context); \
else \
gdk_win32_invoke_finish (context); \
} \
while (0)
/** gdk_win32_invoke_callback:
*
* Invoke a callback with a list of prepare functions setting
* up the necessary context (thread error mode, activation context,
* etc.)
*
* Prepare functions are called recursively, so it's possible to
* use Structured Exception Handling for cleanup even in case of
* exceptions.
*
* Note: diverging control-flow via signals / structured exceptions
* is not supported, but it's good practice to cleanup some things
* on exceptions for the sake of error handling or debugging.
*/
void
gdk_win32_invoke_callback (void (*callback)(void *arg),
void *user_data,
...)
{
invoke_context_t context = {
callback, user_data,
};
va_start (context.setup_funcs, user_data);
gdk_win32_invoke_continue ((&context));
va_end (context.setup_funcs);
}
/** gdk_win32_with_loader_error_mode:
*
* Setup function that sets the error mode to prevent interactive
* mesage boxes from the loader. To be used with gdk_win32_invoke_callback()
*/
void
gdk_win32_with_loader_error_mode (invoke_context_t *context)
{
/* It seems that both SEM_NOOPENFILEERRORBOX, SEM_FAILCRITICALERRORS
* are relevant for DLL loading:
*
* -> https://devblogs.microsoft.com/oldnewthing/20240208-00/?p=109374
* -> https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/111610
*
* Now, it could be that SEM_NOOPENFILEERRORBOX is not needed anymore
* on modern Windows, but let's just be safe */
const DWORD error_mode = SEM_FAILCRITICALERRORS |
SEM_NOOPENFILEERRORBOX;
const DWORD original_error_mode = GetThreadErrorMode ();
SEH_TRY
{
SetThreadErrorMode (original_error_mode | error_mode, NULL);
gdk_win32_invoke_continue (context);
}
SEH_FINALLY
{
SetThreadErrorMode (original_error_mode, NULL);
}
}
static HANDLE
get_activation_context (void)
{
static HANDLE handle_activation_context = NULL;
static GOnce once = G_ONCE_INIT;
if (g_once_init_enter (&handle_activation_context))
{
ACTCTX actctx = {0};
HANDLE handle;
actctx.cbSize = sizeof (actctx);
actctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID |
ACTCTX_FLAG_RESOURCE_NAME_VALID;
actctx.hModule = this_module_handle ();
#ifndef GTK_STATIC_COMPILATION
actctx.lpResourceName = MAKEINTRESOURCE (ISOLATIONAWARE_MANIFEST_RESOURCE_ID);
#else
actctx.lpResourceName = L"GTK_MANIFEST";
#endif
handle = CreateActCtx (&actctx);
if (handle == INVALID_HANDLE_VALUE)
WIN32_API_FAILED ("CreateActCtx");
g_once_init_leave (&handle_activation_context, handle);
}
return handle_activation_context;
}
/** gdk_win32_with_activation_context:
*
* Setup function that activates the GTK's activation context.
* To be used with gdk_win32_invoke_callback().
*/
void
gdk_win32_with_activation_context (invoke_context_t *context)
{
HANDLE handle_activation_context = get_activation_context ();
bool activated = false;
ULONG_PTR cookie = 0;
SEH_TRY
{
if (handle_activation_context != INVALID_HANDLE_VALUE)
{
if (!ActivateActCtx (handle_activation_context, &cookie))
WIN32_API_FAILED ("ActivateActCtx");
else
activated = true;
}
gdk_win32_invoke_continue (context);
}
SEH_FINALLY
{
if (activated)
{
if (!DeactivateActCtx (0, cookie) &&
!SEH_ABNORMAL_TERMINATION ())
{
WIN32_API_FAILED ("DeactivateActCtx");
}
}
}
}
#ifdef ISOLATION_AWARE_ENABLED
# ifndef GTK_STATIC_COMPILATION
# warning "Defining ISOLATION_AWARE_ENABLED is not needed. GTK implements manual activation context handling"
# else
# error "Cannot build with ISOLATION_AWARE_ENABLED. GTK implements manual activation context handling"
# endif
#endif
/* TODO:
*
* Free the activation context on unload (ReleaseActCtx)
* Perhaps call ZombifyActCtx if a debugger is present
*/
/** gdk_win32_check_app_packaged:
*
* Check if the app is running with identity.
*
* Even if the app was installed with package identity (e.g with MSIX),
* example using MSIX), it may still be launched in classic mode;
* that happens, for example, if the user launches the exe from
* File Explorer, or when using CreateProcess(). Package identity
* is applied only when the app is activated by the system.
*/
bool
gdk_win32_check_app_packaged (void)
{
UINT32 wchars_count = 0;
LONG code;
if (!ptrGetCurrentPackageFullName)
return false;
code = ptrGetCurrentPackageFullName (&wchars_count, NULL);
if (code == APPMODEL_ERROR_NO_PACKAGE)
return false;
else if (code == ERROR_SUCCESS || code == ERROR_INSUFFICIENT_BUFFER)
return true;
WIN32_API_FAILED_WITH_CODE ("GetCurrentPackageFullName", code);
return false;
}
/** gdk_win32_check_app_container:
*
* Check if running sandboxed in an app container
*/
bool
gdk_win32_check_app_container (void)
{
HANDLE token_handle = NULL;
DWORD is_app_container = 0;
DWORD size = sizeof (is_app_container);
bool result = false;
/* Since Windows 8: use GetCurrentProcessToken() and remove the call to CloseHandle() */
if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &token_handle))
{
WIN32_API_FAILED ("OpenProcessToken");
return false;
}
if (!GetTokenInformation (token_handle, TokenIsAppContainer, &is_app_container, size, &size))
WIN32_API_FAILED ("GetTokenInformation");
else if (size > 0)
result = !!is_app_container;
CloseHandle (token_handle);
return result;
}
/** gdk_win32_check_high_integrity:
*
* Check if the app is running with high integrity
*
* Code based on:
* https://devblogs.microsoft.com/oldnewthing/20221017-00/?p=107291
* https://github.com/microsoft/WindowsAppSDK/blob/main/dev/Common/Security.IntegrityLevel.h
*/
bool
gdk_win32_check_high_integrity (void)
{
HANDLE token_handle = NULL;
TOKEN_MANDATORY_LABEL integrity_level;
DWORD size = sizeof (integrity_level);
bool result = false;
/* Since Windows 8: use GetCurrentProcessToken() and remove the call to CloseHandle() */
if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &token_handle))
{
WIN32_API_FAILED ("OpenProcessToken");
return false;
}
memset (&integrity_level, 0, sizeof (integrity_level));
if (!GetTokenInformation (token_handle, TokenIntegrityLevel, &integrity_level, size, &size))
WIN32_API_FAILED ("GetTokenInformation");
else if (size > 0 && IsValidSid (integrity_level.Label.Sid))
{
UCHAR subauthority_count = *GetSidSubAuthorityCount (integrity_level.Label.Sid);
if (subauthority_count > 0)
{
DWORD level = *GetSidSubAuthority (integrity_level.Label.Sid, subauthority_count - 1);
result = (level >= SECURITY_MANDATORY_HIGH_RID);
}
}
CloseHandle (token_handle);
return result;
}
/** gdk_win32_check_manually_elevated:
*
* Code based on:
* https://devblogs.microsoft.com/oldnewthing/20241003-00/?p=110336
*/
bool
gdk_win32_check_manually_elevated (void)
{
HANDLE token_handle = NULL;
TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault;
DWORD size = sizeof (elevation_type);
bool result = false;
/* Since Windows 8: use GetCurrentProcessToken() and remove the call to CloseHandle() */
if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &token_handle))
{
WIN32_API_FAILED ("OpenProcessToken");
return false;
}
if (!GetTokenInformation (token_handle, TokenElevationType, &elevation_type, size, &size))
WIN32_API_FAILED ("GetTokenInformation");
else if (size > 0)
result = (elevation_type == TokenElevationTypeFull);
CloseHandle (token_handle);
return result;
}
static int
get_comctl32_version (HMODULE module_handle)
{
DLLGETVERSIONPROC ptrDllGetVersion;
DLLVERSIONINFO info = {0};
HRESULT hr = E_FAIL;
int result = 0;
ptrDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress (module_handle, "DllGetVersion");
if (!ptrDllGetVersion)
return 1;
// TODO: Add support for DLLVERSIONINFO2
// TODO: This won't work in app containers, probably
info.cbSize = sizeof (info);
hr = ptrDllGetVersion (&info);
if (FAILED (hr))
HR_LOG ("DllGetVersion", hr);
else
result = ;
return result;
}
/** gdk_win32_get_comctl32_version:
*
* Get the major version of the Common Controls library. Note that
* common controls may not be present on modern Windows editions
* (Core, Hololens, etc.)
*
* Returns: TODO
*/
int
gdk_win32_get_comctl32_version (void)
{
struct api_set *api_set;
struct module *module;
HMODULE module_handle;
api_set *api_set = gdk_win32_get_api_set (API_SET_EXT_WIN_SHELL_INIT);
if (api_set)
return get_comctl32_version (api_set->module_handle);
module = gdk_win32_get_module (MODULE_COMCTL32);
if (module)
return get_comctl32_version (module->module_handle);
return 0;
}
void
_gdk_win32_api_failed (const char *where,
const char *api)
@@ -242,6 +605,9 @@ _gdk_win32_surface_exstyle_to_string (LONG style)
BIT (ACCEPTFILES);
BIT (APPWINDOW);
BIT (CLIENTEDGE);
#ifndef WS_EX_COMPOSITED
# define WS_EX_COMPOSITED 0x02000000L
#endif
BIT (COMPOSITED);
BIT (CONTEXTHELP);
BIT (CONTROLPARENT);
+42
View File
@@ -0,0 +1,42 @@
#pragma once
#include <stdbool.h>
typedef enum {
OSVersionWindows7,
OSVersionWindows8,
OSVersionWindows8_1,
OSVersionWindows10,
OSVersionWindows11,
} OSVersion;
OSVersion
gdk_win32_get_os_version (void);
void
gdk_win32_invoke_callback (void (*callback)(void *arg),
void *user_data,
...);
struct invoke_context;
typedef struct invoke_context invoke_context_t;
void
gdk_win32_with_loader_error_mode (invoke_context_t *context);
void
gdk_win32_with_activation_context (invoke_context_t *context);
bool
gdk_win32_check_app_packaged (void);
#ifdef _MSC_VER
#define SEH_TRY __try
#define SEH_FINALLY __finally
#define SEH_ABNORMAL_TERMINATION() AbnormalTermination()
#else
#define SEH_TRY
#define SEH_FINALLY
#define SEH_ABNORMAL_TERMINATION() FALSE
#endif
+4
View File
@@ -124,6 +124,10 @@ typedef LONG
typedef LONG
(WINAPI *funcDisplayConfigGetDeviceInfo) (DISPLAYCONFIG_DEVICE_INFO_HEADER* requestPacket);
#ifndef MONITORINFOF_PRIMARY
#define MONITORINFOF_PRIMARY 1
#endif
#define G_GUID_FORMAT "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"
#define g_format_guid(guid) (guid)->Data1, \
(guid)->Data2, \
-1
View File
@@ -288,4 +288,3 @@ this_module (void)
{
return (HMODULE) &__ImageBase;
}
+20
View File
@@ -31,6 +31,9 @@
#include <gdk/gdk.h>
#ifndef STRICT
#define STRICT /* We want strict type checks */
#endif
#include <windows.h>
#include <commctrl.h>
@@ -47,6 +50,23 @@ G_BEGIN_DECLS
#endif /* INSIDE_GDK_WIN32 */
/* These need to be here so gtkstatusicon.c can pick them up if needed. */
#ifndef WM_XBUTTONDOWN
#define WM_XBUTTONDOWN 0x020B
#endif
#ifndef WM_XBUTTONUP
#define WM_XBUTTONUP 0x020C
#endif
#ifndef GET_XBUTTON_WPARAM
#define GET_XBUTTON_WPARAM(w) (HIWORD(w))
#endif
#ifndef XBUTTON1
#define XBUTTON1 1
#endif
#ifndef XBUTTON2
#define XBUTTON2 2
#endif
GDK_DEPRECATED_IN_4_8_FOR(GDK_IS_WIN32_SURFACE)
gboolean gdk_win32_surface_is_win32 (GdkSurface *surface);
GDK_DEPRECATED_IN_4_8_FOR(gdk_win32_surface_get_handle)
+4
View File
@@ -13,6 +13,7 @@ gdk_win32_public_sources = files([
])
gdk_win32_sources = gdk_win32_public_sources + files([
'apisets.c',
'gdkcairocontext-win32.c',
'gdkclipboard-win32.c',
'gdkclipdrop-win32.c',
@@ -34,6 +35,7 @@ gdk_win32_sources = gdk_win32_public_sources + files([
'gdkwin32cursor.h',
'gdkwin32display.h',
'gdkwin32keys.h',
'procedures.c',
])
gdk_win32_public_headers = files([
@@ -67,6 +69,8 @@ libgdk_win32 = static_library('gdk-win32',
'-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gdk"',
'-DINSIDE_GDK_WIN32',
'-D_WIN32_WINNT=0x0601',
'-DWINVER=0x0601',
],
dependencies: [ gdk_deps, gdk_win32_deps ],
)
+56
View File
@@ -0,0 +1,56 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2024 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "procedures.h"
#include <windows.h>
#include <apiquery2.h>
#include <appmodel.h>
#include <stdint.h>
/* This file is used to generate entries in the delayload import table for
* all the optional procedures used by GTK. That's needed for appcontainer
* environments, where procedures can be obtained dynamically only when
* present in the delayload import table (even though we don't use delay
* loading)
*/
/* This file must be compiled with OneCoreUAP_apiset.lib
* and WINAPI_PARTITION_DESKTOP
*/
# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# error "Invalid WINAPI_FAMILY_PARTITION, WINAPI_PARTITION_DESKTOP is required"
# endif
static void
api_entries_dummy_ctor (void)
{
uintptr_t dummy_value =
# define PROCEDURE(name, api_set_id, module_id, os_version) \
((uintptr_t) (void*) name) +
PROCEDURES
# endif
0;
EncodePointer ((void*)dummy_value);
}
G_DEFINE_CONSTRUCTOR (api_entries_dummy_ctor)
+147
View File
@@ -0,0 +1,147 @@
/* GTK - The GIMP Toolkit
*
* Copyright (C) 2024 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "apisets.h"
#include "procedures.h"
#include "gdkmain-win32.h"
#include "gdkprivate-win32.h"
# define PROCEDURE(name, api_set_id, module_id, os_version) \
name##_t ptr##name;
PROCEDURES
# undef PROCEDURE
struct procedure {
void **pp;
char *name;
int api_set_id;
int module_id;
OSVersion os_version;
};
static struct procedure
procedures[] = {
# define PROCEDURE(name, api_set_id, module_id, os_version) \
{(void**)&ptr##name, #name, api_set_id, module_id, os_version},
PROCEDURES
# undef PROCEDURE
};
static void *
load_common (HMODULE module_handle,
const char *type,
const wchar_t *m_name,
const char *name,
OSVersion os_version)
{
void *proc = GetProcAddress (module_handle, name);
if (proc == NULL)
{
DWORD code = GetLastError ();
if (code != ERROR_PROC_NOT_FOUND)
WIN32_API_FAILED ("GetProcAddress");
else if (gdk_win32_get_os_version () >= os_version)
g_warning ("Could not find procedure %s in %s %S",
name, type, m_name);
}
return proc;
}
static bool
load_by_api_set (struct procedure *procedure)
{
struct api_set *api_set = gdk_win32_get_api_set (procedure->api_set_id);
if (api_set->module_handle)
*procedure->pp = load_common (api_set->module_handle,
"api set",
api_set->name_wide,
procedure->name,
procedure->os_version);
return *procedure->pp != NULL;
}
static bool
load_by_module (struct procedure *procedure)
{
struct module *module = gdk_win32_get_module (procedure->module_id);
if (module->module_handle)
*procedure->pp = load_common (module->module_handle,
"module",
module->name,
procedure->name,
procedure->os_version);
return *procedure->pp != NULL;
}
#if 0
static void
load_by_package (struct procedure *procedure)
{
struct package *package = gdk_win32_get_package (procedure->package_id);
if (package->module_handle)
*procedure->pp = load_common (package->module_handle,
"package",
package->name,
procedure->name,
procedure->os_version);
}
#endif
static void
procedures_load_internal (void *)
{
for (size_t i = 0; i < G_N_ELEMENTS (procedures); i++)
{
struct procedure *procedure = &procedures[i];
g_assert (*procedure->pp == NULL);
load_by_api_set (procedure) ||
load_by_module (procedure) ||
load_by_package (procedure);
}
}
void
gdk_win32_procedures_load (void)
{
gdk_win32_invoke_callback (procedures_load_internal,
NULL,
gdk_win32_with_loader_error_mode,
gdk_win32_with_activation_context,
NULL);
}
void
gdk_win32_procedures_unload (void)
{
for (size_t i = 0; i < G_N_ELEMENTS (procedures); i++)
*procedures[i].pp = NULL;
}
+46
View File
@@ -0,0 +1,46 @@
/* GTK - The GIMP Toolkit
*
* Copyright (C) 2024 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <windows.h>
typedef BOOL
(APIENTRY *IsApiSetImplemented_t) (PCSTR Contract);
typedef LONG
(WINAPI *GetCurrentPackageFullName_t) (UINT32 packageFullNameLength,
PWSTR packageFullName);
typedef HMODULE
(WINAPI *LoadPackagedLibrary_t) (LPCWSTR lpwLibFileName,
DWORD Reserved);
#define PROCEDURES \
PROCEDURE (IsApiSetImplemented , API_CORE_APIQUERY_2 , -1 , -1 ) \
PROCEDURE (GetCurrentPackageFullName , API_APPMODEL_RUNTIME_1 , MODULE_KERNEL32 , OSVersionWindows8) \
PROCEDURE (LoadPackagedLibrary , API_CORE_LIBRARYLOADER_2 , MODULE_KERNEL32 , OSVersionWindows8) \
#define PROCEDURE(name, api_set_id, module_id, os_version) \
extern name##_t ptr##name;
PROCEDURES
#undef PROCEDURE
void gdk_win32_procedures_load (void);
void gdk_win32_procedures_unload (void);
-2
View File
@@ -1432,8 +1432,6 @@ gdk_x11_display_open (const char *display_name)
gboolean rgba;
gboolean composited;
gdk_ensure_initialized ();
XInitThreads ();
xdisplay = XOpenDisplay (display_name);
+1 -1
View File
@@ -1177,4 +1177,4 @@ gsk_gpu_cache_new (GskGpuDevice *device)
}
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+3 -3
View File
@@ -27,12 +27,12 @@ gsk_gpu_color_states_create (GdkColorState *output_color_state,
GdkColorState *alt_color_state,
gboolean alt_is_premultiplied)
{
if (gdk_color_state_equal (output_color_state, alt_color_state))
return gsk_gpu_color_states_create_equal (output_is_premultiplied, alt_is_premultiplied);
g_assert (GDK_IS_DEFAULT_COLOR_STATE (output_color_state));
g_assert (GDK_IS_DEFAULT_COLOR_STATE (alt_color_state));
if (gdk_color_state_equal (output_color_state, alt_color_state))
return gsk_gpu_color_states_create_equal (output_is_premultiplied, alt_is_premultiplied);
return (GDK_DEFAULT_COLOR_STATE_ID (output_color_state) << COLOR_SPACE_OUTPUT_SHIFT) |
(output_is_premultiplied ? COLOR_SPACE_OUTPUT_PREMULTIPLIED : 0) |
(GDK_DEFAULT_COLOR_STATE_ID (alt_color_state) << COLOR_SPACE_ALT_SHIFT) |
+13 -25
View File
@@ -1,7 +1,6 @@
#include "config.h"
#include "gskgpuconicgradientopprivate.h"
#include "gskgpulineargradientopprivate.h"
#include "gskgpuframeprivate.h"
#include "gskgpuprintprivate.h"
@@ -53,28 +52,24 @@ static const GskGpuShaderOpClass GSK_GPU_CONIC_GRADIENT_OP_CLASS = {
void
gsk_gpu_conic_gradient_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GdkColorState *ccs,
float opacity,
const graphene_point_t *offset,
GdkColorState *ics,
GskHueInterpolation hue_interp,
GskGpuColorStates color_states,
const graphene_rect_t *rect,
const graphene_point_t *center,
float angle,
const GskColorStop2 *stops,
const graphene_point_t *offset,
const GskColorStop *stops,
gsize n_stops)
{
GskGpuConicgradientInstance *instance;
GdkColorState *color_state = gsk_gpu_color_states_get_alt (color_states);
g_assert (n_stops > 1);
g_assert (n_stops <= 7);
g_assert (gsk_gpu_color_states_is_alt_premultiplied (color_states));
/* Note: we pass TRUE for alt-premultiplied because the
* vertex shader applies the alpha to the colors.
*/
gsk_gpu_shader_op_alloc (frame,
&GSK_GPU_CONIC_GRADIENT_OP_CLASS,
gsk_gpu_color_states_create (ccs, TRUE, ics, TRUE),
color_states,
(gsk_gpu_frame_should_optimize (frame, GSK_GPU_OPTIMIZE_GRADIENTS) ? VARIATION_SUPERSAMPLING : 0),
clip,
NULL,
@@ -84,25 +79,18 @@ gsk_gpu_conic_gradient_op (GskGpuFrame *frame,
gsk_gpu_rect_to_float (rect, offset, instance->rect);
gsk_gpu_point_to_float (center, offset, instance->center);
instance->angle = angle;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 6)].color, ics, opacity, instance->color6);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 6)].color, instance->color6);
instance->offsets1[2] = stops[MIN (n_stops - 1, 6)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 5)].color, ics, opacity, instance->color5);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 5)].color, instance->color5);
instance->offsets1[1] = stops[MIN (n_stops - 1, 5)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 4)].color, ics, opacity, instance->color4);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 4)].color, instance->color4);
instance->offsets1[0] = stops[MIN (n_stops - 1, 4)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 3)].color, ics, opacity, instance->color3);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 3)].color, instance->color3);
instance->offsets0[3] = stops[MIN (n_stops - 1, 3)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 2)].color, ics, opacity, instance->color2);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 2)].color, instance->color2);
instance->offsets0[2] = stops[MIN (n_stops - 1, 2)].offset;
gsk_gpu_color_to_float (&stops[1].color, ics, opacity, instance->color1);
gdk_color_state_from_rgba (color_state, &stops[1].color, instance->color1);
instance->offsets0[1] = stops[1].offset;
gsk_gpu_color_to_float (&stops[0].color, ics, opacity, instance->color0);
gdk_color_state_from_rgba (color_state, &stops[0].color, instance->color0);
instance->offsets0[0] = stops[0].offset;
gsk_adjust_hue (ics, hue_interp, instance->color0, instance->color1);
gsk_adjust_hue (ics, hue_interp, instance->color1, instance->color2);
gsk_adjust_hue (ics, hue_interp, instance->color2, instance->color3);
gsk_adjust_hue (ics, hue_interp, instance->color3, instance->color4);
gsk_adjust_hue (ics, hue_interp, instance->color4, instance->color5);
gsk_adjust_hue (ics, hue_interp, instance->color5, instance->color6);
}
+4 -7
View File
@@ -2,7 +2,7 @@
#include "gskgpushaderopprivate.h"
#include "gskrendernodeprivate.h"
#include "gskrendernode.h"
#include <graphene.h>
@@ -10,15 +10,12 @@ G_BEGIN_DECLS
void gsk_gpu_conic_gradient_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GdkColorState *ccs,
float opacity,
const graphene_point_t *offset,
GdkColorState *ics,
GskHueInterpolation hue_interp,
GskGpuColorStates color_states,
const graphene_rect_t *rect,
const graphene_point_t *center,
float angle,
const GskColorStop2 *stops,
const graphene_point_t *offset,
const GskColorStop *stops,
gsize n_stops);
+1 -1
View File
@@ -310,4 +310,4 @@ gsk_gpu_device_make_current (GskGpuDevice *self)
}
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+13 -96
View File
@@ -52,104 +52,28 @@ static const GskGpuShaderOpClass GSK_GPU_LINEAR_GRADIENT_OP_CLASS = {
gsk_gpu_lineargradient_setup_vao
};
void
gsk_adjust_hue (GdkColorState *ics,
GskHueInterpolation interp,
const float color1[4],
float color2[4])
{
float h1, h2;
float d;
if (!gdk_color_state_equal (ics, GDK_COLOR_STATE_OKLCH))
return;
h1 = color1[2];
h2 = color2[2];
d = h2 - h1;
while (d > 360)
{
h2 -= 360;
d = h2 - h1;
}
while (d < -360)
{
h2 += 360;
d = h2 - h1;
}
g_assert (fabsf (d) <= 360);
switch (interp)
{
case GSK_HUE_INTERPOLATION_SHORTER:
{
if (d > 180)
h2 -= 360;
else if (d < -180)
h2 += 360;
}
g_assert (fabsf (h2 - h1) <= 180);
break;
case GSK_HUE_INTERPOLATION_LONGER:
{
if (0 < d && d < 180)
h2 -= 360;
else if (-180 < d && d <= 0)
h2 += 360;
g_assert (fabsf (h2 - h1) >= 180);
}
break;
case GSK_HUE_INTERPOLATION_INCREASING:
if (h2 < h1)
h2 += 360;
d = h2 - h1;
g_assert (h1 <= h2);
break;
case GSK_HUE_INTERPOLATION_DECREASING:
if (h1 < h2)
h2 -= 360;
d = h2 - h1;
g_assert (h1 >= h2);
break;
default:
g_assert_not_reached ();
}
color2[2] = h2;
}
void
gsk_gpu_linear_gradient_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GdkColorState *ccs,
float opacity,
const graphene_point_t *offset,
GdkColorState *ics,
GskHueInterpolation hue_interp,
GskGpuColorStates color_states,
gboolean repeating,
const graphene_rect_t *rect,
const graphene_point_t *start,
const graphene_point_t *end,
const GskColorStop2 *stops,
const graphene_point_t *offset,
const GskColorStop *stops,
gsize n_stops)
{
GskGpuLineargradientInstance *instance;
GdkColorState *color_state = gsk_gpu_color_states_get_alt (color_states);
g_assert (n_stops > 1);
g_assert (n_stops <= 7);
g_assert (gsk_gpu_color_states_is_alt_premultiplied (color_states));
/* Note: we pass TRUE for alt-premultiplied because the
* vertex shader applies the alpha to the colors.
*/
gsk_gpu_shader_op_alloc (frame,
&GSK_GPU_LINEAR_GRADIENT_OP_CLASS,
gsk_gpu_color_states_create (ccs, TRUE, ics, TRUE),
color_states,
(repeating ? VARIATION_REPEATING : 0) |
(gsk_gpu_frame_should_optimize (frame, GSK_GPU_OPTIMIZE_GRADIENTS) ? VARIATION_SUPERSAMPLING : 0),
clip,
@@ -160,25 +84,18 @@ gsk_gpu_linear_gradient_op (GskGpuFrame *frame,
gsk_gpu_rect_to_float (rect, offset, instance->rect);
gsk_gpu_point_to_float (start, offset, instance->startend);
gsk_gpu_point_to_float (end, offset, &instance->startend[2]);
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 6)].color, ics, opacity, instance->color6);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 6)].color, instance->color6);
instance->offsets1[2] = stops[MIN (n_stops - 1, 6)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 5)].color, ics, opacity, instance->color5);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 5)].color, instance->color5);
instance->offsets1[1] = stops[MIN (n_stops - 1, 5)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 4)].color, ics, opacity, instance->color4);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 4)].color, instance->color4);
instance->offsets1[0] = stops[MIN (n_stops - 1, 4)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 3)].color, ics, opacity, instance->color3);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 3)].color, instance->color3);
instance->offsets0[3] = stops[MIN (n_stops - 1, 3)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 2)].color, ics, opacity, instance->color2);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 2)].color, instance->color2);
instance->offsets0[2] = stops[MIN (n_stops - 1, 2)].offset;
gsk_gpu_color_to_float (&stops[1].color, ics, opacity, instance->color1);
gdk_color_state_from_rgba (color_state, &stops[1].color, instance->color1);
instance->offsets0[1] = stops[1].offset;
gsk_gpu_color_to_float (&stops[0].color, ics, opacity, instance->color0);
gdk_color_state_from_rgba (color_state, &stops[0].color, instance->color0);
instance->offsets0[0] = stops[0].offset;
gsk_adjust_hue (ics, hue_interp, instance->color0, instance->color1);
gsk_adjust_hue (ics, hue_interp, instance->color1, instance->color2);
gsk_adjust_hue (ics, hue_interp, instance->color2, instance->color3);
gsk_adjust_hue (ics, hue_interp, instance->color3, instance->color4);
gsk_adjust_hue (ics, hue_interp, instance->color4, instance->color5);
gsk_adjust_hue (ics, hue_interp, instance->color5, instance->color6);
}
+4 -12
View File
@@ -2,7 +2,7 @@
#include "gskgpushaderopprivate.h"
#include "gskrendernodeprivate.h"
#include "gskrendernode.h"
#include <graphene.h>
@@ -10,23 +10,15 @@ G_BEGIN_DECLS
void gsk_gpu_linear_gradient_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GdkColorState *ccs,
float opacity,
const graphene_point_t *offset,
GdkColorState *ics,
GskHueInterpolation hue_interp,
GskGpuColorStates color_states,
gboolean repeating,
const graphene_rect_t *rect,
const graphene_point_t *start,
const graphene_point_t *end,
const GskColorStop2 *stops,
const graphene_point_t *offset,
const GskColorStop *stops,
gsize n_stops);
void gsk_adjust_hue (GdkColorState *ics,
GskHueInterpolation interp,
const float color1[4],
float color2[4]);
G_END_DECLS
+45 -81
View File
@@ -2464,34 +2464,37 @@ gsk_gpu_node_processor_add_outset_shadow_node (GskGpuNodeProcessor *self,
}
typedef void (* GradientOpFunc) (GskGpuNodeProcessor *self,
GdkColorState *target,
GskRenderNode *node,
const GskColorStop2 *stops,
const GskColorStop *stops,
gsize n_stops);
static void
gsk_gpu_node_processor_add_gradient_node (GskGpuNodeProcessor *self,
GskRenderNode *node,
GdkColorState *ics,
const GskColorStop2 *stops,
const GskColorStop *stops,
gsize n_stops,
GradientOpFunc func)
{
GskColorStop2 real_stops[7];
GskColorStop real_stops[7];
GskGpuNodeProcessor other;
graphene_rect_t bounds;
gsize i, j;
GskGpuImage *image;
GdkColorState *target;
if (GDK_IS_DEFAULT_COLOR_STATE (ics))
target = self->ccs;
else
target = ics;
if (n_stops < 8 && GDK_IS_DEFAULT_COLOR_STATE (ics))
if (n_stops < 8)
{
func (self, target, node, stops, n_stops);
if (self->opacity < 1.0)
{
for (i = 0; i < n_stops; i++)
{
real_stops[i].offset = stops[i].offset;
real_stops[i].color = GDK_RGBA_INIT_ALPHA (&stops[i].color, self->opacity);
}
stops = real_stops;
}
func (self, node, stops, n_stops);
return;
}
@@ -2510,102 +2513,73 @@ gsk_gpu_node_processor_add_gradient_node (GskGpuNodeProcessor *self,
other.blend = GSK_GPU_BLEND_ADD;
other.pending_globals |= GSK_GPU_GLOBAL_BLEND;
gsk_gpu_node_processor_sync_globals (&other, 0);
for (i = 0; i < n_stops; /* happens inside the loop */)
{
if (i == 0)
{
real_stops[0].offset = stops[i].offset;
gdk_color_init_copy (&real_stops[i].color, &stops[i].color);
real_stops[0].color = GDK_RGBA_INIT_ALPHA (&stops[i].color, self->opacity);
i++;
}
else
{
real_stops[0].offset = stops[i-1].offset;
gdk_color_init_copy (&real_stops[0].color, &stops[i - 1].color);
real_stops[0].color.alpha *= 0;
real_stops[0].color = GDK_RGBA_INIT_ALPHA (&stops[i-1].color, 0);
}
for (j = 1; j < 6 && i < n_stops; j++)
{
real_stops[j].offset = stops[i].offset;
gdk_color_init_copy (&real_stops[j].color, &stops[i].color);
real_stops[j].color = GDK_RGBA_INIT_ALPHA (&stops[i].color, self->opacity);
i++;
}
if (i == n_stops - 1)
{
g_assert (j == 6);
real_stops[j].offset = stops[i].offset;
gdk_color_init_copy (&real_stops[j].color, &stops[i].color);
real_stops[j].color = GDK_RGBA_INIT_ALPHA (&stops[i].color, self->opacity);
j++;
i++;
}
else if (i < n_stops)
{
real_stops[j].offset = stops[i].offset;
gdk_color_init_copy (&real_stops[j].color, &stops[i].color);
real_stops[j].color.alpha *= 0;
real_stops[j].color = GDK_RGBA_INIT_ALPHA (&stops[i].color, 0);
j++;
}
func (&other, target, node, real_stops, j);
func (&other, node, real_stops, j);
}
gsk_gpu_node_processor_finish_draw (&other, image);
if (GDK_IS_DEFAULT_COLOR_STATE (ics))
{
gsk_gpu_texture_op (self->frame,
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &bounds),
&self->offset,
&(GskGpuShaderImage) {
image,
GSK_GPU_SAMPLER_DEFAULT,
&node->bounds,
&bounds
});
}
else
{
const GdkCicp *cicp = gdk_color_state_get_cicp (ics);
g_assert (cicp != NULL);
gsk_gpu_convert_from_cicp_op (self->frame,
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &bounds),
cicp,
gsk_gpu_color_states_create_cicp (self->ccs, TRUE, TRUE),
1,
TRUE,
&self->offset,
&(GskGpuShaderImage) {
image,
GSK_GPU_SAMPLER_DEFAULT,
&node->bounds,
&bounds
});
}
gsk_gpu_texture_op (self->frame,
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &bounds),
&self->offset,
&(GskGpuShaderImage) {
image,
GSK_GPU_SAMPLER_DEFAULT,
&node->bounds,
&bounds
});
g_object_unref (image);
}
static void
gsk_gpu_node_processor_linear_gradient_op (GskGpuNodeProcessor *self,
GdkColorState *target,
GskRenderNode *node,
const GskColorStop2 *stops,
const GskColorStop *stops,
gsize n_stops)
{
gsk_gpu_linear_gradient_op (self->frame,
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
target,
self->opacity,
&self->offset,
gsk_linear_gradient_node_get_interpolation_color_state (node),
gsk_linear_gradient_node_get_hue_interpolation (node),
gsk_gpu_node_processor_color_states_explicit (self, GDK_COLOR_STATE_SRGB, TRUE),
GSK_RENDER_NODE_TYPE (node) == GSK_REPEATING_LINEAR_GRADIENT_NODE,
&node->bounds,
gsk_linear_gradient_node_get_start (node),
gsk_linear_gradient_node_get_end (node),
&self->offset,
stops,
n_stops);
}
@@ -2616,26 +2590,20 @@ gsk_gpu_node_processor_add_linear_gradient_node (GskGpuNodeProcessor *self,
{
gsk_gpu_node_processor_add_gradient_node (self,
node,
gsk_linear_gradient_node_get_interpolation_color_state (node),
gsk_linear_gradient_node_get_color_stops2 (node),
gsk_linear_gradient_node_get_color_stops (node, NULL),
gsk_linear_gradient_node_get_n_color_stops (node),
gsk_gpu_node_processor_linear_gradient_op);
}
static void
gsk_gpu_node_processor_radial_gradient_op (GskGpuNodeProcessor *self,
GdkColorState *target,
GskRenderNode *node,
const GskColorStop2 *stops,
const GskColorStop *stops,
gsize n_stops)
{
gsk_gpu_radial_gradient_op (self->frame,
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
target,
self->opacity,
&self->offset,
gsk_radial_gradient_node_get_interpolation_color_state (node),
gsk_radial_gradient_node_get_hue_interpolation (node),
gsk_gpu_node_processor_color_states_explicit (self, GDK_COLOR_STATE_SRGB, TRUE),
GSK_RENDER_NODE_TYPE (node) == GSK_REPEATING_RADIAL_GRADIENT_NODE,
&node->bounds,
gsk_radial_gradient_node_get_center (node),
@@ -2645,6 +2613,7 @@ gsk_gpu_node_processor_radial_gradient_op (GskGpuNodeProcessor *self,
),
gsk_radial_gradient_node_get_start (node),
gsk_radial_gradient_node_get_end (node),
&self->offset,
stops,
n_stops);
}
@@ -2655,29 +2624,24 @@ gsk_gpu_node_processor_add_radial_gradient_node (GskGpuNodeProcessor *self,
{
gsk_gpu_node_processor_add_gradient_node (self,
node,
gsk_radial_gradient_node_get_interpolation_color_state (node),
gsk_radial_gradient_node_get_color_stops2 (node),
gsk_radial_gradient_node_get_color_stops (node, NULL),
gsk_radial_gradient_node_get_n_color_stops (node),
gsk_gpu_node_processor_radial_gradient_op);
}
static void
gsk_gpu_node_processor_conic_gradient_op (GskGpuNodeProcessor *self,
GdkColorState *target,
GskRenderNode *node,
const GskColorStop2 *stops,
const GskColorStop *stops,
gsize n_stops)
{
gsk_gpu_conic_gradient_op (self->frame,
gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
target,
self->opacity,
&self->offset,
gsk_conic_gradient_node_get_interpolation_color_state (node),
gsk_conic_gradient_node_get_hue_interpolation (node),
gsk_gpu_node_processor_color_states_explicit (self, GDK_COLOR_STATE_SRGB, TRUE),
&node->bounds,
gsk_conic_gradient_node_get_center (node),
gsk_conic_gradient_node_get_angle (node),
&self->offset,
stops,
n_stops);
}
@@ -2688,8 +2652,7 @@ gsk_gpu_node_processor_add_conic_gradient_node (GskGpuNodeProcessor *self,
{
gsk_gpu_node_processor_add_gradient_node (self,
node,
gsk_conic_gradient_node_get_interpolation_color_state (node),
gsk_conic_gradient_node_get_color_stops2 (node),
gsk_conic_gradient_node_get_color_stops (node, NULL),
gsk_conic_gradient_node_get_n_color_stops (node),
gsk_gpu_node_processor_conic_gradient_op);
}
@@ -4535,3 +4498,4 @@ gsk_gpu_node_processor_convert_image (GskGpuFrame *frame,
return converted;
}
+13 -25
View File
@@ -1,7 +1,6 @@
#include "config.h"
#include "gskgpuradialgradientopprivate.h"
#include "gskgpulineargradientopprivate.h"
#include "gskgpuframeprivate.h"
#include "gskgpuprintprivate.h"
@@ -56,31 +55,27 @@ static const GskGpuShaderOpClass GSK_GPU_RADIAL_GRADIENT_OP_CLASS = {
void
gsk_gpu_radial_gradient_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GdkColorState *ccs,
float opacity,
const graphene_point_t *offset,
GdkColorState *ics,
GskHueInterpolation hue_interp,
GskGpuColorStates color_states,
gboolean repeating,
const graphene_rect_t *rect,
const graphene_point_t *center,
const graphene_point_t *radius,
float start,
float end,
const GskColorStop2 *stops,
const graphene_point_t *offset,
const GskColorStop *stops,
gsize n_stops)
{
GskGpuRadialgradientInstance *instance;
GdkColorState *color_state = gsk_gpu_color_states_get_alt (color_states);
g_assert (n_stops > 1);
g_assert (n_stops <= 7);
g_assert (gsk_gpu_color_states_is_alt_premultiplied (color_states));
/* Note: we pass TRUE for alt-premultiplied because the
* vertex shader applies the alpha to the colors.
*/
gsk_gpu_shader_op_alloc (frame,
&GSK_GPU_RADIAL_GRADIENT_OP_CLASS,
gsk_gpu_color_states_create (ccs, TRUE, ics, TRUE),
color_states,
(repeating ? VARIATION_REPEATING : 0) |
(gsk_gpu_frame_should_optimize (frame, GSK_GPU_OPTIMIZE_GRADIENTS) ? VARIATION_SUPERSAMPLING : 0),
clip,
@@ -93,25 +88,18 @@ gsk_gpu_radial_gradient_op (GskGpuFrame *frame,
gsk_gpu_point_to_float (radius, graphene_point_zero(), &instance->center_radius[2]);
instance->startend[0] = start;
instance->startend[1] = end;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 6)].color, ics, opacity, instance->color6);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 6)].color, instance->color6);
instance->offsets1[2] = stops[MIN (n_stops - 1, 6)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 5)].color, ics, opacity, instance->color5);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 5)].color, instance->color5);
instance->offsets1[1] = stops[MIN (n_stops - 1, 5)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 4)].color, ics, opacity, instance->color4);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 4)].color, instance->color4);
instance->offsets1[0] = stops[MIN (n_stops - 1, 4)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 3)].color, ics, opacity, instance->color3);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 3)].color, instance->color3);
instance->offsets0[3] = stops[MIN (n_stops - 1, 3)].offset;
gsk_gpu_color_to_float (&stops[MIN (n_stops - 1, 2)].color, ics, opacity, instance->color2);
gdk_color_state_from_rgba (color_state, &stops[MIN (n_stops - 1, 2)].color, instance->color2);
instance->offsets0[2] = stops[MIN (n_stops - 1, 2)].offset;
gsk_gpu_color_to_float (&stops[1].color, ics, opacity, instance->color1);
gdk_color_state_from_rgba (color_state, &stops[1].color, instance->color1);
instance->offsets0[1] = stops[1].offset;
gsk_gpu_color_to_float (&stops[0].color, ics, opacity, instance->color0);
gdk_color_state_from_rgba (color_state, &stops[0].color, instance->color0);
instance->offsets0[0] = stops[0].offset;
gsk_adjust_hue (ics, hue_interp, instance->color0, instance->color1);
gsk_adjust_hue (ics, hue_interp, instance->color1, instance->color2);
gsk_adjust_hue (ics, hue_interp, instance->color2, instance->color3);
gsk_adjust_hue (ics, hue_interp, instance->color3, instance->color4);
gsk_adjust_hue (ics, hue_interp, instance->color4, instance->color5);
gsk_adjust_hue (ics, hue_interp, instance->color5, instance->color6);
}
+4 -7
View File
@@ -2,7 +2,7 @@
#include "gskgpushaderopprivate.h"
#include "gskrendernodeprivate.h"
#include "gskrendernode.h"
#include <graphene.h>
@@ -10,18 +10,15 @@ G_BEGIN_DECLS
void gsk_gpu_radial_gradient_op (GskGpuFrame *frame,
GskGpuShaderClip clip,
GdkColorState *ccs,
float opacity,
const graphene_point_t *offset,
GdkColorState *ics,
GskHueInterpolation hue_interp,
GskGpuColorStates color_states,
gboolean repeating,
const graphene_rect_t *rect,
const graphene_point_t *center,
const graphene_point_t *radius,
float start,
float end,
const GskColorStop2 *stops,
const graphene_point_t *offset,
const GskColorStop *stops,
gsize n_stops);
+6 -129
View File
@@ -111,54 +111,6 @@ const mat3 rec2020_from_srgb = mat3(
0.043303, 0.011360, 0.895380
);
const mat3 oklab_to_lms = mat3(
1.0, 1.0, 1.0,
0.3963377774, -0.1055613458, -0.0894841775,
0.2158037573, -0.0638541728, -1.2914855480
);
const mat3 lms_to_srgb = mat3(
4.0767416621, -1.2684380046, -0.0041960863,
-3.3077115913, 2.6097574011, -0.7034186147,
0.2309699292, -0.3413193965, 1.7076147010
);
const mat3 srgb_to_lms = mat3(
0.4122214708, 0.2119034982, 0.0883024619,
0.5363325363, 0.6806995451, 0.2817188376,
0.0514459929, 0.1073969566, 0.6299787005
);
const mat3 lms_to_oklab = mat3(
0.2104542553, 1.9779984951, 0.0259040371,
0.7936177850, -2.4285922050, 0.7827717662,
-0.0040720468, 0.4505937099, -0.8086757660
);
vec3
oklab_to_srgb_linear (vec3 color)
{
vec3 lms = oklab_to_lms * color;
lms = vec3 (pow (lms.r, 3.0),
pow (lms.g, 3.0),
pow (lms.b, 3.0));
return lms_to_srgb * lms;
}
vec3
srgb_linear_to_oklab (vec3 color)
{
vec3 lms = srgb_to_lms * color;
lms = vec3 (pow (lms.r, 1.0/3.0),
pow (lms.g, 1.0/3.0),
pow (lms.b, 1.0/3.0));
return lms_to_oklab * lms;
}
vec3
apply_eotf (vec3 color,
uint cs)
@@ -179,9 +131,6 @@ apply_eotf (vec3 color,
case GDK_COLOR_STATE_ID_REC2100_LINEAR:
return color;
case GDK_COLOR_STATE_ID_OKLAB:
return oklab_to_srgb_linear (color);
default:
return vec3(1.0, 0.0, 0.8);
}
@@ -207,9 +156,6 @@ apply_oetf (vec3 color,
case GDK_COLOR_STATE_ID_REC2100_LINEAR:
return color;
case GDK_COLOR_STATE_ID_OKLAB:
return srgb_linear_to_oklab (color);
default:
return vec3(0.0, 1.0, 0.8);
}
@@ -237,71 +183,10 @@ linear_color_space (uint cs)
case GDK_COLOR_STATE_ID_SRGB_LINEAR: return GDK_COLOR_STATE_ID_SRGB_LINEAR;
case GDK_COLOR_STATE_ID_REC2100_PQ: return GDK_COLOR_STATE_ID_REC2100_LINEAR;
case GDK_COLOR_STATE_ID_REC2100_LINEAR: return GDK_COLOR_STATE_ID_REC2100_LINEAR;
case GDK_COLOR_STATE_ID_OKLAB: return GDK_COLOR_STATE_ID_SRGB_LINEAR;
case GDK_COLOR_STATE_ID_OKLCH: return GDK_COLOR_STATE_ID_SRGB_LINEAR;
default: return 0u;
};
}
uint
rectangular_color_space (uint cs)
{
if (cs == GDK_COLOR_STATE_ID_OKLCH)
return GDK_COLOR_STATE_ID_OKLAB;
else
return cs;
}
#define M_PI 3.14159265358979323846
#define RAD_TO_DEG(x) ((x)*180.0/M_PI)
#define DEG_TO_RAD(x) ((x)*M_PI/180.0)
float
normalize_hue (float h)
{
while (h < 0.0)
h += 360.0;
while (h > 360.0)
h -= 360.0;
return h;
}
vec3
oklch_to_oklab (vec3 color)
{
color.z = normalize_hue (color.z);
return vec3 (color.x,
color.y * cos (DEG_TO_RAD (color.z)),
color.y * sin (DEG_TO_RAD (color.z)));
}
vec3
oklab_to_oklch (vec3 color)
{
return vec3 (color.x,
length (color.yz),
RAD_TO_DEG (atan (color.z, color.y)));
}
vec3
to_rect (vec3 color, uint from)
{
if (from == GDK_COLOR_STATE_ID_OKLCH)
return oklch_to_oklab (color);
else
return vec3(1, 0, 0.5);
}
vec3
to_polar (vec3 color, uint to)
{
if (to == GDK_COLOR_STATE_ID_OKLCH)
return oklab_to_oklch (color);
else
return vec3(1, 0, 0.5);
}
vec4
convert_color (vec4 color,
uint from,
@@ -314,25 +199,17 @@ convert_color (vec4 color,
if (from != to)
{
uint from_rectangular = rectangular_color_space (from);
uint to_rectangular = rectangular_color_space (to);
uint from_linear = linear_color_space (from_rectangular);
uint to_linear = linear_color_space (to_rectangular);
uint from_linear = linear_color_space (from);
uint to_linear = linear_color_space (to);
if (from_rectangular != from)
color.rgb = to_rect (color.rgb, from);
if (from_linear != from_rectangular)
color.rgb = apply_eotf (color.rgb, from_rectangular);
if (from_linear != from)
color.rgb = apply_eotf (color.rgb, from);
if (from_linear != to_linear)
color.rgb = convert_linear (color.rgb, from_linear, to_linear);
if (to_linear != to_rectangular)
color.rgb = apply_oetf (color.rgb, to_rectangular);
if (to_rectangular != to)
color.rgb = to_polar (color.rgb, to);
if (to_linear != to)
color.rgb = apply_oetf (color.rgb, to);
}
if (to_premul && (!from_premul || from != to))
-2
View File
@@ -56,8 +56,6 @@
#define GDK_COLOR_STATE_ID_SRGB_LINEAR 1u
#define GDK_COLOR_STATE_ID_REC2100_PQ 2u
#define GDK_COLOR_STATE_ID_REC2100_LINEAR 3u
#define GDK_COLOR_STATE_ID_OKLAB 4u
#define GDK_COLOR_STATE_ID_OKLCH 5u
#define TOP 0u
#define RIGHT 1u
+1 -1
View File
@@ -2651,4 +2651,4 @@ gsk_contour_get_distance (const GskContour *self,
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -2640,4 +2640,4 @@ gsk_curve_get_cusps (const GskCurve *curve,
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -826,4 +826,4 @@ gsk_path_foreach_with_tolerance (GskPath *self,
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -820,4 +820,4 @@ error:
return NULL;
}
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+88 -937
View File
File diff suppressed because it is too large Load Diff
+49 -237
View File
@@ -628,10 +628,6 @@ parse_color_state (GtkCssParser *parser,
cs = gdk_color_state_get_rec2100_pq ();
else if (gtk_css_parser_try_ident (parser, "rec2100-linear"))
cs = gdk_color_state_get_rec2100_linear ();
else if (gtk_css_parser_try_ident (parser, "oklab"))
cs = gdk_color_state_get_oklab ();
else if (gtk_css_parser_try_ident (parser, "oklch"))
cs = gdk_color_state_get_oklch ();
else if (gtk_css_token_is (gtk_css_parser_get_token (parser), GTK_CSS_TOKEN_STRING))
{
char *name = gtk_css_parser_consume_string (parser);
@@ -658,18 +654,6 @@ parse_color_state (GtkCssParser *parser,
return TRUE;
}
static void
clear_color_state (gpointer inout_color_state)
{
GdkColorState **cs = inout_color_state;
if (*cs)
{
gdk_color_state_unref (*cs);
*cs = NULL;
}
}
typedef struct {
Context *context;
GdkColor *color;
@@ -759,25 +743,25 @@ parse_stops (GtkCssParser *parser,
gpointer out_stops)
{
GArray *stops;
GskColorStop2 stop;
GskColorStop stop;
stops = g_array_new (FALSE, FALSE, sizeof (GskColorStop2));
stops = g_array_new (FALSE, FALSE, sizeof (GskColorStop));
for (;;)
{
double dval;
double dval;
if (!gtk_css_parser_consume_number (parser, &dval))
goto error;
stop.offset = dval;
if (!parse_color (parser, context, &stop.color))
if (!gdk_rgba_parser_parse (parser, &stop.color))
goto error;
if (stops->len == 0 && stop.offset < 0)
gtk_css_parser_error_value (parser, "Color stop offset must be >= 0");
else if (stops->len > 0 && stop.offset < g_array_index (stops, GskColorStop2, stops->len - 1).offset)
else if (stops->len > 0 && stop.offset < g_array_index (stops, GskColorStop, stops->len - 1).offset)
gtk_css_parser_error_value (parser, "Color stop offset must be >= previous value");
else if (stop.offset > 1)
gtk_css_parser_error_value (parser, "Color stop offset must be <= 1");
@@ -793,7 +777,8 @@ parse_stops (GtkCssParser *parser,
if (stops->len < 2)
{
gtk_css_parser_error_value (parser, "At least 2 color stops need to be specified");
goto error;
g_array_free (stops, TRUE);
return FALSE;
}
if (*(GArray **) out_stops)
@@ -814,12 +799,6 @@ clear_stops (gpointer inout_stops)
if (*stops)
{
for (int i = 0; i < (*stops)->len; i++)
{
GskColorStop2 *stop = &g_array_index (*stops, GskColorStop2, i);
gdk_color_finish (&stop->color);
}
g_array_free (*stops, TRUE);
*stops = NULL;
}
@@ -1706,28 +1685,6 @@ parse_color_state_rule (GtkCssParser *parser,
return TRUE;
}
static gboolean
parse_hue_interpolation (GtkCssParser *parser,
Context *context,
gpointer out_value)
{
GskHueInterpolation interpolation;
if (gtk_css_parser_try_ident (parser, "shorter"))
interpolation = GSK_HUE_INTERPOLATION_SHORTER;
else if (gtk_css_parser_try_ident (parser, "longer"))
interpolation = GSK_HUE_INTERPOLATION_LONGER;
else if (gtk_css_parser_try_ident (parser, "increasing"))
interpolation = GSK_HUE_INTERPOLATION_INCREASING;
else if (gtk_css_parser_try_ident (parser, "decreasing"))
interpolation = GSK_HUE_INTERPOLATION_DECREASING;
else
return FALSE;
*((GskHueInterpolation *)out_value) = interpolation;
return TRUE;
}
static gboolean
parse_colors4 (GtkCssParser *parser,
Context *context,
@@ -1786,49 +1743,31 @@ parse_linear_gradient_node_internal (GtkCssParser *parser,
graphene_point_t start = GRAPHENE_POINT_INIT (0, 0);
graphene_point_t end = GRAPHENE_POINT_INIT (0, 50);
GArray *stops = NULL;
GdkColorState *interpolation = NULL;
GskHueInterpolation hue_interpolation = GSK_HUE_INTERPOLATION_SHORTER;
const Declaration declarations[] = {
{ "bounds", parse_rect, NULL, &bounds },
{ "start", parse_point, NULL, &start },
{ "end", parse_point, NULL, &end },
{ "stops", parse_stops, clear_stops, &stops },
{ "interpolation", parse_color_state, &clear_color_state, &interpolation },
{ "hue-interpolation", parse_hue_interpolation, NULL, &hue_interpolation },
};
GskRenderNode *result;
parse_declarations (parser, context, declarations, G_N_ELEMENTS (declarations));
if (stops == NULL)
{
GskColorStop2 from = { 0.0, GDK_COLOR_SRGB (0.667, 1, 0, 1) };
GskColorStop2 to = { 1.0, GDK_COLOR_SRGB (1, 0, 0.8, 1) };
GskColorStop from = { 0.0, GDK_RGBA("AAFF00") };
GskColorStop to = { 1.0, GDK_RGBA("FF00CC") };
stops = g_array_new (FALSE, FALSE, sizeof (GskColorStop2));
stops = g_array_new (FALSE, FALSE, sizeof (GskColorStop));
g_array_append_val (stops, from);
g_array_append_val (stops, to);
}
if (interpolation == NULL)
interpolation = GDK_COLOR_STATE_SRGB;
if (repeating)
result = gsk_repeating_linear_gradient_node_new2 (&bounds,
&start, &end,
interpolation,
hue_interpolation,
(GskColorStop2 *) stops->data,
stops->len);
result = gsk_repeating_linear_gradient_node_new (&bounds, &start, &end, (GskColorStop *) stops->data, stops->len);
else
result = gsk_linear_gradient_node_new2 (&bounds,
&start, &end,
interpolation,
hue_interpolation,
(GskColorStop2 *) stops->data,
stops->len);
result = gsk_linear_gradient_node_new (&bounds, &start, &end, (GskColorStop *) stops->data, stops->len);
clear_stops (&stops);
clear_color_state (&interpolation);
g_array_free (stops, TRUE);
return result;
}
@@ -1859,8 +1798,6 @@ parse_radial_gradient_node_internal (GtkCssParser *parser,
double start = 0;
double end = 1.0;
GArray *stops = NULL;
GdkColorState *interpolation = NULL;
GskHueInterpolation hue_interpolation = GSK_HUE_INTERPOLATION_SHORTER;
const Declaration declarations[] = {
{ "bounds", parse_rect, NULL, &bounds },
{ "center", parse_point, NULL, &center },
@@ -1869,25 +1806,20 @@ parse_radial_gradient_node_internal (GtkCssParser *parser,
{ "start", parse_positive_double, NULL, &start },
{ "end", parse_positive_double, NULL, &end },
{ "stops", parse_stops, clear_stops, &stops },
{ "interpolation", parse_color_state, &clear_color_state, &interpolation },
{ "hue-interpolation", parse_hue_interpolation, NULL, &hue_interpolation },
};
GskRenderNode *result;
parse_declarations (parser, context, declarations, G_N_ELEMENTS (declarations));
if (stops == NULL)
{
GskColorStop2 from = { 0.0, GDK_COLOR_SRGB (0.667, 1, 0, 1) };
GskColorStop2 to = { 1.0, GDK_COLOR_SRGB (1, 0, 0.8, 1) };
GskColorStop from = { 0.0, GDK_RGBA("AAFF00") };
GskColorStop to = { 1.0, GDK_RGBA("FF00CC") };
stops = g_array_new (FALSE, FALSE, sizeof (GskColorStop2));
stops = g_array_new (FALSE, FALSE, sizeof (GskColorStop));
g_array_append_val (stops, from);
g_array_append_val (stops, to);
}
if (interpolation == NULL)
interpolation = GDK_COLOR_STATE_SRGB;
if (end <= start)
{
gtk_css_parser_error (parser,
@@ -1898,24 +1830,13 @@ parse_radial_gradient_node_internal (GtkCssParser *parser,
result = NULL;
}
else if (repeating)
result = gsk_repeating_radial_gradient_node_new2 (&bounds, &center,
hradius, vradius,
start, end,
interpolation,
hue_interpolation,
(GskColorStop2 *) stops->data,
stops->len);
result = gsk_repeating_radial_gradient_node_new (&bounds, &center, hradius, vradius, start, end,
(GskColorStop *) stops->data, stops->len);
else
result = gsk_radial_gradient_node_new2 (&bounds, &center,
hradius, vradius,
start, end,
interpolation,
hue_interpolation,
(GskColorStop2 *) stops->data,
stops->len);
result = gsk_radial_gradient_node_new (&bounds, &center, hradius, vradius, start, end,
(GskColorStop *) stops->data, stops->len);
clear_stops (&stops);
clear_color_state (&interpolation);
g_array_free (stops, TRUE);
return result;
}
@@ -1942,41 +1863,29 @@ parse_conic_gradient_node (GtkCssParser *parser,
graphene_point_t center = GRAPHENE_POINT_INIT (25, 25);
double rotation = 0.0;
GArray *stops = NULL;
GdkColorState *interpolation = NULL;
GskHueInterpolation hue_interpolation = GSK_HUE_INTERPOLATION_SHORTER;
const Declaration declarations[] = {
{ "bounds", parse_rect, NULL, &bounds },
{ "center", parse_point, NULL, &center },
{ "rotation", parse_double, NULL, &rotation },
{ "stops", parse_stops, clear_stops, &stops },
{ "interpolation", parse_color_state, &clear_color_state, &interpolation },
{ "hue-interpolation", parse_hue_interpolation, NULL, &hue_interpolation },
};
GskRenderNode *result;
parse_declarations (parser, context, declarations, G_N_ELEMENTS (declarations));
if (stops == NULL)
{
GskColorStop2 from = { 0.0, GDK_COLOR_SRGB (0.667, 1, 0, 1) };
GskColorStop2 to = { 1.0, GDK_COLOR_SRGB (1, 0, 0.8, 1) };
GskColorStop from = { 0.0, GDK_RGBA("AAFF00") };
GskColorStop to = { 1.0, GDK_RGBA("FF00CC") };
stops = g_array_new (FALSE, FALSE, sizeof (GskColorStop2));
stops = g_array_new (FALSE, FALSE, sizeof (GskColorStop));
g_array_append_val (stops, from);
g_array_append_val (stops, to);
}
if (interpolation == NULL)
interpolation = GDK_COLOR_STATE_SRGB;
result = gsk_conic_gradient_node_new (&bounds, &center, rotation,
(GskColorStop *) stops->data, stops->len);
result = gsk_conic_gradient_node_new2 (&bounds,
&center, rotation,
interpolation,
hue_interpolation,
(GskColorStop2 *) stops->data,
stops->len);
clear_stops (&stops);
clear_color_state (&interpolation);
g_array_free (stops, TRUE);
return result;
}
@@ -3454,36 +3363,12 @@ printer_init_duplicates_for_node (Printer *printer,
printer_init_check_color_state (printer, gsk_outset_shadow_node_get_color2 (node)->color_state);
break;
case GSK_CAIRO_NODE:
case GSK_LINEAR_GRADIENT_NODE:
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
{
const GskColorStop2 *stops = gsk_linear_gradient_node_get_color_stops2 (node);
for (int i = 0; i < gsk_linear_gradient_node_get_n_color_stops (node); i++)
printer_init_check_color_state (printer, stops[i].color.color_state);
printer_init_check_color_state (printer, gsk_linear_gradient_node_get_interpolation_color_state (node));
}
break;
case GSK_RADIAL_GRADIENT_NODE:
case GSK_REPEATING_RADIAL_GRADIENT_NODE:
{
const GskColorStop2 *stops = gsk_radial_gradient_node_get_color_stops2 (node);
for (int i = 0; i < gsk_radial_gradient_node_get_n_color_stops (node); i++)
printer_init_check_color_state (printer, stops[i].color.color_state);
printer_init_check_color_state (printer, gsk_radial_gradient_node_get_interpolation_color_state (node));
}
break;
case GSK_CONIC_GRADIENT_NODE:
{
const GskColorStop2 *stops = gsk_conic_gradient_node_get_color_stops2 (node);
for (int i = 0; i < gsk_conic_gradient_node_get_n_color_stops (node); i++)
printer_init_check_color_state (printer, stops[i].color.color_state);
printer_init_check_color_state (printer, gsk_conic_gradient_node_get_interpolation_color_state (node));
}
break;
case GSK_CAIRO_NODE:
/* no children */
break;
@@ -3788,26 +3673,6 @@ append_unsigned_param (Printer *p,
g_string_append_printf (p->str, "%s: %u;\n", param_name, value);
}
static void
print_color_state (Printer *p,
GdkColorState *color_state)
{
if (GDK_IS_DEFAULT_COLOR_STATE (color_state))
{
g_string_append (p->str, gdk_color_state_get_name (color_state));
}
else
{
const char *name;
name = g_hash_table_lookup (p->named_color_states, color_state);
g_assert (name != NULL);
g_string_append_c (p->str, '"');
g_string_append (p->str, name);
g_string_append_c (p->str, '"');
}
}
static void
print_color (Printer *p,
const GdkColor *color)
@@ -3821,9 +3686,19 @@ print_color (Printer *p,
}
else
{
g_string_append (p->str, "color(");
print_color_state (p, color->color_state);
g_string_append_c (p->str, ' ');
if (GDK_IS_DEFAULT_COLOR_STATE (color->color_state))
{
g_string_append_printf (p->str, "color(%s ",
gdk_color_state_get_name (color->color_state));
}
else
{
const char *name = g_hash_table_lookup (p->named_color_states,
color->color_state);
g_assert (name != NULL);
g_string_append_printf (p->str, "color(\"%s\" ", name);
}
string_append_double (p->str, color->r);
g_string_append_c (p->str, ' ');
string_append_double (p->str, color->g);
@@ -3981,10 +3856,10 @@ append_node_param (Printer *p,
}
static void
append_stops_param (Printer *p,
const char *param_name,
const GskColorStop2 *stops,
gsize n_stops)
append_stops_param (Printer *p,
const char *param_name,
const GskColorStop *stops,
gsize n_stops)
{
gsize i;
@@ -3999,27 +3874,11 @@ append_stops_param (Printer *p,
string_append_double (p->str, stops[i].offset);
g_string_append_c (p->str, ' ');
print_color (p, &stops[i].color);
gdk_rgba_print (&stops[i].color, p->str);
}
g_string_append (p->str, ";\n");
}
static void
append_color_state_param (Printer *p,
const char *param_name,
GdkColorState *color_state,
GdkColorState *default_value)
{
if (gdk_color_state_equal (color_state, default_value))
return;
_indent (p);
g_string_append_printf (p->str, "%s: ", param_name);
print_color_state (p, color_state);
g_string_append_c (p->str, ';');
g_string_append_c (p->str, '\n');
}
static cairo_status_t
cairo_write_array (void *closure,
const unsigned char *data,
@@ -4373,29 +4232,6 @@ append_dash_param (Printer *p,
g_string_append (p->str, ";\n");
}
static const char *
hue_interpolation_to_string (GskHueInterpolation value)
{
const char *name[] = { "shorter", "longer", "increasing", "decreasing" };
return name[value];
}
static void
append_hue_interpolation_param (Printer *p,
const char *param_name,
GskHueInterpolation value,
GskHueInterpolation default_value)
{
if (value == default_value)
return;
_indent (p);
g_string_append_printf (p->str, "%s: ", param_name);
g_string_append (p->str, hue_interpolation_to_string (value));
g_string_append_c (p->str, ';');
g_string_append_c (p->str, '\n');
}
static void
render_node_print (Printer *p,
GskRenderNode *node)
@@ -4466,8 +4302,6 @@ render_node_print (Printer *p,
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
case GSK_LINEAR_GRADIENT_NODE:
{
GdkColorState *interpolation;
if (gsk_render_node_get_node_type (node) == GSK_REPEATING_LINEAR_GRADIENT_NODE)
start_node (p, "repeating-linear-gradient", node_name);
else
@@ -4476,15 +4310,9 @@ render_node_print (Printer *p,
append_rect_param (p, "bounds", &node->bounds);
append_point_param (p, "start", gsk_linear_gradient_node_get_start (node));
append_point_param (p, "end", gsk_linear_gradient_node_get_end (node));
append_stops_param (p, "stops", gsk_linear_gradient_node_get_color_stops2 (node),
append_stops_param (p, "stops", gsk_linear_gradient_node_get_color_stops (node, NULL),
gsk_linear_gradient_node_get_n_color_stops (node));
interpolation = gsk_linear_gradient_node_get_interpolation_color_state (node);
append_color_state_param (p, "interpolation", interpolation, GDK_COLOR_STATE_SRGB);
append_hue_interpolation_param (p, "hue-interpolation",
gsk_linear_gradient_node_get_hue_interpolation (node),
GSK_HUE_INTERPOLATION_SHORTER);
end_node (p);
}
break;
@@ -4492,8 +4320,6 @@ render_node_print (Printer *p,
case GSK_REPEATING_RADIAL_GRADIENT_NODE:
case GSK_RADIAL_GRADIENT_NODE:
{
GdkColorState *interpolation;
if (gsk_render_node_get_node_type (node) == GSK_REPEATING_RADIAL_GRADIENT_NODE)
start_node (p, "repeating-radial-gradient", node_name);
else
@@ -4506,38 +4332,24 @@ render_node_print (Printer *p,
append_float_param (p, "start", gsk_radial_gradient_node_get_start (node), 0.0f);
append_float_param (p, "end", gsk_radial_gradient_node_get_end (node), 1.0f);
append_stops_param (p, "stops", gsk_radial_gradient_node_get_color_stops2 (node),
append_stops_param (p, "stops", gsk_radial_gradient_node_get_color_stops (node, NULL),
gsk_radial_gradient_node_get_n_color_stops (node));
interpolation = gsk_radial_gradient_node_get_interpolation_color_state (node);
append_color_state_param (p, "interpolation", interpolation, GDK_COLOR_STATE_SRGB);
append_hue_interpolation_param (p, "hue-interpolation",
gsk_radial_gradient_node_get_hue_interpolation (node),
GSK_HUE_INTERPOLATION_SHORTER);
end_node (p);
}
break;
case GSK_CONIC_GRADIENT_NODE:
{
GdkColorState *interpolation;
start_node (p, "conic-gradient", node_name);
append_rect_param (p, "bounds", &node->bounds);
append_point_param (p, "center", gsk_conic_gradient_node_get_center (node));
append_float_param (p, "rotation", gsk_conic_gradient_node_get_rotation (node), 0.0f);
append_stops_param (p, "stops", gsk_conic_gradient_node_get_color_stops2 (node),
append_stops_param (p, "stops", gsk_conic_gradient_node_get_color_stops (node, NULL),
gsk_conic_gradient_node_get_n_color_stops (node));
interpolation = gsk_conic_gradient_node_get_interpolation_color_state (node);
append_color_state_param (p, "interpolation", interpolation, GDK_COLOR_STATE_SRGB);
append_hue_interpolation_param (p, "hue-interpolation",
gsk_conic_gradient_node_get_hue_interpolation (node),
GSK_HUE_INTERPOLATION_SHORTER);
end_node (p);
}
break;
+2 -79
View File
@@ -128,6 +128,7 @@ _gsk_render_node_ref (GskRenderNode *node)
GskRenderNode * gsk_color_node_new2 (const GdkColor *color,
const graphene_rect_t *bounds);
const GdkColor * gsk_color_node_get_color2 (const GskRenderNode *node);
GskRenderNode * gsk_border_node_new2 (const GskRoundedRect *outline,
@@ -172,7 +173,6 @@ GskRenderNode * gsk_text_node_new2 (PangoFont
const graphene_point_t *offset);
const GdkColor *gsk_text_node_get_color2 (const GskRenderNode *node);
#define GSK_RENDER_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_RENDER_NODE, GskRenderNodeClass))
#define gsk_render_node_get_node_type(node) _gsk_render_node_get_node_type (node)
@@ -184,82 +184,5 @@ _gsk_render_node_get_node_type (const GskRenderNode *node)
return GSK_RENDER_NODE_GET_CLASS (node)->node_type;
}
typedef struct _GskColorStop2 GskColorStop2;
struct _GskColorStop2
{
float offset;
GdkColor color;
};
typedef enum
{
GSK_HUE_INTERPOLATION_SHORTER,
GSK_HUE_INTERPOLATION_LONGER,
GSK_HUE_INTERPOLATION_INCREASING,
GSK_HUE_INTERPOLATION_DECREASING,
} GskHueInterpolation;
GskRenderNode * gsk_linear_gradient_node_new2 (const graphene_rect_t *bounds,
const graphene_point_t *start,
const graphene_point_t *end,
GdkColorState *interpolation,
GskHueInterpolation hue_interpolation,
const GskColorStop2 *color_stops,
gsize n_color_stops);
GskRenderNode * gsk_repeating_linear_gradient_node_new2 (const graphene_rect_t *bounds,
const graphene_point_t *start,
const graphene_point_t *end,
GdkColorState *interpolation,
GskHueInterpolation hue_interpolation,
const GskColorStop2 *color_stops,
gsize n_color_stops);
const GskColorStop2 *gsk_linear_gradient_node_get_color_stops2
(const GskRenderNode *node);
GdkColorState * gsk_linear_gradient_node_get_interpolation_color_state
(const GskRenderNode *node);
GskHueInterpolation gsk_linear_gradient_node_get_hue_interpolation
(const GskRenderNode *node);
GskRenderNode * gsk_radial_gradient_node_new2 (const graphene_rect_t *bounds,
const graphene_point_t *center,
float hradius,
float vradius,
float start,
float end,
GdkColorState *interpolation,
GskHueInterpolation hue_interpolation,
const GskColorStop2 *color_stops,
gsize n_color_stops);
GskRenderNode * gsk_repeating_radial_gradient_node_new2 (const graphene_rect_t *bounds,
const graphene_point_t *center,
float hradius,
float vradius,
float start,
float end,
GdkColorState *interpolation,
GskHueInterpolation hue_interpolation,
const GskColorStop2 *color_stops,
gsize n_color_stops);
const GskColorStop2 *gsk_radial_gradient_node_get_color_stops2
(const GskRenderNode *node);
GdkColorState * gsk_radial_gradient_node_get_interpolation_color_state
(const GskRenderNode *node);
GskHueInterpolation gsk_radial_gradient_node_get_hue_interpolation
(const GskRenderNode *node);
GskRenderNode * gsk_conic_gradient_node_new2 (const graphene_rect_t *bounds,
const graphene_point_t *center,
float rotation,
GdkColorState *interpolation,
GskHueInterpolation hue_interpolation,
const GskColorStop2 *color_stops,
gsize n_color_stops);
const GskColorStop2 *gsk_conic_gradient_node_get_color_stops2
(const GskRenderNode *node);
GdkColorState * gsk_conic_gradient_node_get_interpolation_color_state
(const GskRenderNode *node);
GskHueInterpolation gsk_conic_gradient_node_get_hue_interpolation
(const GskRenderNode *node);
G_END_DECLS
+1 -1
View File
@@ -2808,4 +2808,4 @@ gsk_matrix_transform_bounds (const graphene_matrix_t *m,
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -1011,4 +1011,4 @@ gtk_atspi_get_action_vtable (GtkAccessible *accessible)
return NULL;
}
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+12 -11
View File
@@ -858,18 +858,19 @@ emit_property_changed (GtkAtSpiContext *self,
const char *name,
GVariant *value)
{
if (self->connection == NULL || !gtk_at_spi_root_has_event_listeners (self->root))
return;
GVariant *value_owned = g_variant_ref_sink (value);
if (self->connection != NULL && gtk_at_spi_root_has_event_listeners (self->root))
g_dbus_connection_emit_signal (self->connection,
NULL,
self->context_path,
"org.a11y.atspi.Event.Object",
"PropertyChange",
g_variant_new ("(siiva{sv})",
name, 0, 0, value_owned, NULL),
NULL);
g_dbus_connection_emit_signal (self->connection,
NULL,
self->context_path,
"org.a11y.atspi.Event.Object",
"PropertyChange",
g_variant_new ("(siiva{sv})",
name, 0, 0, value_owned, NULL),
NULL);
g_variant_unref (value_owned);
}
@@ -2018,4 +2019,4 @@ gtk_at_spi_context_get_child_count (GtkAtSpiContext *self)
}
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -356,4 +356,4 @@ gtk_atspi_get_editable_text_vtable (GtkAccessible *accessible)
return NULL;
}
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -11
View File
@@ -256,8 +256,6 @@ listview_handle_method (GDBusConnection *connection,
child;
child = gtk_widget_get_next_sibling (child))
{
if (!GTK_IS_LIST_ITEM_BASE (child))
continue;
if (gtk_list_item_base_get_selected (GTK_LIST_ITEM_BASE (child)))
{
if (idx == 0)
@@ -290,8 +288,6 @@ listview_handle_method (GDBusConnection *connection,
child;
child = gtk_widget_get_next_sibling (child))
{
if (!GTK_IS_LIST_ITEM_BASE (child))
continue;
if (idx == 0)
break;
idx--;
@@ -324,8 +320,6 @@ listview_handle_method (GDBusConnection *connection,
child;
child = gtk_widget_get_next_sibling (child))
{
if (!GTK_IS_LIST_ITEM_BASE (child))
continue;
if (idx == 0)
break;
idx--;
@@ -359,8 +353,6 @@ listview_handle_method (GDBusConnection *connection,
child;
child = gtk_widget_get_next_sibling (child))
{
if (!GTK_IS_LIST_ITEM_BASE (child))
continue;
if (gtk_list_item_base_get_selected (GTK_LIST_ITEM_BASE (child)))
{
if (idx == 0)
@@ -396,8 +388,6 @@ listview_handle_method (GDBusConnection *connection,
child;
child = gtk_widget_get_next_sibling (child))
{
if (!GTK_IS_LIST_ITEM_BASE (child))
continue;
if (idx == 0)
break;
idx--;
@@ -1229,5 +1219,5 @@ gtk_atspi_disconnect_selection_signals (GtkAccessible *accessible)
}
}
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -1080,4 +1080,4 @@ gtk_atspi_disconnect_text_signals (GtkAccessible *accessible)
g_object_set_data (G_OBJECT (accessible), "accessible-text-data", NULL);
}
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -922,4 +922,4 @@ gdk_paintable_new_from_file_scaled (GFile *file,
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -905,7 +905,7 @@ static const GtkAccessibleCollect collect_rels[] = {
[GTK_ACCESSIBLE_RELATION_SET_SIZE] = {
.value = GTK_ACCESSIBLE_RELATION_SET_SIZE,
.ctype = GTK_ACCESSIBLE_COLLECT_INTEGER,
.name = "setsize"
.name = "posinset"
},
};
+1 -1
View File
@@ -773,4 +773,4 @@ gtk_alert_dialog_show (GtkAlertDialog *self,
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */
+1 -1
View File
@@ -495,4 +495,4 @@ gtk_color_dialog_choose_rgba_finish (GtkColorDialog *self,
/* }}} */
/* vim:set foldmethod=marker: */
/* vim:set foldmethod=marker expandtab: */

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