Compare commits
328 Commits
3.17.3
...
wip/renderops
| Author | SHA1 | Date | |
|---|---|---|---|
| 34a2a57895 | |||
| fe26e863ea | |||
| 2f90e1a7d9 | |||
| 84144393bc | |||
| b8accdcd0a | |||
| 5da78ac0c5 | |||
| 3fc2dc9a5c | |||
| 8105d45fe1 | |||
| fc9b67a739 | |||
| cd3f24d579 | |||
| 142abce46a | |||
| e3d8f03b3a | |||
| 8509a07a08 | |||
| 1178a0ac8b | |||
| da395606a2 | |||
| 029800c426 | |||
| 56a3fd888a | |||
| 350d555893 | |||
| 0606b525b4 | |||
| 33f9cbafcd | |||
| 6de82c9be3 | |||
| 6cc9b17429 | |||
| f8b7623b3c | |||
| e9e9dfade6 | |||
| d31e1fbef0 | |||
| 342db27278 | |||
| fb266a8876 | |||
| 3bd7b2a6fb | |||
| 5e7159413d | |||
| 69b5955108 | |||
| d3212c9b46 | |||
| de2268000d | |||
| de260ae2ea | |||
| 25885ca600 | |||
| 48ea0cbe4b | |||
| f9422ab223 | |||
| 23ce2562bf | |||
| 68aa48cc44 | |||
| 3b97a0b940 | |||
| 7f0606509d | |||
| ae8c07c67c | |||
| f2a8ddfecf | |||
| 9f27ee7f5a | |||
| 335c070f9b | |||
| 84e99b20ac | |||
| da14dbe4e5 | |||
| e083eb42e9 | |||
| 8fac1f688e | |||
| 2374a1b50b | |||
| 19f66c781f | |||
| be068607f6 | |||
| 9800d83a72 | |||
| ec9a39977a | |||
| aa052c6d29 | |||
| 1ed21ad3d4 | |||
| 4e4a2fe17e | |||
| 7ce96cb6ac | |||
| 3c9cca596f | |||
| 97e728580c | |||
| 4e155d784d | |||
| 3b43951ba4 | |||
| 93f9a81ac5 | |||
| 27dabaefa6 | |||
| b4a88c7287 | |||
| b684e70dd5 | |||
| 3c711cc98a | |||
| 8bd9604fe6 | |||
| d642ae78fc | |||
| 5981e15115 | |||
| 2caa1deb5b | |||
| eab0df12a8 | |||
| 0a601b093c | |||
| 2f8e4f2685 | |||
| d6a52218d1 | |||
| afd75070a2 | |||
| d4b0694c02 | |||
| 5ac6b82b82 | |||
| 28b8541847 | |||
| c207b8d363 | |||
| 010a120351 | |||
| a4dcc6bc52 | |||
| 66b5d2e523 | |||
| 489b48d0b5 | |||
| 9426fb08ce | |||
| ca31662630 | |||
| d9a22e7e30 | |||
| ed50772b41 | |||
| d12c7186b6 | |||
| c7d86ef4e4 | |||
| 33e2d12e90 | |||
| a3a58fa7d9 | |||
| 15a41e0bf5 | |||
| d260d2c466 | |||
| 1d63335c8e | |||
| 1b755c546e | |||
| 56c05c429f | |||
| abe4829e36 | |||
| 4b8df8c546 | |||
| b2ceadb057 | |||
| 9590879e2f | |||
| f043fd532d | |||
| c82ce07d80 | |||
| b61d79e354 | |||
| a97a3d6a5b | |||
| dc8cc6291b | |||
| 3a462b174d | |||
| 5e616e0298 | |||
| 58813a0db1 | |||
| ff20abda8e | |||
| f85db624eb | |||
| 00616bc199 | |||
| 0f7857f66a | |||
| 9c7b0f0491 | |||
| 3b1b171be5 | |||
| 1e6ccf5c86 | |||
| 94a149c8ea | |||
| 8612942fe2 | |||
| 916cf8f61e | |||
| 15bb9acc8a | |||
| 77d429bc4d | |||
| 76dc8aced5 | |||
| 3955d93e9d | |||
| 0dab37c78f | |||
| fb06b6e4b8 | |||
| 6a2143ab31 | |||
| 3665a17102 | |||
| 213b92e644 | |||
| 569e59b2c5 | |||
| 0bb82bf1de | |||
| fbbad5deec | |||
| d881b15349 | |||
| 43a4843b9c | |||
| 4499174e32 | |||
| fb034f38b3 | |||
| a9b698b265 | |||
| 91e1e80862 | |||
| 4371cc8f01 | |||
| e367c4baa0 | |||
| 002699402d | |||
| f99375f91e | |||
| 9fc19b5a26 | |||
| 5cf2896308 | |||
| 1a44a85847 | |||
| a9bf6532b4 | |||
| 4dd66b0c53 | |||
| 76ba5a03b9 | |||
| 4c3eece663 | |||
| ccc4b192ec | |||
| 3271eb2141 | |||
| da4e83e707 | |||
| fe51ac273c | |||
| fa29a01c26 | |||
| 675467063e | |||
| c3a0880cd6 | |||
| 43fcae91f1 | |||
| 6cc65260f4 | |||
| cfd85dee03 | |||
| ef8ad1c734 | |||
| 9fbd71394c | |||
| d1f2e5896b | |||
| 822886edbc | |||
| 98a3fac6ab | |||
| 1bba3b0a38 | |||
| 8cbed0b04a | |||
| 047ad11353 | |||
| 7aec96b95f | |||
| 5a446284b7 | |||
| 577e9a33bb | |||
| 85a6cafd81 | |||
| 5b162fa44a | |||
| 2af2189347 | |||
| 94fc9f5211 | |||
| 41b6993a66 | |||
| d8657a8156 | |||
| 6f955a7df6 | |||
| 8c6130e68a | |||
| a01fe14056 | |||
| a0ff35f032 | |||
| 131abe28a4 | |||
| 0093b156d7 | |||
| 06df94ff7b | |||
| e847c27aac | |||
| a2d1d5244b | |||
| 5c38991367 | |||
| c11906fcdb | |||
| 2be6d09c9e | |||
| 5a499ef3e1 | |||
| 551931c1c6 | |||
| 10cb7f90e4 | |||
| 8d56346f9b | |||
| 3a7689bae0 | |||
| cd5f70357c | |||
| fc6871b43b | |||
| c8d70c8d8c | |||
| 1600d54012 | |||
| 8b06900362 | |||
| b2cbe7ba79 | |||
| 7410a4a994 | |||
| d11e81257e | |||
| b493bf091a | |||
| 56faf49b8e | |||
| 5a61246946 | |||
| 715777154b | |||
| e74d2b7564 | |||
| 90a331c84a | |||
| ac5fcc6b72 | |||
| 06726b4d4b | |||
| 85635457bc | |||
| 9e464252c0 | |||
| 0f47d1bac4 | |||
| ecebdfc58c | |||
| df5a2e7152 | |||
| 0b3835a93f | |||
| fe219a25b7 | |||
| 70f1e2306d | |||
| 8ad0ef27a1 | |||
| ac798dc307 | |||
| 41453ffed1 | |||
| ca077a085c | |||
| 1cc8de2412 | |||
| ef93257db7 | |||
| 3c1a2c8d24 | |||
| d055f8e64c | |||
| 3e386e0abb | |||
| bd65c14813 | |||
| 79b09cccce | |||
| a219e6b4cd | |||
| 1bd10f2a7b | |||
| 0a2b1b68fa | |||
| 76836dcd81 | |||
| 4511ff76fa | |||
| 805fa78221 | |||
| 32be35010f | |||
| aff47da950 | |||
| 0c6205d538 | |||
| a82a686149 | |||
| 0dbac86407 | |||
| 359d1951bc | |||
| e1942a8bb9 | |||
| 1ff1040c20 | |||
| 6bbaa70c4c | |||
| 6bbe48ad3d | |||
| a8191e7113 | |||
| 1e8be1c446 | |||
| 88d88591d2 | |||
| 9c53f76cbd | |||
| dee0da30b6 | |||
| 245daa415e | |||
| c37f569ae8 | |||
| 3d82fc6d7e | |||
| 99e6796dd3 | |||
| 557f96c0fe | |||
| 6d4d2766e0 | |||
| a32a1fa9e4 | |||
| c5e5ee6749 | |||
| d37f94a524 | |||
| f1c11740c1 | |||
| e1c958e70d | |||
| a57636f057 | |||
| aebac40d38 | |||
| e6b3bae787 | |||
| a43efc6655 | |||
| d43f5258ff | |||
| b84d9ea7ff | |||
| d34b1225eb | |||
| 243cfd21a2 | |||
| a0e8056848 | |||
| ab72da0c41 | |||
| 291af4e359 | |||
| cb6615b557 | |||
| e96d258495 | |||
| cd8a50ef11 | |||
| b9919153b2 | |||
| 165861323a | |||
| 121c195521 | |||
| 3dd7f12f78 | |||
| bed26edfd1 | |||
| 555663c686 | |||
| 5dc440295e | |||
| a111f6ee23 | |||
| 9bb121c55d | |||
| a0dddbbafa | |||
| 9545c01764 | |||
| 6ee9281a24 | |||
| 138e958614 | |||
| 85b4eef004 | |||
| 359d3669ff | |||
| d71c5bf983 | |||
| 2a0d5c39d9 | |||
| 29ab70b801 | |||
| f16fc99391 | |||
| 1f525e263e | |||
| 75f0146c69 | |||
| 7c03f62206 | |||
| 94825c1777 | |||
| 00236c0d21 | |||
| 23032587db | |||
| fdb9a8e142 | |||
| 393df9f7e1 | |||
| 73693381b2 | |||
| 13c303fec5 | |||
| f5b245ff04 | |||
| 833dbd65cd | |||
| 4c971c6f5e | |||
| 4de444ca61 | |||
| 5984bc78ee | |||
| 91fac8b5aa | |||
| e59e38b581 | |||
| aa07c40748 | |||
| bb93c1cecd | |||
| 205db2013c | |||
| 4d75d62033 | |||
| 0eddfcedb9 | |||
| 24193a38f0 | |||
| dc55a895ed | |||
| 6d25e52a4d | |||
| c0d535a718 | |||
| bdabea3ae3 | |||
| b3bbe99001 | |||
| d3a18de97e | |||
| 36c65c1aca | |||
| 02e2f7dc56 | |||
| 03312371da | |||
| 59a7739fce | |||
| 4847eff6c4 | |||
| 9df707da22 | |||
| d921a4fe84 | |||
| d8885777a1 |
@@ -1,3 +1,69 @@
|
||||
Overview of Changes in GTK+ 3.17.4
|
||||
==================================
|
||||
|
||||
* GtkStack animates size changes
|
||||
|
||||
* GtkListBox and GtkFlowBox support positional css selectors
|
||||
like :first-child, :last-child and :nth-child
|
||||
|
||||
* GtkPlacesSidebar has been rewritten to use GtkListBox
|
||||
|
||||
* Touch selection in GtkTextView and GtkEntry has been greatly
|
||||
improved
|
||||
|
||||
* There's now a way to have output-only windows, and this is
|
||||
used by GtkOverlay for pass-through overlays
|
||||
|
||||
* Bug fixes:
|
||||
724506 Do not animate and notify during destroy
|
||||
725441 Print Dialog: Add support for PPD-less printing on IPP printers...
|
||||
745957 GTK+/Quartz >= 3.14.8: Symbol not found: _gtk_drag_cancel (MyPa...
|
||||
747793 Implement part of bookmarks mockups
|
||||
748951 popup menus are being displayed at wrong position
|
||||
749650 Slider tick marks affect vertical positioning
|
||||
749717 wayland: Position popups relative to the parent surface
|
||||
749737 DnD breaks button-released events. (Setting a widget as DnD sou...
|
||||
750058 bad options for the keybindings in css instructions generate a ...
|
||||
750068 "Recent" shortcut is missing from the left pane in the file cho...
|
||||
750338 gtkrevealer: add css padding support
|
||||
750343 CSD enabled unconditionally for windows with titlebar
|
||||
750384 GtkDialog can not be moved when gtk_dialog_run from GtkListBox ...
|
||||
750396 make text selection widgets feel more interactive
|
||||
750424 GtkPlug has extra space around window
|
||||
750477 GtkFileChooserButton's label isn't xalign=0'ed
|
||||
750489 gtk settings c910 warning unexpected annotation element type co...
|
||||
750505 Main grid overlaps GtkPopover
|
||||
750568 Add support for windows that are transparent wrt input
|
||||
750605 icontheme: don't modify symbolic SVG dimensions when recoloring
|
||||
750631 GtkAssistant: Allow to set a page with no padding
|
||||
750690 Recent Chooser Widget doesn't expand
|
||||
750692 Touch text selection: magnifier can't be seen, obscures drag ha...
|
||||
750718 Improve documentation for deprecated properties
|
||||
750741 Popover spawned from within another popover gets stacked behind...
|
||||
750883 HighContrast: add suitable touch selection handle assets
|
||||
750888 Fix return value error in _gtk_text_handle_set_direction
|
||||
750892 testfontchooserdialog.c requires pangoft2
|
||||
750993 non-modal popovers within modal popovers are non interactive
|
||||
751018 Widget: GtkMenuButton+GtkPopover gtk_toggle_button_set_active()...
|
||||
751050 Moving the mouse while a stepper is activated causes the scroll...
|
||||
751082 GtkTreeView draw performance is bad when contents are not large...
|
||||
751084 Wrong padding/spacing in the new bookmark sidebar in RTL
|
||||
751098 wayland: Always request transient commit when mapping subsurface
|
||||
751099 Fix return value error in gdk_window_set_pass_through
|
||||
751169 Improve search performance
|
||||
751341 GtkWindow: fix default empty window size with CSD
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
German
|
||||
Greek
|
||||
Hebrew
|
||||
Hungarian
|
||||
Occitan
|
||||
Spanish
|
||||
Tajik
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.17.3
|
||||
==================================
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>imm32.lib;winmm.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
|
||||
@@ -187,7 +187,7 @@
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>imm32.lib;winmm.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
|
||||
@@ -234,7 +234,7 @@
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>imm32.lib;winmm.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
|
||||
@@ -277,7 +277,7 @@
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>imm32.lib;winmm.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
|
||||
|
||||
@@ -65,6 +65,7 @@ $(PythonPath)\python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix
|
||||
cd $(SolutionDir)
|
||||
</GenerateGtkDbusBuiltSources>
|
||||
<GenerateGtkWin32RC>$(PythonPath)\python ..\process-in-win32.py --gtkwin32rc --gtk3manifest</GenerateGtkWin32RC>
|
||||
<CopyDemosH>copy ..\..\..\demos\gtk-demo\demos.h.win32 ..\..\..\demos\gtk-demo\demos.h</CopyDemosH>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<_PropertySheetDisplayName>gtkgensrcsprops</_PropertySheetDisplayName>
|
||||
@@ -85,5 +86,8 @@ cd $(SolutionDir)
|
||||
<BuildMacro Include="GenerateGtkWin32RC">
|
||||
<Value>$(GenerateGtkWin32RC)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="CopyDemosH">
|
||||
<Value>$(CopyDemosH)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -209,6 +209,32 @@
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(GenGdkConfigHBroadway)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">..\..\..\gdk\gdkconfig.h;..\..\..\GDK_BROADWAY_BUILD;..\..\..\MSVC_$(Configuration)_Broadway;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\..\..\demos\gtk-demo\demos.h.win32">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying demos.h from demos.h.win32...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(CopyDemosH)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">Copying demos.h from demos.h.win32...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(CopyDemosH)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying demos.h from demos.h.win32...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(CopyDemosH)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">Copying demos.h from demos.h.win32...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(CopyDemosH)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying demos.h from demos.h.win32...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(CopyDemosH)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">Copying demos.h from demos.h.win32...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(CopyDemosH)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying demos.h from demos.h.win32...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(CopyDemosH)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">Copying demos.h from demos.h.win32...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(CopyDemosH)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="imm32.lib winmm.lib"
|
||||
AdditionalDependencies="imm32.lib winmm.lib dwmapi.lib"
|
||||
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
@@ -104,7 +104,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="imm32.lib winmm.lib"
|
||||
AdditionalDependencies="imm32.lib winmm.lib dwmapi.lib"
|
||||
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
@@ -170,7 +170,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="imm32.lib winmm.lib"
|
||||
AdditionalDependencies="imm32.lib winmm.lib dwmapi.lib"
|
||||
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
@@ -232,7 +232,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="imm32.lib winmm.lib"
|
||||
AdditionalDependencies="imm32.lib winmm.lib dwmapi.lib"
|
||||
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
|
||||
@@ -66,4 +66,8 @@ cd $(SolutionDir)

|
||||
Name="GenerateGtkWin32RC"
|
||||
Value="$(PythonPath)\python ..\process-in-win32.py --gtkwin32rc --gtk3manifest"
|
||||
/>
|
||||
<UserMacro
|
||||
Name="CopyDemosH"
|
||||
Value="copy ..\..\..\demos\gtk-demo\demos.h.win32 ..\..\..\demos\gtk-demo\demos.h"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
||||
|
||||
@@ -217,6 +217,64 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\demos.h.win32">
|
||||
<FileConfiguration Name="Debug|Win32">
|
||||
<Tool Name="VCCustomBuildTool"
|
||||
Description="Copying demos.h from demos.h.win32..."
|
||||
CommandLine="$(CopyDemosH)"
|
||||
Outputs="..\..\..\demos\gtk-demo\demos.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug_Broadway|Win32">
|
||||
<Tool Name="VCCustomBuildTool"
|
||||
Description="Copying demos.h from demos.h.win32..."
|
||||
CommandLine="$(CopyDemosH)"
|
||||
Outputs="..\..\..\demos\gtk-demo\demos.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|Win32">
|
||||
<Tool Name="VCCustomBuildTool"
|
||||
Description="Copying demos.h from demos.h.win32..."
|
||||
CommandLine="$(CopyDemosH)"
|
||||
Outputs="..\..\..\demos\gtk-demo\demos.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release_Broadway|Win32">
|
||||
<Tool Name="VCCustomBuildTool"
|
||||
Description="Copying demos.h from demos.h.win32..."
|
||||
CommandLine="$(CopyDemosH)"
|
||||
Outputs="..\..\..\demos\gtk-demo\demos.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug|x64">
|
||||
<Tool Name="VCCustomBuildTool"
|
||||
Description="Copying demos.h from demos.h.win32..."
|
||||
CommandLine="$(CopyDemosH)"
|
||||
Outputs="..\..\..\demos\gtk-demo\demos.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Debug_Broadway|x64">
|
||||
<Tool Name="VCCustomBuildTool"
|
||||
Description="Copying demos.h from demos.h.win32..."
|
||||
CommandLine="$(CopyDemosH)"
|
||||
Outputs="..\..\..\demos\gtk-demo\demos.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release|x64">
|
||||
<Tool Name="VCCustomBuildTool"
|
||||
Description="Copying demos.h from demos.h.win32..."
|
||||
CommandLine="$(CopyDemosH)"
|
||||
Outputs="..\..\..\demos\gtk-demo\demos.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration Name="Release_Broadway|x64">
|
||||
<Tool Name="VCCustomBuildTool"
|
||||
Description="Copying demos.h from demos.h.win32..."
|
||||
CommandLine="$(CopyDemosH)"
|
||||
Outputs="..\..\..\demos\gtk-demo\demos.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [17])
|
||||
m4_define([gtk_micro_version], [3])
|
||||
m4_define([gtk_micro_version], [4])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
@@ -42,7 +42,7 @@ m4_define([gtk_binary_version], [3.0.0])
|
||||
|
||||
# required versions of other packages
|
||||
m4_define([glib_required_version], [2.43.4])
|
||||
m4_define([pango_required_version], [1.36.7])
|
||||
m4_define([pango_required_version], [1.37.1])
|
||||
m4_define([atk_required_version], [2.15.1])
|
||||
m4_define([cairo_required_version], [1.14.0])
|
||||
m4_define([gdk_pixbuf_required_version], [2.30.0])
|
||||
@@ -1738,7 +1738,7 @@ if test "$enable_man" != no; then
|
||||
dnl check for DocBook XSL stylesheets in the local catalog
|
||||
JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
|
||||
[DocBook XSL Stylesheets], [have_docbook_style=yes],[have_docbook_style=no])
|
||||
if test "$have_docbook_dtd" != yes; then
|
||||
if test "$have_docbook_style" != yes; then
|
||||
if test "$enable_man" = yes ; then
|
||||
AC_MSG_ERROR([DocBook XSL Stylesheets are required for --enable-man])
|
||||
fi
|
||||
|
||||
@@ -3,7 +3,7 @@ include $(top_srcdir)/Makefile.decl
|
||||
|
||||
## These should be in the order you want them to appear in the
|
||||
## demo app, which means alphabetized by demo title, not filename
|
||||
demos = \
|
||||
demos_base = \
|
||||
application.c \
|
||||
assistant.c \
|
||||
builder.c \
|
||||
@@ -25,6 +25,7 @@ demos = \
|
||||
entry_completion.c \
|
||||
event_axes.c \
|
||||
expander.c \
|
||||
font_features.c \
|
||||
gestures.c \
|
||||
glarea.c \
|
||||
headerbar.c \
|
||||
@@ -62,7 +63,9 @@ demos = \
|
||||
tree_store.c
|
||||
|
||||
if OS_UNIX
|
||||
demos += pagesetup.c
|
||||
demos = $(demos_base) pagesetup.c
|
||||
else
|
||||
demos = $(demos_base)
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
@@ -95,7 +98,8 @@ EXTRA_DIST += \
|
||||
data/symbolic-source.svg \
|
||||
demo.gresource.xml \
|
||||
$(RESOURCES) \
|
||||
org.gtk.Demo.gschema.xml
|
||||
org.gtk.Demo.gschema.xml \
|
||||
demos.h.win32
|
||||
|
||||
gsettings_SCHEMAS = \
|
||||
org.gtk.Demo.gschema.xml
|
||||
@@ -105,11 +109,15 @@ gsettings_SCHEMAS = \
|
||||
demos.h: $(demos) geninclude.pl
|
||||
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
|
||||
|
||||
demos.h.win32: $(demos_base) geninclude.pl
|
||||
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos_base)) > demos.h.win32
|
||||
|
||||
nodist_gtk3_demo_SOURCES = demos.h
|
||||
|
||||
gtk3_demo_SOURCES = \
|
||||
$(demos) \
|
||||
demo_resources.c \
|
||||
main.c \
|
||||
demos.h
|
||||
main.c
|
||||
|
||||
gtk3_demo_DEPENDENCIES = $(DEPS)
|
||||
gtk3_demo_LDADD = $(LDADDS)
|
||||
@@ -227,6 +235,6 @@ uninstall-update-icon-cache:
|
||||
$(AM_V_at)$(POST_UNINSTALL)
|
||||
test -n "$(DESTDIR)" || $(update_icon_cache) "$(iconthemedir)"
|
||||
|
||||
DISTCLEANFILES = demos.h
|
||||
DISTCLEANFILES = demos.h demos.h.win32
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
||||
@@ -48,7 +48,6 @@ GtkWidget *
|
||||
do_builder (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GError *err = NULL;
|
||||
GtkWidget *toolbar;
|
||||
GActionGroup *actions;
|
||||
GtkAccelGroup *accel_group;
|
||||
@@ -56,13 +55,8 @@ do_builder (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/builder/demo.ui", &err);
|
||||
if (err)
|
||||
{
|
||||
g_error ("ERROR: %s\n", err->message);
|
||||
return NULL;
|
||||
}
|
||||
builder = gtk_builder_new_from_resource ("/builder/demo.ui");
|
||||
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
|
||||
@@ -56,7 +56,7 @@ do_button_box (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes demo");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
|
||||
@@ -242,7 +242,7 @@ open_display_cb (GtkWidget *button,
|
||||
if (!result)
|
||||
{
|
||||
gchar *error_msg =
|
||||
g_strdup_printf ("Can't open display :\n\t%s\nplease try another one\n",
|
||||
g_strdup_printf ("Can't open display:\n\t%s\nplease try another one\n",
|
||||
new_screen_name);
|
||||
gtk_label_set_text (GTK_LABEL (dialog_label), error_msg);
|
||||
g_free (error_msg);
|
||||
@@ -523,12 +523,12 @@ do_changedisplay (GtkWidget *do_widget)
|
||||
|
||||
info = g_new0 (ChangeDisplayInfo, 1);
|
||||
|
||||
info->window = gtk_dialog_new_with_buttons ("Change Screen or display",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"), GTK_RESPONSE_CLOSE,
|
||||
"Change", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
info->window = gtk_dialog_new_with_buttons ("Change Display",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
"Close", GTK_RESPONSE_CLOSE,
|
||||
"Change", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ do_clipboard (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Clipboard demo");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Clipboard");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
@@ -318,7 +318,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Combo boxes");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Combo Boxes");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
|
||||
@@ -23,16 +23,14 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *container, *child;
|
||||
GtkStyleProvider *provider;
|
||||
GBytes *bytes;
|
||||
gsize data_size;
|
||||
const guint8 *data;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
|
||||
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
|
||||
@@ -57,11 +55,7 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (container), child);
|
||||
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
bytes = g_resources_lookup_data ("/css_accordion/css_accordion.css", 0, NULL);
|
||||
data = g_bytes_get_data (bytes, &data_size);
|
||||
|
||||
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider), (gchar *)data, data_size, NULL);
|
||||
g_bytes_unref (bytes);
|
||||
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
|
||||
|
||||
apply_css (window, provider);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ show_parsing_error (GtkCssProvider *provider,
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
css_text_changed (GtkTextBuffer *buffer,
|
||||
GtkCssProvider *provider)
|
||||
@@ -70,8 +70,9 @@ do_css_basics (GtkWidget *do_widget)
|
||||
GtkStyleProvider *provider;
|
||||
GtkTextBuffer *text;
|
||||
GBytes *bytes;
|
||||
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "CSS Basics");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||
g_signal_connect (window, "destroy",
|
||||
@@ -88,15 +89,13 @@ do_css_basics (GtkWidget *do_widget)
|
||||
NULL);
|
||||
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
|
||||
|
||||
container = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (window), container);
|
||||
child = gtk_text_view_new_with_buffer (text);
|
||||
gtk_container_add (GTK_CONTAINER (container), child);
|
||||
g_signal_connect (text,
|
||||
"changed",
|
||||
G_CALLBACK (css_text_changed),
|
||||
provider);
|
||||
g_signal_connect (text, "changed",
|
||||
G_CALLBACK (css_text_changed), provider);
|
||||
|
||||
bytes = g_resources_lookup_data ("/css_basics/css_basics.css", 0, NULL);
|
||||
gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
|
||||
|
||||
@@ -34,7 +34,7 @@ show_parsing_error (GtkCssProvider *provider,
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
css_text_changed (GtkTextBuffer *buffer,
|
||||
GtkCssProvider *provider)
|
||||
@@ -90,6 +90,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
|
||||
GBytes *bytes;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Multiple Backgrounds");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||
g_signal_connect (window, "destroy",
|
||||
|
||||
@@ -33,7 +33,7 @@ show_parsing_error (GtkCssProvider *provider,
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
css_text_changed (GtkTextBuffer *buffer,
|
||||
GtkCssProvider *provider)
|
||||
@@ -69,8 +69,9 @@ do_css_pixbufs (GtkWidget *do_widget)
|
||||
GtkStyleProvider *provider;
|
||||
GtkTextBuffer *text;
|
||||
GBytes *bytes;
|
||||
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Animated Backgrounds");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||
g_signal_connect (window, "destroy",
|
||||
|
||||
@@ -32,7 +32,7 @@ show_parsing_error (GtkCssProvider *provider,
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
css_text_changed (GtkTextBuffer *buffer,
|
||||
GtkCssProvider *provider)
|
||||
@@ -92,8 +92,9 @@ do_css_shadows (GtkWidget *do_widget)
|
||||
GtkStyleProvider *provider;
|
||||
GtkTextBuffer *text;
|
||||
GBytes *bytes;
|
||||
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Shadows");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||
g_signal_connect (window, "destroy",
|
||||
|
||||
@@ -132,6 +132,7 @@
|
||||
<file>event_axes.c</file>
|
||||
<file>expander.c</file>
|
||||
<file>flowbox.c</file>
|
||||
<file>font_features.c</file>
|
||||
<file>gestures.c</file>
|
||||
<file>glarea.c</file>
|
||||
<file>headerbar.c</file>
|
||||
@@ -183,4 +184,7 @@
|
||||
<file>glarea-fragment.glsl</file>
|
||||
<file>glarea-vertex.glsl</file>
|
||||
</gresource>
|
||||
<gresource prefix="/font-features">
|
||||
<file>font-features.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkAboutDialog" id="aboutdialog1">
|
||||
<property name="program-name" translatable="yes">GtkBuilder demo</property>
|
||||
<property name="program-name" translatable="yes">Builder demo</property>
|
||||
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
||||
<accessibility>
|
||||
<relation target="window1" type="subwindow-of"/>
|
||||
@@ -33,7 +33,7 @@
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="default_height">250</property>
|
||||
<property name="default_width">440</property>
|
||||
<property name="title">GtkBuilder demo</property>
|
||||
<property name="title" translatable="yes">Builder</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Dialog and Message Boxes
|
||||
/* Dialogs and Message Boxes
|
||||
*
|
||||
* Dialog widgets are used to pop up a transient window for user feedback.
|
||||
*/
|
||||
@@ -109,7 +109,7 @@ do_dialog (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Dialogs");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Dialogs and Message Boxes");
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
|
||||
@@ -349,7 +349,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Shopping list");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Editable Cells");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* Entry/Entry Buffer
|
||||
*
|
||||
* GtkEntryBuffer provides the text content in a GtkEntry.
|
||||
*
|
||||
* Applications can provide their own buffer implementation,
|
||||
* e.g. to provide secure handling for passwords in memory.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
@@ -20,7 +21,7 @@ do_entry_buffer (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkEntryBuffer",
|
||||
window = gtk_dialog_new_with_buttons ("Entry Buffer",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
|
||||
@@ -47,7 +47,7 @@ do_entry_completion (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkEntryCompletion",
|
||||
window = gtk_dialog_new_with_buttons ("Entry Completion",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
|
||||
@@ -384,6 +384,7 @@ do_event_axes (GtkWidget *toplevel)
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Event Axes");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
|
||||
+68
-28
@@ -10,45 +10,85 @@
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static void
|
||||
response_cb (GtkDialog *dialog, gint response_id)
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
expander_cb (GtkExpander *expander, GParamSpec *pspec, GtkWindow *dialog)
|
||||
{
|
||||
gtk_window_set_resizable (dialog, gtk_expander_get_expanded (expander));
|
||||
}
|
||||
|
||||
static void
|
||||
do_not_expand (GtkWidget *child, gpointer data)
|
||||
{
|
||||
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (child)), child,
|
||||
"expand", FALSE, "fill", FALSE, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_expander (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *toplevel;
|
||||
GtkWidget *area;
|
||||
GtkWidget *box;
|
||||
GtkWidget *expander;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *tv;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkExpander",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
GTK_RESPONSE_NONE,
|
||||
NULL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
{
|
||||
toplevel = gtk_widget_get_toplevel (do_widget);
|
||||
window = gtk_message_dialog_new_with_markup (GTK_WINDOW (toplevel),
|
||||
0,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"<big><b>%s</b></big>",
|
||||
"Something went wrong");
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (window),
|
||||
"Here are some more details "
|
||||
"but not the full story.");
|
||||
|
||||
g_signal_connect (window, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
|
||||
box = gtk_widget_get_parent (area);
|
||||
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (box)), box,
|
||||
"expand", TRUE, "fill", TRUE, NULL);
|
||||
gtk_container_foreach (GTK_CONTAINER (area), do_not_expand, NULL);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
expander = gtk_expander_new ("Details:");
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 100);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
tv = gtk_text_view_new ();
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (tv), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD);
|
||||
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer),
|
||||
"Finally, the full story with all details. "
|
||||
"And all the inside information, including "
|
||||
"error codes, etc etc. Pages of information, "
|
||||
"you might have to scroll down to read it all, "
|
||||
"or even resize the window - it works !\n"
|
||||
"A second paragraph will contain even more "
|
||||
"innuendo, just to make you scroll down or "
|
||||
"resize the window. Do it already !", -1);
|
||||
gtk_container_add (GTK_CONTAINER (sw), tv);
|
||||
gtk_container_add (GTK_CONTAINER (expander), sw);
|
||||
gtk_box_pack_end (GTK_BOX (area), expander, TRUE, TRUE, 0);
|
||||
gtk_widget_show_all (expander);
|
||||
g_signal_connect (expander, "notify::expanded",
|
||||
G_CALLBACK (expander_cb), window);
|
||||
|
||||
label = gtk_label_new ("Expander demo. Click on the triangle for details.");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the expander */
|
||||
expander = gtk_expander_new ("Details");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Details can be shown or hidden.");
|
||||
gtk_container_add (GTK_CONTAINER (expander), label);
|
||||
g_signal_connect (window, "response", G_CALLBACK (response_cb), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,205 @@
|
||||
/* Font Features
|
||||
*
|
||||
* This demonstrates support for OpenType font features with
|
||||
* Pango attributes. The attributes can be used manually or
|
||||
* via Pango markup.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *label;
|
||||
static GtkWidget *settings;
|
||||
static GtkWidget *font;
|
||||
static GtkWidget *resetbutton;
|
||||
static GtkWidget *numcasedefault;
|
||||
static GtkWidget *numspacedefault;
|
||||
static GtkWidget *fractiondefault;
|
||||
static GtkWidget *stack;
|
||||
static GtkWidget *entry;
|
||||
|
||||
static GtkWidget *toggle[24];
|
||||
|
||||
static void
|
||||
update (void)
|
||||
{
|
||||
GString *s;
|
||||
char *font_desc;
|
||||
char *font_settings;
|
||||
const char *text;
|
||||
gboolean has_feature;
|
||||
int i;
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
|
||||
font_desc = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (font));
|
||||
|
||||
s = g_string_new ("");
|
||||
|
||||
has_feature = FALSE;
|
||||
for (i = 0; i < 24; i++)
|
||||
{
|
||||
if (!gtk_widget_is_sensitive (toggle[i]))
|
||||
continue;
|
||||
|
||||
if (GTK_IS_RADIO_BUTTON (toggle[i]))
|
||||
{
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle[i])))
|
||||
{
|
||||
if (has_feature)
|
||||
g_string_append (s, ", ");
|
||||
g_string_append (s, gtk_buildable_get_name (GTK_BUILDABLE (toggle[i])));
|
||||
g_string_append (s, " 1");
|
||||
has_feature = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (has_feature)
|
||||
g_string_append (s, ", ");
|
||||
g_string_append (s, gtk_buildable_get_name (GTK_BUILDABLE (toggle[i])));
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle[i])))
|
||||
g_string_append (s, " 1");
|
||||
else
|
||||
g_string_append (s, " 0");
|
||||
has_feature = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
font_settings = g_string_free (s, FALSE);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (settings), font_settings);
|
||||
|
||||
s = g_string_new ("");
|
||||
g_string_append_printf (s, "<span font_desc='%s' font_features='%s'>%s</span>", font_desc, font_settings, text);
|
||||
|
||||
gtk_label_set_markup (GTK_LABEL (label), s->str);
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
|
||||
g_free (font_desc);
|
||||
g_free (font_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
reset (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (numcasedefault), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (numspacedefault), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fractiondefault), TRUE);
|
||||
for (i = 0; i < 24; i++)
|
||||
{
|
||||
if (!GTK_IS_RADIO_BUTTON (toggle[i]))
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle[i]), FALSE);
|
||||
gtk_widget_set_sensitive (toggle[i], FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static char *text;
|
||||
|
||||
static void
|
||||
switch_to_entry (void)
|
||||
{
|
||||
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), "entry");
|
||||
}
|
||||
|
||||
static void
|
||||
switch_to_label (void)
|
||||
{
|
||||
g_free (text);
|
||||
text = NULL;
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), "label");
|
||||
update ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
entry_key_press (GtkEntry *entry, GdkEventKey *event)
|
||||
{
|
||||
if (event->keyval == GDK_KEY_Escape)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
switch_to_label ();
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_font_features (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
int i;
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/font-features/font-features.ui");
|
||||
|
||||
gtk_builder_add_callback_symbol (builder, "update", update);
|
||||
gtk_builder_add_callback_symbol (builder, "reset", reset);
|
||||
gtk_builder_add_callback_symbol (builder, "switch_to_entry", switch_to_entry);
|
||||
gtk_builder_add_callback_symbol (builder, "switch_to_label", switch_to_label);
|
||||
gtk_builder_add_callback_symbol (builder, "entry_key_press", G_CALLBACK (entry_key_press));
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
label = GTK_WIDGET (gtk_builder_get_object (builder, "label"));
|
||||
settings = GTK_WIDGET (gtk_builder_get_object (builder, "settings"));
|
||||
resetbutton = GTK_WIDGET (gtk_builder_get_object (builder, "reset"));
|
||||
font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
|
||||
numcasedefault = GTK_WIDGET (gtk_builder_get_object (builder, "numcasedefault"));
|
||||
numspacedefault = GTK_WIDGET (gtk_builder_get_object (builder, "numspacedefault"));
|
||||
fractiondefault = GTK_WIDGET (gtk_builder_get_object (builder, "fractiondefault"));
|
||||
stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
|
||||
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||
|
||||
i = 0;
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "kern"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "liga"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "dlig"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "hlig"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "clig"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "smcp"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "c2sc"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "lnum"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "onum"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "pnum"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "tnum"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "frac"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "afrc"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "zero"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "nalt"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "swsh"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "calt"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "hist"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "salt"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss01"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss02"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss03"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss04"));
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss05"));
|
||||
|
||||
update ();
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ do_gestures (GtkWidget *do_widget)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Gestures demo");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Gestures");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ create_glarea_window (GtkWidget *do_widget)
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkGLArea - Golden Triangle");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "OpenGL Area");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
||||
@@ -128,7 +128,7 @@ key_press_event (GtkWidget *text_view,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Links can also be activated by clicking.
|
||||
/* Links can also be activated by clicking or tapping.
|
||||
*/
|
||||
static gboolean
|
||||
event_after (GtkWidget *text_view,
|
||||
@@ -136,15 +136,30 @@ event_after (GtkWidget *text_view,
|
||||
{
|
||||
GtkTextIter start, end, iter;
|
||||
GtkTextBuffer *buffer;
|
||||
GdkEventButton *event;
|
||||
gdouble ex, ey;
|
||||
gint x, y;
|
||||
|
||||
if (ev->type != GDK_BUTTON_RELEASE)
|
||||
return FALSE;
|
||||
if (ev->type == GDK_BUTTON_RELEASE)
|
||||
{
|
||||
GdkEventButton *event;
|
||||
|
||||
event = (GdkEventButton *)ev;
|
||||
event = (GdkEventButton *)ev;
|
||||
if (event->button != GDK_BUTTON_PRIMARY)
|
||||
return FALSE;
|
||||
|
||||
if (event->button != GDK_BUTTON_PRIMARY)
|
||||
ex = event->x;
|
||||
ey = event->y;
|
||||
}
|
||||
else if (ev->type == GDK_TOUCH_END)
|
||||
{
|
||||
GdkEventTouch *event;
|
||||
|
||||
event = (GdkEventTouch *)ev;
|
||||
|
||||
ex = event->x;
|
||||
ey = event->y;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
||||
@@ -156,13 +171,13 @@ event_after (GtkWidget *text_view,
|
||||
|
||||
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
|
||||
GTK_TEXT_WINDOW_WIDGET,
|
||||
event->x, event->y, &x, &y);
|
||||
ex, ey, &x, &y);
|
||||
|
||||
gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y);
|
||||
|
||||
follow_if_link (text_view, &iter);
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean hovering_over_link = FALSE;
|
||||
|
||||
@@ -255,7 +255,7 @@ do_iconview (GtkWidget *do_widget)
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkIconView demo");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Icon View Basics");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (close_window), NULL);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Info bar
|
||||
/* Info Bars
|
||||
*
|
||||
* Info bar widgets are used to report important messages to the user.
|
||||
*/
|
||||
|
||||
@@ -258,7 +258,7 @@ do_list_store (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkListStore demo");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "List Store");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
@@ -18,10 +18,6 @@
|
||||
* A GtkMenuItem can have a submenu, which is simply a GtkMenu to pop
|
||||
* up when the menu item is selected. Typically, all menu items in a menu bar
|
||||
* have submenus.
|
||||
*
|
||||
* GtkUIManager provides a higher-level interface for creating menu bars
|
||||
* and menus; while you can construct menus manually, most people don't
|
||||
* do that. There's a separate demo for GtkUIManager.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -30,7 +26,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
static GtkWidget *
|
||||
create_menu (gint depth)
|
||||
create_menu (gint depth)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkRadioMenuItem *last_item;
|
||||
@@ -120,6 +116,7 @@ do_menus (GtkWidget *do_widget)
|
||||
gtk_widget_show (box1);
|
||||
|
||||
menubar = gtk_menu_bar_new ();
|
||||
gtk_widget_set_hexpand (menubar, TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show (menubar);
|
||||
|
||||
|
||||
@@ -577,7 +577,7 @@ do_offscreen_window (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Rotated widget");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Rotated Button");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
+54
-145
@@ -1,10 +1,20 @@
|
||||
/* Overlay
|
||||
*
|
||||
* Stack widgets in static positions over a main widget
|
||||
* Shows widgets in static positions over a main widget.
|
||||
*
|
||||
* The overlayed widgets can be interactive controls such
|
||||
* as the entry in this example, or just decorative, like
|
||||
* the big blue label.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
do_number (GtkButton *button, GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_text (entry, gtk_button_get_label (button));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_overlay (GtkWidget *do_widget)
|
||||
{
|
||||
@@ -12,158 +22,57 @@ do_overlay (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *view;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *overlay;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *button;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *entry;
|
||||
int i, j;
|
||||
char *text;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
450, 450);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 500, 510);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Overlay");
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (overlay), grid);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
|
||||
for (j = 0; j < 5; j++)
|
||||
{
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
text = g_strdup_printf ("%d", 5*j + i);
|
||||
button = gtk_button_new_with_label (text);
|
||||
g_free (text);
|
||||
gtk_widget_set_hexpand (button, TRUE);
|
||||
gtk_widget_set_vexpand (button, TRUE);
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (do_number), entry);
|
||||
gtk_grid_attach (GTK_GRID (grid), button, i, j, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
|
||||
gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (overlay), vbox, TRUE);
|
||||
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
|
||||
|
||||
label = gtk_label_new ("<span foreground='blue' weight='ultrabold' font='40'>Numbers</span>");
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 8);
|
||||
|
||||
gtk_entry_set_placeholder_text (GTK_ENTRY (entry), "Your Lucky Number");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 8);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Overlay");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
view = gtk_text_view_new ();
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_END);
|
||||
|
||||
label = gtk_label_new ("Hello world");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_END);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
gtk_widget_set_margin_start (label, 20);
|
||||
gtk_widget_set_margin_end (label, 20);
|
||||
gtk_widget_set_margin_top (label, 5);
|
||||
gtk_widget_set_margin_bottom (label, 5);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_END);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
|
||||
label = gtk_label_new ("Hello world");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_END);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
gtk_widget_set_margin_start (label, 20);
|
||||
gtk_widget_set_margin_end (label, 20);
|
||||
gtk_widget_set_margin_top (label, 5);
|
||||
gtk_widget_set_margin_bottom (label, 5);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_START);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
|
||||
label = gtk_label_new ("Hello world");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_START);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
gtk_widget_set_margin_start (label, 20);
|
||||
gtk_widget_set_margin_end (label, 20);
|
||||
gtk_widget_set_margin_top (label, 5);
|
||||
gtk_widget_set_margin_bottom (label, 5);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_START);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
|
||||
label = gtk_label_new ("Hello world");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_START);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
gtk_widget_set_margin_start (label, 20);
|
||||
gtk_widget_set_margin_end (label, 20);
|
||||
gtk_widget_set_margin_top (label, 5);
|
||||
gtk_widget_set_margin_bottom (label, 5);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
|
||||
label = gtk_label_new ("Hello world");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
gtk_widget_set_margin_start (label, 20);
|
||||
gtk_widget_set_margin_end (label, 20);
|
||||
gtk_widget_set_margin_top (label, 5);
|
||||
gtk_widget_set_margin_bottom (label, 5);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
|
||||
label = gtk_label_new ("Hello world");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
gtk_widget_set_margin_start (label, 20);
|
||||
gtk_widget_set_margin_end (label, 20);
|
||||
gtk_widget_set_margin_top (label, 5);
|
||||
gtk_widget_set_margin_bottom (label, 5);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_START);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
|
||||
label = gtk_label_new ("Hello world");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_START);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
gtk_widget_set_margin_start (label, 20);
|
||||
gtk_widget_set_margin_end (label, 20);
|
||||
gtk_widget_set_margin_top (label, 5);
|
||||
gtk_widget_set_margin_bottom (label, 5);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_END);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
|
||||
label = gtk_label_new ("Hello world");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_END);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
gtk_widget_set_margin_start (label, 10);
|
||||
gtk_widget_set_margin_end (label, 10);
|
||||
gtk_widget_set_margin_top (label, 5);
|
||||
gtk_widget_set_margin_bottom (label, 5);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
|
||||
label = gtk_label_new ("Hello world");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
|
||||
|
||||
gtk_widget_show_all (overlay);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/* Paned Widgets
|
||||
*
|
||||
* The GtkHPaned and GtkVPaned Widgets divide their content
|
||||
* area into two panes with a divider in between that the
|
||||
* user can adjust. A separate child is placed into each
|
||||
* pane.
|
||||
* The GtkPaned Widget divides its content area into two panes
|
||||
* with a divider in between that the user can adjust. A separate
|
||||
* child is placed into each pane. GtkPaned widgets can be split
|
||||
* horizontally or vertially.
|
||||
*
|
||||
* There are a number of options that can be set for each pane.
|
||||
* This test contains both a horizontal (HPaned) and a vertical
|
||||
* (VPaned) widget, and allows you to adjust the options for
|
||||
* each side of each widget.
|
||||
* This test contains both a horizontal and a vertical GtkPaned
|
||||
* widget, and allows you to adjust the options for each side of
|
||||
* each widget.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -141,7 +141,7 @@ do_panes (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Panes");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
||||
@@ -84,7 +84,7 @@ do_search_entry2 (GtkWidget *do_widget)
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Search Entry #2");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Delayed Search Entry");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_widget_set_size_request (window, 200, -1);
|
||||
|
||||
@@ -43,7 +43,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW(window), header);
|
||||
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar demo");
|
||||
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
@@ -100,7 +100,7 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
|
||||
window = gtk_dialog_new_with_buttons ("Size Groups",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
|
||||
@@ -36,7 +36,7 @@ do_spinner (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkSpinner",
|
||||
window = gtk_dialog_new_with_buttons ("Spinner",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
|
||||
@@ -14,17 +14,10 @@ GtkWidget *
|
||||
do_stack (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GError *err = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/stack/stack.ui", &err);
|
||||
if (err)
|
||||
{
|
||||
g_error ("ERROR: %s\n", err->message);
|
||||
return NULL;
|
||||
}
|
||||
builder = gtk_builder_new_from_resource ("/stack/stack.ui");
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- interface-requires gtk+ 3.6 -->
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">GtkStack</property>
|
||||
<property name="title" translatable="yes">Stack</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -181,6 +181,7 @@ do_textscroll (GtkWidget *do_widget)
|
||||
GtkWidget *hbox;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Automatic Scrolling");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
|
||||
@@ -480,7 +480,7 @@ do_textview (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "TextView");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Multiple Views");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
static void
|
||||
draw_shadow_box (cairo_t *cr,
|
||||
GdkRectangle rect,
|
||||
double radius,
|
||||
double transparency)
|
||||
GdkRectangle rect,
|
||||
double radius,
|
||||
double transparency)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
double x0, x1, x2, x3;
|
||||
@@ -23,140 +23,140 @@ draw_shadow_box (cairo_t *cr,
|
||||
x1 = rect.x + radius;
|
||||
x2 = rect.x + rect.width - radius;
|
||||
x3 = rect.x + rect.width;
|
||||
|
||||
|
||||
y0 = rect.y;
|
||||
y1 = rect.y + radius;
|
||||
y2 = rect.y + rect.height - radius;
|
||||
y3 = rect.y + rect.height;
|
||||
|
||||
|
||||
/* Fill non-border part */
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, transparency);
|
||||
cairo_rectangle (cr,
|
||||
x1, y1, x2 - x1, y2 - y1);
|
||||
x1, y1, x2 - x1, y2 - y1);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Upper border */
|
||||
|
||||
pattern = cairo_pattern_create_linear (0, y0, 0, y1);
|
||||
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
|
||||
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x1, y0,
|
||||
x2 - x1, y1 - y0);
|
||||
x1, y0,
|
||||
x2 - x1, y1 - y0);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Bottom border */
|
||||
|
||||
pattern = cairo_pattern_create_linear (0, y2, 0, y3);
|
||||
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x1, y2,
|
||||
x2 - x1, y3 - y2);
|
||||
x1, y2,
|
||||
x2 - x1, y3 - y2);
|
||||
cairo_fill (cr);
|
||||
|
||||
|
||||
/* Left border */
|
||||
|
||||
pattern = cairo_pattern_create_linear (x0, 0, x1, 0);
|
||||
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
|
||||
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x0, y1,
|
||||
x1 - x0, y2 - y1);
|
||||
x0, y1,
|
||||
x1 - x0, y2 - y1);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Right border */
|
||||
|
||||
pattern = cairo_pattern_create_linear (x2, 0, x3, 0);
|
||||
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x2, y1,
|
||||
x3 - x2, y2 - y1);
|
||||
x2, y1,
|
||||
x3 - x2, y2 - y1);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* NW corner */
|
||||
|
||||
|
||||
pattern = cairo_pattern_create_radial (x1, y1, 0,
|
||||
x1, y1, radius);
|
||||
x1, y1, radius);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x0, y0,
|
||||
x1 - x0, y1 - y0);
|
||||
x0, y0,
|
||||
x1 - x0, y1 - y0);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* NE corner */
|
||||
|
||||
|
||||
pattern = cairo_pattern_create_radial (x2, y1, 0,
|
||||
x2, y1, radius);
|
||||
x2, y1, radius);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x2, y0,
|
||||
x3 - x2, y1 - y0);
|
||||
x2, y0,
|
||||
x3 - x2, y1 - y0);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* SW corner */
|
||||
|
||||
|
||||
pattern = cairo_pattern_create_radial (x1, y2, 0,
|
||||
x1, y2, radius);
|
||||
x1, y2, radius);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x0, y2,
|
||||
x1 - x0, y3 - y2);
|
||||
x0, y2,
|
||||
x1 - x0, y3 - y2);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* SE corner */
|
||||
|
||||
|
||||
pattern = cairo_pattern_create_radial (x2, y2, 0,
|
||||
x2, y2, radius);
|
||||
x2, y2, radius);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x2, y2,
|
||||
x3 - x2, y3 - y2);
|
||||
x2, y2,
|
||||
x3 - x2, y3 - y2);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ draw_callback (GtkWidget *widget,
|
||||
rect.height -= SHADOW_OFFSET_Y;
|
||||
|
||||
draw_shadow_box (cr,
|
||||
rect, SHADOW_RADIUS, 0.4);
|
||||
|
||||
rect, SHADOW_RADIUS, 0.4);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ do_transparent (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transparent");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transparency");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
view = gtk_text_view_new ();
|
||||
@@ -230,7 +230,6 @@ do_transparent (GtkWidget *do_widget)
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_START);
|
||||
|
||||
|
||||
gtk_widget_show_all (overlay);
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ do_tree_store (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Card planning sheet");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Tree Store");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
|
||||
@@ -1124,6 +1124,108 @@ page_combo_separator_func (GtkTreeModel *model,
|
||||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
activate_item (GtkWidget *item, GtkTextView *tv)
|
||||
{
|
||||
const gchar *tag;
|
||||
GtkTextIter start, end;
|
||||
gboolean active;
|
||||
|
||||
g_object_get (item, "active", &active, NULL);
|
||||
tag = (const gchar *)g_object_get_data (G_OBJECT (item), "tag");
|
||||
gtk_text_buffer_get_selection_bounds (gtk_text_view_get_buffer (tv), &start, &end);
|
||||
if (active)
|
||||
gtk_text_buffer_apply_tag_by_name (gtk_text_view_get_buffer (tv), tag, &start, &end);
|
||||
else
|
||||
gtk_text_buffer_remove_tag_by_name (gtk_text_view_get_buffer (tv), tag, &start, &end);
|
||||
}
|
||||
|
||||
static void
|
||||
add_item (GtkTextView *tv,
|
||||
GtkWidget *popup,
|
||||
const gchar *text,
|
||||
const gchar *tag,
|
||||
gboolean set)
|
||||
{
|
||||
GtkWidget *item, *label;
|
||||
|
||||
if (GTK_IS_MENU (popup))
|
||||
{
|
||||
item = gtk_check_menu_item_new ();
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), set);
|
||||
g_signal_connect (item, "toggled", G_CALLBACK (activate_item), tv);
|
||||
}
|
||||
else
|
||||
{
|
||||
item = gtk_check_button_new ();
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), set);
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (item), FALSE);
|
||||
g_signal_connect (item, "clicked", G_CALLBACK (activate_item), tv);
|
||||
}
|
||||
|
||||
label = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_label_set_markup (GTK_LABEL (label), text);
|
||||
gtk_widget_show (label);
|
||||
gtk_container_add (GTK_CONTAINER (item), label);
|
||||
g_object_set_data (G_OBJECT (item), "tag", (gpointer)tag);
|
||||
gtk_widget_show (item);
|
||||
gtk_container_add (GTK_CONTAINER (popup), item);
|
||||
}
|
||||
|
||||
static void
|
||||
populate_popup (GtkTextView *tv,
|
||||
GtkWidget *popup)
|
||||
{
|
||||
gboolean has_selection;
|
||||
GtkWidget *item;
|
||||
GtkTextIter start, end, iter;
|
||||
GtkTextTagTable *tags;
|
||||
GtkTextTag *bold, *italic, *underline;
|
||||
gboolean all_bold, all_italic, all_underline;
|
||||
|
||||
has_selection = gtk_text_buffer_get_selection_bounds (gtk_text_view_get_buffer (tv), &start, &end);
|
||||
|
||||
if (!has_selection)
|
||||
return;
|
||||
|
||||
tags = gtk_text_buffer_get_tag_table (gtk_text_view_get_buffer (tv));
|
||||
bold = gtk_text_tag_table_lookup (tags, "bold");
|
||||
italic = gtk_text_tag_table_lookup (tags, "italic");
|
||||
underline = gtk_text_tag_table_lookup (tags, "underline");
|
||||
all_bold = TRUE;
|
||||
all_italic = TRUE;
|
||||
all_underline = TRUE;
|
||||
gtk_text_iter_assign (&iter, &start);
|
||||
while (!gtk_text_iter_equal (&iter, &end))
|
||||
{
|
||||
all_bold &= gtk_text_iter_has_tag (&iter, bold);
|
||||
all_italic &= gtk_text_iter_has_tag (&iter, italic);
|
||||
all_underline &= gtk_text_iter_has_tag (&iter, underline);
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
}
|
||||
|
||||
if (GTK_IS_MENU (popup))
|
||||
{
|
||||
item = gtk_separator_menu_item_new ();
|
||||
gtk_widget_show (item);
|
||||
gtk_container_add (GTK_CONTAINER (popup), item);
|
||||
}
|
||||
|
||||
add_item (tv, popup, "<b>Bold</b>", "bold", all_bold);
|
||||
add_item (tv, popup, "<i>Italics</i>", "italic", all_italic);
|
||||
add_item (tv, popup, "<u>Underline</u>", "underline", all_underline);
|
||||
}
|
||||
|
||||
static void
|
||||
open_popover_text_changed (GtkEntry *entry, GParamSpec *pspec, GtkWidget *button)
|
||||
{
|
||||
const gchar *text;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
gtk_widget_set_sensitive (button, strlen (text) > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
@@ -1262,6 +1364,8 @@ activate (GApplication *app)
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (close_dialog), NULL);
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "preference_dialog_button");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (show_dialog), dialog);
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "circular_button");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (show_dialog), dialog);
|
||||
|
||||
dialog = (GtkWidget *)gtk_builder_get_object (builder, "selection_dialog");
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "text3");
|
||||
@@ -1327,6 +1431,17 @@ activate (GApplication *app)
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "totem_like_osd");
|
||||
g_object_set_data (G_OBJECT (widget), "osd", widget2);
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "textview1");
|
||||
g_signal_connect (widget, "populate-popup",
|
||||
G_CALLBACK (populate_popup), NULL);
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "open_popover");
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "open_popover_entry");
|
||||
widget3 = (GtkWidget *)gtk_builder_get_object (builder, "open_popover_button");
|
||||
gtk_popover_set_default_widget (GTK_POPOVER (widget), widget3);
|
||||
g_signal_connect (widget2, "notify::text", G_CALLBACK (open_popover_text_changed), widget3);
|
||||
g_signal_connect_swapped (widget3, "clicked", G_CALLBACK (gtk_widget_hide), widget);
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET (window));
|
||||
|
||||
g_object_unref (builder);
|
||||
|
||||
@@ -162,7 +162,28 @@
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkTextTagTable" id="tags">
|
||||
<child type="tag">
|
||||
<object class="GtkTextTag">
|
||||
<property name="name">bold</property>
|
||||
<property name="weight">800</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tag">
|
||||
<object class="GtkTextTag">
|
||||
<property name="name">italic</property>
|
||||
<property name="style">italic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tag">
|
||||
<object class="GtkTextTag">
|
||||
<property name="name">underline</property>
|
||||
<property name="underline">single</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkTextBuffer" id="textbuffer1">
|
||||
<property name="tag-table">tags</property>
|
||||
<property name="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
Nullam fringilla, est ut feugiat ultrices, elit lacus ultricies nibh, id commodo tortor nisi id elit.
|
||||
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
|
||||
@@ -1408,6 +1429,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="wrap_mode">2</property>
|
||||
<property name="left_margin">10</property>
|
||||
<property name="right_margin">10</property>
|
||||
<property name="populate_all">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2871,9 +2893,10 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<object class="GtkMenuButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="popover">open_popover</property>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
<class name="image-button"/>
|
||||
@@ -2976,7 +2999,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<object class="GtkButton" id="circular_button">
|
||||
<property name="visible">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
@@ -3561,10 +3584,56 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner">
|
||||
<object class="GtkSeparator">
|
||||
<property name="visible">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="placeholder_text" translatable="yes">Name…</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="placeholder_text" translatable="yes">Age…</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner">
|
||||
<property name="visible">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="expand">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -3816,6 +3885,86 @@ bad things might happen.</property>
|
||||
<action-widget response="ok" default="true">select_selection_dialog</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkPopover" id="open_popover">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="column-spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Title:</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="valign">start</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Description:</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="valign">start</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<property name="min-content-height">70</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="open_popover_textview">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="open_popover_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="activates-default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="open_popover_button">
|
||||
<property name="halign">end</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Open</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can-default">True</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkSizeGroup">
|
||||
<property name="mode">vertical</property>
|
||||
<widgets>
|
||||
|
||||
@@ -129,6 +129,7 @@ IGNORE_HFILES = \
|
||||
gtkmountoperationprivate.h \
|
||||
gtkorientableprivate.h \
|
||||
gtkpixelcacheprivate.h \
|
||||
gtkplacessidebarprivate.h \
|
||||
gtkpopoverprivate.h \
|
||||
gtkprinter-private.h \
|
||||
gtkprintoperation-private.h \
|
||||
@@ -144,6 +145,7 @@ IGNORE_HFILES = \
|
||||
gtksearchentryprivate.h \
|
||||
gtkselectionprivate.h \
|
||||
gtksettingsprivate.h \
|
||||
gtksidebarrowprivate.h \
|
||||
gtksizegroup-private.h \
|
||||
gtksizerequestcacheprivate.h \
|
||||
gtksocketprivate.h \
|
||||
|
||||
@@ -381,6 +381,8 @@ gtk_assistant_set_page_side_image
|
||||
gtk_assistant_get_page_side_image
|
||||
gtk_assistant_set_page_complete
|
||||
gtk_assistant_get_page_complete
|
||||
gtk_assistant_set_page_has_padding
|
||||
gtk_assistant_get_page_has_padding
|
||||
gtk_assistant_add_action_widget
|
||||
gtk_assistant_remove_action_widget
|
||||
gtk_assistant_update_buttons_state
|
||||
@@ -2638,6 +2640,8 @@ gtk_places_sidebar_set_open_flags
|
||||
gtk_places_sidebar_get_open_flags
|
||||
gtk_places_sidebar_set_location
|
||||
gtk_places_sidebar_get_location
|
||||
gtk_places_sidebar_set_show_recent
|
||||
gtk_places_sidebar_get_show_recent
|
||||
gtk_places_sidebar_set_show_desktop
|
||||
gtk_places_sidebar_get_show_desktop
|
||||
gtk_places_sidebar_add_shortcut
|
||||
@@ -2650,6 +2654,7 @@ gtk_places_sidebar_get_local_only
|
||||
gtk_places_sidebar_set_local_only
|
||||
gtk_places_sidebar_get_show_enter_location
|
||||
gtk_places_sidebar_set_show_enter_location
|
||||
gtk_places_sidebar_set_drop_targets_visible
|
||||
<SUBSECTION Standard>
|
||||
GTK_PLACES_SIDEBAR
|
||||
GTK_IS_PLACES_SIDEBAR
|
||||
@@ -7768,6 +7773,9 @@ GtkOverlayClass
|
||||
|
||||
gtk_overlay_new
|
||||
gtk_overlay_add_overlay
|
||||
gtk_overlay_reorder_overlay
|
||||
gtk_overlay_get_overlay_pass_through
|
||||
gtk_overlay_set_overlay_pass_through
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_OVERLAY
|
||||
|
||||
@@ -392,7 +392,7 @@ broadway_buffer_encode (BroadwayBuffer *buffer, BroadwayBuffer *prev, GString *d
|
||||
hash = 0;
|
||||
for (j = x0; j < MIN(x1, x0 + block_size); j++)
|
||||
hash = hash * prime + line[j];
|
||||
for (j = j; j < x0 + block_size; j++)
|
||||
for (; j < x0 + block_size; j++)
|
||||
hash = hash * prime;
|
||||
|
||||
for (j = x0; j < x1; j++)
|
||||
@@ -405,7 +405,7 @@ broadway_buffer_encode (BroadwayBuffer *buffer, BroadwayBuffer *prev, GString *d
|
||||
}
|
||||
}
|
||||
// Do the last rows if height < block_size
|
||||
for (i = i; i < y0 + block_size; i++)
|
||||
for (; i < y0 + block_size; i++)
|
||||
{
|
||||
for (j = x0; j < x1; j++)
|
||||
block_hashes[j] = block_hashes[j] * vprime;
|
||||
|
||||
@@ -825,19 +825,31 @@ map_named_shm (char *name, gsize size)
|
||||
|
||||
int fd;
|
||||
void *ptr;
|
||||
char *filename = NULL;
|
||||
|
||||
fd = shm_open(name, O_RDONLY, 0600);
|
||||
if (fd == -1)
|
||||
{
|
||||
perror ("Failed to shm_open");
|
||||
return NULL;
|
||||
filename = g_build_filename (g_get_tmp_dir (), name, NULL);
|
||||
fd = open (filename, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
perror ("Failed to map shm");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ptr = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
|
||||
(void) close(fd);
|
||||
|
||||
shm_unlink (name);
|
||||
if (filename)
|
||||
{
|
||||
unlink (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
else
|
||||
shm_unlink (name);
|
||||
|
||||
return ptr;
|
||||
|
||||
|
||||
@@ -524,10 +524,11 @@ _gdk_broadway_server_window_set_transient_for (GdkBroadwayServer *server,
|
||||
}
|
||||
|
||||
static void *
|
||||
map_named_shm (char *name, gsize size)
|
||||
map_named_shm (char *name, gsize size, gboolean *is_shm)
|
||||
{
|
||||
#ifdef G_OS_UNIX
|
||||
|
||||
char *filename = NULL;
|
||||
int fd;
|
||||
void *ptr;
|
||||
int res;
|
||||
@@ -535,10 +536,24 @@ map_named_shm (char *name, gsize size)
|
||||
fd = shm_open(name, O_RDWR|O_CREAT|O_EXCL, 0600);
|
||||
if (fd == -1)
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
g_error ("Unable to allocate shared mem for window");
|
||||
return NULL;
|
||||
if (errno == EEXIST)
|
||||
return NULL;
|
||||
|
||||
filename = g_build_filename (g_get_tmp_dir (), name, NULL);
|
||||
|
||||
fd = open (filename, O_RDWR | O_CREAT | O_EXCL, 0600);
|
||||
g_free (filename);
|
||||
if (fd == -1)
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
g_error ("Unable to allocate shared mem for window");
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
*is_shm = FALSE;
|
||||
}
|
||||
else
|
||||
*is_shm = TRUE;
|
||||
|
||||
res = ftruncate (fd, size);
|
||||
g_assert (res != -1);
|
||||
@@ -547,7 +562,10 @@ map_named_shm (char *name, gsize size)
|
||||
res = posix_fallocate (fd, 0, size);
|
||||
if (res != 0 && errno == ENOSPC)
|
||||
{
|
||||
shm_unlink (name);
|
||||
if (filename)
|
||||
unlink (filename);
|
||||
else
|
||||
shm_unlink (name);
|
||||
g_error ("Not enough shared memory for window surface");
|
||||
}
|
||||
#endif
|
||||
@@ -579,6 +597,7 @@ map_named_shm (char *name, gsize size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*is_shm = TRUE;
|
||||
res = ftruncate (fd, size);
|
||||
g_assert (res != -1);
|
||||
|
||||
@@ -614,7 +633,7 @@ make_valid_fs_char (char c)
|
||||
|
||||
/* name must have at least space for 34 bytes */
|
||||
static gpointer
|
||||
create_random_shm (char *name, gsize size)
|
||||
create_random_shm (char *name, gsize size, gboolean *is_shm)
|
||||
{
|
||||
guint32 r;
|
||||
int i, o;
|
||||
@@ -638,7 +657,7 @@ create_random_shm (char *name, gsize size)
|
||||
}
|
||||
name[o++] = 0;
|
||||
|
||||
ptr = map_named_shm (name, size);
|
||||
ptr = map_named_shm (name, size, is_shm);
|
||||
if (ptr)
|
||||
return ptr;
|
||||
}
|
||||
@@ -650,6 +669,7 @@ typedef struct {
|
||||
char name[36];
|
||||
void *data;
|
||||
gsize data_size;
|
||||
gboolean is_shm;
|
||||
} BroadwayShmSurfaceData;
|
||||
|
||||
static void
|
||||
@@ -660,7 +680,14 @@ shm_data_destroy (void *_data)
|
||||
#ifdef G_OS_UNIX
|
||||
|
||||
munmap (data->data, data->data_size);
|
||||
shm_unlink (data->name);
|
||||
if (data->is_shm)
|
||||
shm_unlink (data->name);
|
||||
else
|
||||
{
|
||||
char *filename = g_build_filename (g_get_tmp_dir (), data->name, NULL);
|
||||
unlink (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
#elif defined(G_OS_WIN32)
|
||||
|
||||
@@ -689,7 +716,7 @@ _gdk_broadway_server_create_surface (int width,
|
||||
|
||||
data = g_new (BroadwayShmSurfaceData, 1);
|
||||
data->data_size = width * height * sizeof (guint32);
|
||||
data->data = create_random_shm (data->name, data->data_size);
|
||||
data->data = create_random_shm (data->name, data->data_size, &data->is_shm);
|
||||
|
||||
surface = cairo_image_surface_create_for_data ((guchar *)data->data,
|
||||
CAIRO_FORMAT_ARGB32, width, height, width * sizeof (guint32));
|
||||
|
||||
@@ -314,6 +314,7 @@ struct _GdkWindow
|
||||
guint8 fullscreen_mode;
|
||||
|
||||
guint input_only : 1;
|
||||
guint pass_through : 1;
|
||||
guint modal_hint : 1;
|
||||
guint composited : 1;
|
||||
guint has_alpha_background : 1;
|
||||
|
||||
+139
-7
@@ -198,8 +198,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
static const cairo_user_data_key_t gdk_window_cairo_key;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (GdkWindow, gdk_window, G_TYPE_OBJECT)
|
||||
|
||||
#ifdef DEBUG_WINDOW_PRINTING
|
||||
@@ -5979,10 +5977,25 @@ gdk_window_set_background_rgba (GdkWindow *window,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
GdkRGBA prev_rgba;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
g_return_if_fail (rgba != NULL);
|
||||
|
||||
/*
|
||||
* If the new RGBA matches the previous pattern, ignore the change so that
|
||||
* we do not invalidate the window contents.
|
||||
*/
|
||||
if ((window->background != NULL) &&
|
||||
(cairo_pattern_get_type (window->background) == CAIRO_PATTERN_TYPE_SOLID) &&
|
||||
(cairo_pattern_get_rgba (window->background,
|
||||
&prev_rgba.red,
|
||||
&prev_rgba.green,
|
||||
&prev_rgba.blue,
|
||||
&prev_rgba.alpha) == CAIRO_STATUS_SUCCESS) &&
|
||||
gdk_rgba_equal (&prev_rgba, rgba))
|
||||
return;
|
||||
|
||||
pattern = cairo_pattern_create_rgba (rgba->red, rgba->green,
|
||||
rgba->blue, rgba->alpha);
|
||||
|
||||
@@ -6786,6 +6799,63 @@ gdk_window_set_child_input_shapes (GdkWindow *window)
|
||||
do_child_input_shapes (window, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_set_pass_through:
|
||||
* @window: a #GdkWindow
|
||||
* @pass_through: a boolean
|
||||
*
|
||||
* Sets whether input to the window is passed through to the window
|
||||
* below.
|
||||
*
|
||||
* The default value of this is %FALSE, which means that pointer
|
||||
* events that happen inside the window are send first to the window,
|
||||
* but if the event is not selected by the event mask then the event
|
||||
* is sent to the parent window, and so on up the hierarchy.
|
||||
*
|
||||
* If @pass_through is %TRUE then such pointer events happen as if the
|
||||
* window wasn't there at all, and thus will be sent first to any
|
||||
* windows below @window. This is useful if the window is used in a
|
||||
* transparent fashion. In the terminology of the web this would be called
|
||||
* "pointer-events: none".
|
||||
*
|
||||
* Note that a window with @pass_through %TRUE can still have a subwindow
|
||||
* without pass through, so you can get events on a subset of a window. And in
|
||||
* that cases you would get the in-between related events such as the pointer
|
||||
* enter/leave events on its way to the destination window.
|
||||
*
|
||||
* Since: 3.18
|
||||
**/
|
||||
void
|
||||
gdk_window_set_pass_through (GdkWindow *window,
|
||||
gboolean pass_through)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
window->pass_through = !!pass_through;
|
||||
|
||||
/* Pointer may have e.g. moved outside window due to the input region change */
|
||||
_gdk_synthesize_crossing_events_for_geometry_change (window);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_get_pass_through:
|
||||
* @window: a #GdkWindow
|
||||
*
|
||||
* Returns whether input to the window is passed through to the window
|
||||
* below.
|
||||
*
|
||||
* See gdk_window_set_pass_through() for details
|
||||
*
|
||||
* Since: 3.18
|
||||
**/
|
||||
gboolean
|
||||
gdk_window_get_pass_through (GdkWindow *window)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
||||
|
||||
return window->pass_through;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_merge_child_input_shapes:
|
||||
* @window: a #GdkWindow
|
||||
@@ -7135,6 +7205,63 @@ point_in_window (GdkWindow *window,
|
||||
x, y));
|
||||
}
|
||||
|
||||
/* Same as point_in_window, except it also takes pass_through and its
|
||||
interaction with child windows into account */
|
||||
static gboolean
|
||||
point_in_input_window (GdkWindow *window,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GdkWindow **input_window,
|
||||
gdouble *input_window_x,
|
||||
gdouble *input_window_y)
|
||||
{
|
||||
GdkWindow *sub;
|
||||
double child_x, child_y;
|
||||
GList *l;
|
||||
|
||||
if (!point_in_window (window, x, y))
|
||||
return FALSE;
|
||||
|
||||
if (!window->pass_through)
|
||||
{
|
||||
if (input_window)
|
||||
{
|
||||
*input_window = window;
|
||||
*input_window_x = x;
|
||||
*input_window_y = y;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* For pass-through, must be over a child input window */
|
||||
|
||||
/* Children is ordered in reverse stack order, i.e. first is topmost */
|
||||
for (l = window->children; l != NULL; l = l->next)
|
||||
{
|
||||
sub = l->data;
|
||||
|
||||
if (!GDK_WINDOW_IS_MAPPED (sub))
|
||||
continue;
|
||||
|
||||
gdk_window_coords_from_parent ((GdkWindow *)sub,
|
||||
x, y,
|
||||
&child_x, &child_y);
|
||||
if (point_in_input_window (sub, child_x, child_y,
|
||||
input_window, input_window_x, input_window_y))
|
||||
{
|
||||
if (input_window)
|
||||
gdk_window_coords_to_parent (sub,
|
||||
*input_window_x,
|
||||
*input_window_y,
|
||||
input_window_x,
|
||||
input_window_y);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
convert_native_coords_to_toplevel (GdkWindow *window,
|
||||
gdouble child_x,
|
||||
@@ -7228,7 +7355,8 @@ _gdk_window_find_child_at (GdkWindow *window,
|
||||
gdk_window_coords_from_parent ((GdkWindow *)sub,
|
||||
x, y,
|
||||
&child_x, &child_y);
|
||||
if (point_in_window (sub, child_x, child_y))
|
||||
if (point_in_input_window (sub, child_x, child_y,
|
||||
NULL, NULL, NULL))
|
||||
return (GdkWindow *)sub;
|
||||
}
|
||||
|
||||
@@ -7251,7 +7379,7 @@ _gdk_window_find_descendant_at (GdkWindow *window,
|
||||
gdouble *found_x,
|
||||
gdouble *found_y)
|
||||
{
|
||||
GdkWindow *sub;
|
||||
GdkWindow *sub, *input_window;
|
||||
gdouble child_x, child_y;
|
||||
GList *l;
|
||||
gboolean found;
|
||||
@@ -7272,11 +7400,12 @@ _gdk_window_find_descendant_at (GdkWindow *window,
|
||||
gdk_window_coords_from_parent ((GdkWindow *)sub,
|
||||
x, y,
|
||||
&child_x, &child_y);
|
||||
if (point_in_window (sub, child_x, child_y))
|
||||
if (point_in_input_window (sub, child_x, child_y,
|
||||
&input_window, &child_x, &child_y))
|
||||
{
|
||||
x = child_x;
|
||||
y = child_y;
|
||||
window = sub;
|
||||
window = input_window;
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -11084,7 +11213,10 @@ gdk_window_get_unscaled_size (GdkWindow *window,
|
||||
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
|
||||
|
||||
if (impl_class->get_unscaled_size)
|
||||
return impl_class->get_unscaled_size (window, unscaled_width, unscaled_height);
|
||||
{
|
||||
impl_class->get_unscaled_size (window, unscaled_width, unscaled_height);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
scale = gdk_window_get_scale_factor (window);
|
||||
|
||||
@@ -654,6 +654,12 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_merge_child_input_shapes (GdkWindow *window);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_3_18
|
||||
void gdk_window_set_pass_through (GdkWindow *window,
|
||||
gboolean pass_through);
|
||||
GDK_AVAILABLE_IN_3_18
|
||||
gboolean gdk_window_get_pass_through (GdkWindow *window);
|
||||
|
||||
/*
|
||||
* Check if a window has been shown, and whether all its
|
||||
* parents up to a toplevel have been shown, respectively.
|
||||
|
||||
@@ -184,8 +184,26 @@ _gdk_mir_print_close_event (const MirCloseSurfaceEvent *event)
|
||||
void
|
||||
_gdk_mir_print_event (const MirEvent *event)
|
||||
{
|
||||
const MirInputEvent *input_event;
|
||||
|
||||
switch (mir_event_get_type (event))
|
||||
{
|
||||
case mir_event_type_input:
|
||||
input_event = mir_event_get_input_event (event);
|
||||
|
||||
switch (mir_input_event_get_type (input_event))
|
||||
{
|
||||
case mir_input_event_type_key:
|
||||
_gdk_mir_print_key_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
case mir_input_event_type_touch:
|
||||
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
case mir_input_event_type_pointer:
|
||||
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case mir_event_type_key:
|
||||
_gdk_mir_print_key_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
|
||||
@@ -133,16 +133,4 @@ void _gdk_mir_print_resize_event (const MirResizeEvent *event);
|
||||
|
||||
void _gdk_mir_print_event (const MirEvent *event);
|
||||
|
||||
/* TODO: Remove once we have proper transient window support. */
|
||||
GdkWindow * _gdk_mir_window_get_visible_transient_child (GdkWindow *window,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble *out_x,
|
||||
gdouble *out_y);
|
||||
|
||||
/* TODO: Remove once we have proper transient window support. */
|
||||
void _gdk_mir_window_transient_children_foreach (GdkWindow *window,
|
||||
void (*func) (GdkWindow *, gpointer),
|
||||
gpointer user_data);
|
||||
|
||||
#endif /* __GDK_PRIVATE_MIR_H__ */
|
||||
|
||||
+36
-36
@@ -107,7 +107,7 @@ _gdk_mir_display_open (const gchar *display_name)
|
||||
MirPixelFormat sw_pixel_format, hw_pixel_format;
|
||||
GdkMirDisplay *display;
|
||||
|
||||
g_printerr ("gdk_mir_display_open\n");
|
||||
//g_printerr ("gdk_mir_display_open\n");
|
||||
|
||||
connection = mir_connect_sync (NULL, "GDK-Mir");
|
||||
if (!connection)
|
||||
@@ -207,26 +207,26 @@ gdk_mir_display_get_default_screen (GdkDisplay *display)
|
||||
static void
|
||||
gdk_mir_display_beep (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_beep\n");
|
||||
//g_printerr ("gdk_mir_display_beep\n");
|
||||
/* No system level beep... */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_sync (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_sync\n");
|
||||
//g_printerr ("gdk_mir_display_sync\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_flush (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_flush\n");
|
||||
//g_printerr ("gdk_mir_display_flush\n");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_has_pending (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_has_pending\n");
|
||||
//g_printerr ("gdk_mir_display_has_pending\n");
|
||||
/* We don't need to poll for events - so nothing pending */
|
||||
return FALSE;
|
||||
}
|
||||
@@ -247,14 +247,14 @@ gdk_mir_display_make_default (GdkDisplay *display)
|
||||
static GdkWindow *
|
||||
gdk_mir_display_get_default_group (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_default_group\n");
|
||||
//g_printerr ("gdk_mir_display_get_default_group\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_shapes\n");
|
||||
//g_printerr ("gdk_mir_display_supports_shapes\n");
|
||||
/* Mir doesn't support shaped windows */
|
||||
return FALSE;
|
||||
}
|
||||
@@ -262,42 +262,42 @@ gdk_mir_display_supports_shapes (GdkDisplay *display)
|
||||
static gboolean
|
||||
gdk_mir_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_input_shapes\n");
|
||||
//g_printerr ("gdk_mir_display_supports_input_shapes\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_composite (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_composite\n");
|
||||
//g_printerr ("gdk_mir_display_supports_composite\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_clipboard_persistence (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_clipboard_persistence\n");
|
||||
//g_printerr ("gdk_mir_display_supports_clipboard_persistence\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_cursor_alpha (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_cursor_alpha\n");
|
||||
//g_printerr ("gdk_mir_display_supports_cursor_alpha\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_cursor_color (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_cursor_color\n");
|
||||
//g_printerr ("gdk_mir_display_supports_cursor_color\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_selection_notification (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_selection_notification\n");
|
||||
//g_printerr ("gdk_mir_display_supports_selection_notification\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ static gboolean
|
||||
gdk_mir_display_request_selection_notification (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_request_selection_notification\n");
|
||||
//g_printerr ("gdk_mir_display_request_selection_notification\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ gdk_mir_display_store_clipboard (GdkDisplay *display,
|
||||
const GdkAtom *targets,
|
||||
gint n_targets)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_store_clipboard\n");
|
||||
//g_printerr ("gdk_mir_display_store_clipboard\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -324,7 +324,7 @@ gdk_mir_display_get_default_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_default_cursor_size\n");
|
||||
//g_printerr ("gdk_mir_display_get_default_cursor_size\n");
|
||||
*width = *height = 32; // FIXME: Random value
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ gdk_mir_display_get_maximal_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_maximal_cursor_size\n");
|
||||
//g_printerr ("gdk_mir_display_get_maximal_cursor_size\n");
|
||||
*width = *height = 32; // FIXME: Random value
|
||||
}
|
||||
|
||||
@@ -357,14 +357,14 @@ gdk_mir_display_get_cursor_for_surface (GdkDisplay *display,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_cursor_for_surface (%f, %f)\n", x, y);
|
||||
//g_printerr ("gdk_mir_display_get_cursor_for_surface (%f, %f)\n", x, y);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_mir_display_list_devices (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_list_devices\n");
|
||||
//g_printerr ("gdk_mir_display_list_devices\n");
|
||||
// FIXME: Should this access the device manager?
|
||||
return NULL;
|
||||
}
|
||||
@@ -372,20 +372,20 @@ gdk_mir_display_list_devices (GdkDisplay *display)
|
||||
static GdkAppLaunchContext *
|
||||
gdk_mir_display_get_app_launch_context (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_app_launch_context\n");
|
||||
//g_printerr ("gdk_mir_display_get_app_launch_context\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_before_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_before_process_all_updates\n");
|
||||
//g_printerr ("gdk_mir_display_before_process_all_updates\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_after_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_after_process_all_updates\n");
|
||||
//g_printerr ("gdk_mir_display_after_process_all_updates\n");
|
||||
}
|
||||
|
||||
static gulong
|
||||
@@ -411,11 +411,11 @@ gdk_mir_display_create_window_impl (GdkDisplay *display,
|
||||
GdkWindowAttr *attributes,
|
||||
gint attributes_mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_create_window_impl");
|
||||
g_printerr (" window=%p", window);
|
||||
g_printerr (" location=(%d, %d)", window->x, window->y);
|
||||
g_printerr (" size=(%d, %d)", window->width, window->height);
|
||||
g_printerr ("\n");
|
||||
//g_printerr ("gdk_mir_display_create_window_impl");
|
||||
//g_printerr (" window=%p", window);
|
||||
//g_printerr (" location=(%d, %d)", window->x, window->y);
|
||||
//g_printerr (" size=(%d, %d)", window->width, window->height);
|
||||
//g_printerr ("\n");
|
||||
|
||||
if (attributes->wclass == GDK_INPUT_OUTPUT)
|
||||
{
|
||||
@@ -442,14 +442,14 @@ gdk_mir_display_get_keymap (GdkDisplay *display)
|
||||
static void
|
||||
gdk_mir_display_push_error_trap (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_push_error_trap\n");
|
||||
//g_printerr ("gdk_mir_display_push_error_trap\n");
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_display_pop_error_trap (GdkDisplay *display,
|
||||
gboolean ignored)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_pop_error_trap\n");
|
||||
//g_printerr ("gdk_mir_display_pop_error_trap\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ static GdkWindow *
|
||||
gdk_mir_display_get_selection_owner (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_selection_owner\n");
|
||||
//g_printerr ("gdk_mir_display_get_selection_owner\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ gdk_mir_display_set_selection_owner (GdkDisplay *display,
|
||||
guint32 time,
|
||||
gboolean send_event)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_set_selection_owner\n");
|
||||
//g_printerr ("gdk_mir_display_set_selection_owner\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ gdk_mir_display_send_selection_notify (GdkDisplay *display,
|
||||
GdkAtom property,
|
||||
guint32 time)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_send_selection_notify\n");
|
||||
//g_printerr ("gdk_mir_display_send_selection_notify\n");
|
||||
}
|
||||
|
||||
static gint
|
||||
@@ -490,7 +490,7 @@ gdk_mir_display_get_selection_property (GdkDisplay *display,
|
||||
GdkAtom *ret_type,
|
||||
gint *ret_format)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_selection_property\n");
|
||||
//g_printerr ("gdk_mir_display_get_selection_property\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
|
||||
GdkAtom target,
|
||||
guint32 time)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_convert_selection\n");
|
||||
//g_printerr ("gdk_mir_display_convert_selection\n");
|
||||
}
|
||||
|
||||
static gint
|
||||
@@ -512,7 +512,7 @@ gdk_mir_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
gint length,
|
||||
gchar ***list)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_text_property_to_utf8_list\n");
|
||||
//g_printerr ("gdk_mir_display_text_property_to_utf8_list\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ static gchar *
|
||||
gdk_mir_display_utf8_to_string_target (GdkDisplay *display,
|
||||
const gchar *str)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_utf8_to_string_target\n");
|
||||
//g_printerr ("gdk_mir_display_utf8_to_string_target\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+53
-89
@@ -308,47 +308,6 @@ handle_key_event (GdkWindow *window, const MirInputEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Remove once we have proper transient window support. */
|
||||
typedef struct
|
||||
{
|
||||
GdkWindow *except;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
guint32 time;
|
||||
} LeaveInfo;
|
||||
|
||||
/* TODO: Remove once we have proper transient window support. */
|
||||
/*
|
||||
* leave_windows_except:
|
||||
*
|
||||
* Generate a leave event for every window except the one the cursor is in.
|
||||
*/
|
||||
static void
|
||||
leave_windows_except (GdkWindow *window,
|
||||
gpointer user_data)
|
||||
{
|
||||
LeaveInfo info = *((LeaveInfo *) user_data);
|
||||
|
||||
info.x -= window->x;
|
||||
info.y -= window->y;
|
||||
|
||||
_gdk_mir_window_transient_children_foreach (window, leave_windows_except, &info);
|
||||
|
||||
if (window != info.except)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
gboolean cursor_inside;
|
||||
guint button_state;
|
||||
|
||||
_gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, &cursor_inside, &button_state);
|
||||
|
||||
if (cursor_inside)
|
||||
generate_crossing_event (window, GDK_LEAVE_NOTIFY, info.x, info.y, info.time);
|
||||
|
||||
_gdk_mir_window_impl_set_cursor_state (impl, info.x, info.y, FALSE, button_state);
|
||||
}
|
||||
}
|
||||
|
||||
static guint
|
||||
mir_pointer_event_get_button_state (const MirPointerEvent *event)
|
||||
{
|
||||
@@ -388,49 +347,6 @@ handle_motion_event (GdkWindow *window, const MirInputEvent *event)
|
||||
modifier_state = get_modifier_state (mir_pointer_event_modifiers (pointer_event), mir_pointer_event_get_button_state (pointer_event));
|
||||
event_time = NANO_TO_MILLI (mir_input_event_get_event_time (event));
|
||||
|
||||
/* TODO: Remove once we have proper transient window support. */
|
||||
if (mir_pointer_event_action (pointer_event) == mir_pointer_action_leave)
|
||||
{
|
||||
LeaveInfo info;
|
||||
|
||||
info.x = x;
|
||||
info.y = y;
|
||||
info.time = event_time;
|
||||
info.except = window;
|
||||
|
||||
/* Leave all transient children from leaf to root, except the root since we do it later. */
|
||||
_gdk_mir_window_transient_children_foreach (window, leave_windows_except, &info);
|
||||
}
|
||||
else
|
||||
{
|
||||
LeaveInfo info;
|
||||
|
||||
info.x = x;
|
||||
info.y = y;
|
||||
info.time = event_time;
|
||||
info.except = _gdk_mir_window_get_visible_transient_child (window, x, y, &x, &y);
|
||||
|
||||
/* Leave all transient children from leaf to root, except the pointer window since we enter it. */
|
||||
_gdk_mir_window_transient_children_foreach (window, leave_windows_except, &info);
|
||||
|
||||
window = info.except;
|
||||
|
||||
if (window)
|
||||
{
|
||||
/* Enter the pointer window. */
|
||||
gboolean cursor_inside_pointer_window;
|
||||
|
||||
impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
_gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, &cursor_inside_pointer_window, NULL);
|
||||
|
||||
if (!cursor_inside_pointer_window)
|
||||
{
|
||||
generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, event_time);
|
||||
_gdk_mir_window_impl_set_cursor_state (impl, x, y, TRUE, mir_pointer_event_get_button_state (pointer_event));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (window)
|
||||
{
|
||||
gdouble new_x;
|
||||
@@ -460,12 +376,23 @@ handle_motion_event (GdkWindow *window, const MirInputEvent *event)
|
||||
hscroll = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_hscroll);
|
||||
vscroll = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_vscroll);
|
||||
|
||||
if (hscroll > 0.5 || vscroll > 0.5)
|
||||
if (ABS (hscroll) > 0.5 || ABS (vscroll) > 0.5)
|
||||
generate_scroll_event (window, x, y, hscroll, vscroll, modifier_state, event_time);
|
||||
if (ABS (new_x - x) > 0.5 || ABS (new_y - y) > 0.5)
|
||||
generate_motion_event (window, new_x, new_y, modifier_state, event_time);
|
||||
{
|
||||
generate_motion_event (window, new_x, new_y, modifier_state, event_time);
|
||||
x = new_x;
|
||||
y = new_y;
|
||||
}
|
||||
|
||||
break;
|
||||
case mir_pointer_action_enter:
|
||||
if (!cursor_inside)
|
||||
{
|
||||
cursor_inside = TRUE;
|
||||
generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, event_time);
|
||||
}
|
||||
break;
|
||||
case mir_pointer_action_leave:
|
||||
if (cursor_inside)
|
||||
{
|
||||
@@ -485,6 +412,7 @@ static void
|
||||
handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
MirSurfaceState state;
|
||||
|
||||
switch (mir_surface_event_get_attribute (event))
|
||||
{
|
||||
@@ -492,8 +420,43 @@ handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
|
||||
_gdk_mir_window_impl_set_surface_type (impl, mir_surface_event_get_attribute_value (event));
|
||||
break;
|
||||
case mir_surface_attrib_state:
|
||||
_gdk_mir_window_impl_set_surface_state (impl, mir_surface_event_get_attribute_value (event));
|
||||
// FIXME: notify
|
||||
state = mir_surface_event_get_attribute_value (event);
|
||||
_gdk_mir_window_impl_set_surface_state (impl, state);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case mir_surface_state_restored:
|
||||
case mir_surface_state_hidden:
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_ICONIFIED |
|
||||
GDK_WINDOW_STATE_MAXIMIZED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN,
|
||||
0);
|
||||
break;
|
||||
case mir_surface_state_minimized:
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_MAXIMIZED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN,
|
||||
GDK_WINDOW_STATE_ICONIFIED);
|
||||
break;
|
||||
case mir_surface_state_maximized:
|
||||
case mir_surface_state_vertmaximized:
|
||||
case mir_surface_state_horizmaximized:
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_ICONIFIED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN,
|
||||
GDK_WINDOW_STATE_MAXIMIZED);
|
||||
break;
|
||||
case mir_surface_state_fullscreen:
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_ICONIFIED |
|
||||
GDK_WINDOW_STATE_MAXIMIZED,
|
||||
GDK_WINDOW_STATE_FULLSCREEN);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case mir_surface_attrib_swapinterval:
|
||||
break;
|
||||
@@ -616,6 +579,7 @@ static void
|
||||
gdk_mir_queued_event_free (GdkMirQueuedEvent *event)
|
||||
{
|
||||
_gdk_mir_window_reference_unref (event->window_ref);
|
||||
mir_event_unref (event->event);
|
||||
g_slice_free (GdkMirQueuedEvent, event);
|
||||
}
|
||||
|
||||
@@ -800,7 +764,7 @@ _gdk_mir_event_source_queue (GdkMirWindowReference *window_ref,
|
||||
queued_event = g_slice_new (GdkMirQueuedEvent);
|
||||
g_atomic_int_inc (&window_ref->ref_count);
|
||||
queued_event->window_ref = window_ref;
|
||||
queued_event->event = event;
|
||||
queued_event->event = mir_event_ref (event);
|
||||
|
||||
g_mutex_lock (&source->mir_event_lock);
|
||||
g_queue_push_tail (&source->mir_events, queued_event);
|
||||
|
||||
+21
-21
@@ -203,7 +203,7 @@ get_output (GdkScreen *screen, gint monitor_num)
|
||||
static gint
|
||||
gdk_mir_screen_get_width (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_width\n");
|
||||
//g_printerr ("gdk_mir_screen_get_width\n");
|
||||
gint width, height;
|
||||
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return width;
|
||||
@@ -212,7 +212,7 @@ gdk_mir_screen_get_width (GdkScreen *screen)
|
||||
static gint
|
||||
gdk_mir_screen_get_height (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_height\n");
|
||||
//g_printerr ("gdk_mir_screen_get_height\n");
|
||||
gint width, height;
|
||||
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return height;
|
||||
@@ -221,7 +221,7 @@ gdk_mir_screen_get_height (GdkScreen *screen)
|
||||
static gint
|
||||
gdk_mir_screen_get_width_mm (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_width_mm\n");
|
||||
//g_printerr ("gdk_mir_screen_get_width_mm\n");
|
||||
gint width, height;
|
||||
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return width;
|
||||
@@ -230,7 +230,7 @@ gdk_mir_screen_get_width_mm (GdkScreen *screen)
|
||||
static gint
|
||||
gdk_mir_screen_get_height_mm (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_height_mm\n");
|
||||
//g_printerr ("gdk_mir_screen_get_height_mm\n");
|
||||
gint width, height;
|
||||
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return height;
|
||||
@@ -293,7 +293,7 @@ gdk_mir_screen_get_n_monitors (GdkScreen *screen)
|
||||
static gint
|
||||
gdk_mir_screen_get_primary_monitor (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_primary_monitor\n");
|
||||
//g_printerr ("gdk_mir_screen_get_primary_monitor\n");
|
||||
return 0; //?
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ static gint
|
||||
gdk_mir_screen_get_monitor_width_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_monitor_width_mm (%d)\n", monitor_num);
|
||||
//g_printerr ("gdk_mir_screen_get_monitor_width_mm (%d)\n", monitor_num);
|
||||
MirDisplayOutput *output = get_output (screen, monitor_num);
|
||||
return output ? output->physical_width_mm : 0;
|
||||
}
|
||||
@@ -310,7 +310,7 @@ static gint
|
||||
gdk_mir_screen_get_monitor_height_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_monitor_height_mm (%d)\n", monitor_num);
|
||||
//g_printerr ("gdk_mir_screen_get_monitor_height_mm (%d)\n", monitor_num);
|
||||
MirDisplayOutput *output = get_output (screen, monitor_num);
|
||||
return output ? output->physical_height_mm : 0;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ static gchar *
|
||||
gdk_mir_screen_get_monitor_plug_name (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_monitor_plug_name (%d)\n", monitor_num);
|
||||
//g_printerr ("gdk_mir_screen_get_monitor_plug_name (%d)\n", monitor_num);
|
||||
MirDisplayOutput *output = get_output (screen, monitor_num);
|
||||
|
||||
if (output)
|
||||
@@ -399,7 +399,7 @@ gdk_mir_screen_get_monitor_workarea (GdkScreen *screen,
|
||||
static GList *
|
||||
gdk_mir_screen_list_visuals (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_list_visuals\n");
|
||||
//g_printerr ("gdk_mir_screen_list_visuals\n");
|
||||
return g_list_append (NULL, GDK_MIR_SCREEN (screen)->visual);
|
||||
}
|
||||
|
||||
@@ -428,21 +428,21 @@ gdk_mir_screen_is_composited (GdkScreen *screen)
|
||||
static gchar *
|
||||
gdk_mir_screen_make_display_name (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_make_display_name\n");
|
||||
//g_printerr ("gdk_mir_screen_make_display_name\n");
|
||||
return NULL; // FIXME
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_screen_get_active_window (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_active_window\n");
|
||||
//g_printerr ("gdk_mir_screen_get_active_window\n");
|
||||
return NULL; // FIXME
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_mir_screen_get_window_stack (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_window_stack\n");
|
||||
//g_printerr ("gdk_mir_screen_get_window_stack\n");
|
||||
return NULL; // FIXME
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ static void
|
||||
gdk_mir_screen_broadcast_client_message (GdkScreen *screen,
|
||||
GdkEvent *event)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_broadcast_client_message\n");
|
||||
//g_printerr ("gdk_mir_screen_broadcast_client_message\n");
|
||||
// FIXME
|
||||
}
|
||||
|
||||
@@ -673,21 +673,21 @@ gdk_mir_screen_get_setting (GdkScreen *screen,
|
||||
static gint
|
||||
gdk_mir_screen_visual_get_best_depth (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_depth\n");
|
||||
//g_printerr ("gdk_mir_screen_visual_get_best_depth\n");
|
||||
return VISUAL_DEPTH;
|
||||
}
|
||||
|
||||
static GdkVisualType
|
||||
gdk_mir_screen_visual_get_best_type (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_type\n");
|
||||
//g_printerr ("gdk_mir_screen_visual_get_best_type\n");
|
||||
return VISUAL_TYPE;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_mir_screen_visual_get_best (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best\n");
|
||||
//g_printerr ("gdk_mir_screen_visual_get_best\n");
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
@@ -695,7 +695,7 @@ static GdkVisual*
|
||||
gdk_mir_screen_visual_get_best_with_depth (GdkScreen *screen,
|
||||
gint depth)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_with_depth (%d)\n", depth);
|
||||
//g_printerr ("gdk_mir_screen_visual_get_best_with_depth (%d)\n", depth);
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
@@ -703,7 +703,7 @@ static GdkVisual*
|
||||
gdk_mir_screen_visual_get_best_with_type (GdkScreen *screen,
|
||||
GdkVisualType visual_type)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_with_type (%d)\n", visual_type);
|
||||
//g_printerr ("gdk_mir_screen_visual_get_best_with_type (%d)\n", visual_type);
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ gdk_mir_screen_visual_get_best_with_both (GdkScreen *screen,
|
||||
gint depth,
|
||||
GdkVisualType visual_type)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_with_both\n");
|
||||
//g_printerr ("gdk_mir_screen_visual_get_best_with_both\n");
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ gdk_mir_screen_query_depths (GdkScreen *screen,
|
||||
gint **depths,
|
||||
gint *count)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_query_depths\n");
|
||||
//g_printerr ("gdk_mir_screen_query_depths\n");
|
||||
static gint supported_depths[] = { VISUAL_DEPTH };
|
||||
*depths = supported_depths;
|
||||
*count = 1;
|
||||
@@ -732,7 +732,7 @@ gdk_mir_screen_query_visual_types (GdkScreen *screen,
|
||||
GdkVisualType **visual_types,
|
||||
gint *count)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_query_visual_types\n");
|
||||
//g_printerr ("gdk_mir_screen_query_visual_types\n");
|
||||
static GdkVisualType supported_visual_types[] = { VISUAL_TYPE };
|
||||
*visual_types = supported_visual_types;
|
||||
*count = 1;
|
||||
|
||||
+158
-271
@@ -46,11 +46,8 @@ struct _GdkMirWindowImpl
|
||||
gint transient_x;
|
||||
gint transient_y;
|
||||
|
||||
/* Child windows (e.g. tooltips) */
|
||||
GList *transient_children;
|
||||
|
||||
/* Desired surface attributes */
|
||||
MirSurfaceType surface_type;
|
||||
GdkWindowTypeHint type_hint;
|
||||
MirSurfaceState surface_state;
|
||||
|
||||
/* Pattern for background */
|
||||
@@ -71,7 +68,6 @@ struct _GdkMirWindowImpl
|
||||
EGLSurface egl_surface;
|
||||
|
||||
/* Dummy MIR and EGL surfaces */
|
||||
MirSurface *dummy_surface;
|
||||
EGLSurface dummy_egl_surface;
|
||||
|
||||
/* TRUE if the window can be seen */
|
||||
@@ -103,9 +99,9 @@ _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl, MirSurfaceType type)
|
||||
_gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl,
|
||||
MirSurfaceType type)
|
||||
{
|
||||
impl->surface_type = type;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -141,7 +137,7 @@ _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl,
|
||||
static void
|
||||
gdk_mir_window_impl_init (GdkMirWindowImpl *impl)
|
||||
{
|
||||
impl->surface_type = mir_surface_type_normal;
|
||||
impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
|
||||
impl->surface_state = mir_surface_state_unknown;
|
||||
}
|
||||
|
||||
@@ -157,18 +153,6 @@ set_surface_state (GdkMirWindowImpl *impl,
|
||||
mir_surface_set_state (impl->surface, state);
|
||||
}
|
||||
|
||||
static void
|
||||
set_surface_type (GdkMirWindowImpl *impl,
|
||||
MirSurfaceType type)
|
||||
{
|
||||
if (impl->surface_type == type)
|
||||
return;
|
||||
|
||||
impl->surface_type = type;
|
||||
if (impl->surface)
|
||||
mir_surface_set_type (impl->surface, type);
|
||||
}
|
||||
|
||||
static void
|
||||
event_cb (MirSurface *surface,
|
||||
const MirEvent *event,
|
||||
@@ -179,18 +163,87 @@ event_cb (MirSurface *surface,
|
||||
|
||||
static MirSurface *
|
||||
create_mir_surface (GdkDisplay *display,
|
||||
GdkWindow *parent,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkWindowTypeHint type,
|
||||
MirBufferUsage buffer_usage)
|
||||
{
|
||||
GdkMirWindowImpl *parent_impl;
|
||||
MirSurfaceSpec *spec;
|
||||
MirConnection *connection;
|
||||
MirPixelFormat format;
|
||||
MirSurface *surface;
|
||||
MirRectangle rect;
|
||||
|
||||
connection = gdk_mir_display_get_mir_connection (display);
|
||||
format = _gdk_mir_display_get_pixel_format (display, buffer_usage);
|
||||
spec = mir_connection_create_spec_for_normal_surface (connection, width, height, format);
|
||||
|
||||
if (parent)
|
||||
parent_impl = GDK_MIR_WINDOW_IMPL (parent->impl);
|
||||
else
|
||||
parent_impl = NULL;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GDK_WINDOW_TYPE_HINT_DIALOG:
|
||||
case GDK_WINDOW_TYPE_HINT_DOCK:
|
||||
spec = mir_connection_create_spec_for_dialog (connection,
|
||||
width,
|
||||
height,
|
||||
format);
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_MENU:
|
||||
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
|
||||
case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
|
||||
case GDK_WINDOW_TYPE_HINT_TOOLBAR:
|
||||
case GDK_WINDOW_TYPE_HINT_COMBO:
|
||||
rect.left = x;
|
||||
rect.top = y;
|
||||
rect.width = 1;
|
||||
rect.height = 1;
|
||||
spec = mir_connection_create_spec_for_menu (connection,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
parent_impl ? parent_impl->surface : NULL,
|
||||
&rect,
|
||||
mir_edge_attachment_any);
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
||||
case GDK_WINDOW_TYPE_HINT_UTILITY:
|
||||
spec = mir_connection_create_spec_for_modal_dialog (connection,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
parent_impl ? parent_impl->surface : NULL);
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_DND:
|
||||
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
|
||||
case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
|
||||
rect.left = x;
|
||||
rect.top = y;
|
||||
rect.width = 1;
|
||||
rect.height = 1;
|
||||
spec = mir_connection_create_spec_for_tooltip (connection,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
parent_impl ? parent_impl->surface : NULL,
|
||||
&rect);
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_NORMAL:
|
||||
case GDK_WINDOW_TYPE_HINT_DESKTOP:
|
||||
default:
|
||||
spec = mir_connection_create_spec_for_normal_surface (connection,
|
||||
width,
|
||||
height,
|
||||
format);
|
||||
break;
|
||||
}
|
||||
|
||||
mir_surface_spec_set_name (spec, g_get_prgname ());
|
||||
mir_surface_spec_set_buffer_usage (spec, buffer_usage);
|
||||
surface = mir_surface_create_sync (spec);
|
||||
@@ -199,13 +252,41 @@ create_mir_surface (GdkDisplay *display,
|
||||
return surface;
|
||||
}
|
||||
|
||||
/* TODO: Remove once we have proper transient window support. */
|
||||
static gboolean
|
||||
should_render_in_parent (GdkWindow *window)
|
||||
static GdkDevice *
|
||||
get_pointer (GdkWindow *window)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
return gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_window_get_display (window)));
|
||||
}
|
||||
|
||||
return impl->transient_for && gdk_window_get_window_type (window) != GDK_WINDOW_TOPLEVEL;
|
||||
static void
|
||||
send_event (GdkWindow *window, GdkDevice *device, GdkEvent *event)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GList *node;
|
||||
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, device);
|
||||
gdk_event_set_screen (event, gdk_display_get_screen (gdk_window_get_display (window), 0));
|
||||
event->any.window = g_object_ref (window);
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, _gdk_display_get_next_serial (display));
|
||||
}
|
||||
|
||||
static void
|
||||
generate_configure_event (GdkWindow *window,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
event->configure.send_event = FALSE;
|
||||
event->configure.width = width;
|
||||
event->configure.height = height;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -215,7 +296,7 @@ ensure_surface_full (GdkWindow *window,
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
GdkMirWindowReference *window_ref;
|
||||
|
||||
if (impl->surface || should_render_in_parent (window))
|
||||
if (impl->surface)
|
||||
return;
|
||||
|
||||
/* no destroy notify -- we must leak for now
|
||||
@@ -223,8 +304,10 @@ ensure_surface_full (GdkWindow *window,
|
||||
*/
|
||||
window_ref = _gdk_mir_event_source_get_window_reference (window);
|
||||
|
||||
impl->surface = create_mir_surface (gdk_window_get_display (window),
|
||||
impl->surface = create_mir_surface (gdk_window_get_display (window), impl->transient_for,
|
||||
impl->transient_x, impl->transient_y,
|
||||
window->width, window->height,
|
||||
impl->type_hint,
|
||||
buffer_usage);
|
||||
|
||||
/* FIXME: can't make an initial resize event */
|
||||
@@ -241,9 +324,9 @@ ensure_surface_full (GdkWindow *window,
|
||||
_gdk_mir_event_source_queue (window_ref, &resize_event);
|
||||
*/
|
||||
|
||||
generate_configure_event (window, window->width, window->height);
|
||||
|
||||
mir_surface_set_event_handler (impl->surface, event_cb, window_ref); // FIXME: Ignore some events until shown
|
||||
set_surface_type (impl, impl->surface_type);
|
||||
set_surface_state (impl, impl->surface_state);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -281,66 +364,18 @@ ensure_no_surface (GdkWindow *window)
|
||||
eglDestroySurface (egl_display, impl->dummy_egl_surface);
|
||||
impl->dummy_egl_surface = NULL;
|
||||
}
|
||||
|
||||
g_clear_pointer (&impl->dummy_surface, mir_surface_release_sync);
|
||||
}
|
||||
|
||||
g_clear_pointer(&impl->surface, mir_surface_release_sync);
|
||||
}
|
||||
|
||||
static void
|
||||
redraw_transient (GdkWindow *window)
|
||||
{
|
||||
GdkRectangle r;
|
||||
r.x = window->x;
|
||||
r.y = window->y;
|
||||
r.width = window->width;
|
||||
r.height = window->height;
|
||||
gdk_window_invalidate_rect (GDK_MIR_WINDOW_IMPL (window->impl)->transient_for, &r, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
send_buffer (GdkWindow *window)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
|
||||
/* Transient windows draw onto parent instead */
|
||||
if (should_render_in_parent (window))
|
||||
{
|
||||
redraw_transient (window);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Composite transient windows over this one */
|
||||
if (impl->transient_children)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *c;
|
||||
GList *link;
|
||||
|
||||
surface = gdk_mir_window_impl_ref_cairo_surface (window);
|
||||
c = cairo_create (surface);
|
||||
|
||||
for (link = impl->transient_children; link; link = link->next)
|
||||
{
|
||||
GdkWindow *child_window = link->data;
|
||||
GdkMirWindowImpl *child_impl = GDK_MIR_WINDOW_IMPL (child_window->impl);
|
||||
|
||||
/* Skip children not yet drawn to */
|
||||
if (!child_impl->cairo_surface)
|
||||
continue;
|
||||
|
||||
cairo_set_source_surface (c, child_impl->cairo_surface, child_window->x, child_window->y);
|
||||
cairo_rectangle (c, child_window->x, child_window->y, child_window->width, child_window->height);
|
||||
cairo_fill (c);
|
||||
}
|
||||
|
||||
cairo_destroy (c);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
/* Send the completed buffer to Mir */
|
||||
mir_surface_swap_buffers_sync (impl->surface);
|
||||
mir_buffer_stream_swap_buffers_sync (mir_surface_get_buffer_stream (impl->surface));
|
||||
|
||||
/* The Cairo context is no longer valid */
|
||||
g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
|
||||
@@ -363,7 +398,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
|
||||
}
|
||||
|
||||
/* Transient windows get rendered into a buffer and copied onto their parent */
|
||||
if (should_render_in_parent (window) || window->gl_paint_context)
|
||||
if (window->gl_paint_context)
|
||||
{
|
||||
cairo_surface = cairo_image_surface_create (pixel_format, window->width, window->height);
|
||||
}
|
||||
@@ -371,7 +406,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
|
||||
{
|
||||
ensure_surface (window);
|
||||
|
||||
mir_surface_get_graphics_region (impl->surface, ®ion);
|
||||
mir_buffer_stream_get_graphics_region (mir_surface_get_buffer_stream (impl->surface), ®ion);
|
||||
g_assert (region.pixel_format == mir_pixel_format_argb_8888);
|
||||
|
||||
cairo_surface = cairo_image_surface_create_for_data ((unsigned char *) region.vaddr,
|
||||
@@ -409,13 +444,6 @@ static void
|
||||
gdk_mir_window_impl_finalize (GObject *object)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (object);
|
||||
GList *link;
|
||||
|
||||
for (link = impl->transient_children; link; link = link->next)
|
||||
{
|
||||
GdkWindow *window = link->data;
|
||||
gdk_window_destroy (window);
|
||||
}
|
||||
|
||||
if (impl->background)
|
||||
cairo_pattern_destroy (impl->background);
|
||||
@@ -423,7 +451,6 @@ gdk_mir_window_impl_finalize (GObject *object)
|
||||
mir_surface_release_sync (impl->surface);
|
||||
if (impl->cairo_surface)
|
||||
cairo_surface_destroy (impl->cairo_surface);
|
||||
g_list_free (impl->transient_children);
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_window_impl_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -460,9 +487,6 @@ gdk_mir_window_impl_hide (GdkWindow *window)
|
||||
impl->cursor_inside = FALSE;
|
||||
impl->visible = FALSE;
|
||||
ensure_no_surface (window);
|
||||
|
||||
if (should_render_in_parent (window))
|
||||
redraw_transient (window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -474,9 +498,6 @@ gdk_mir_window_impl_withdraw (GdkWindow *window)
|
||||
impl->cursor_inside = FALSE;
|
||||
impl->visible = FALSE;
|
||||
ensure_no_surface (window);
|
||||
|
||||
if (should_render_in_parent (window))
|
||||
redraw_transient (window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -530,19 +551,10 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
gboolean recreate_surface = FALSE;
|
||||
|
||||
/* Redraw parent where we moved from */
|
||||
if (should_render_in_parent (window))
|
||||
redraw_transient (window);
|
||||
|
||||
/* Transient windows can move wherever they want */
|
||||
if (with_move)
|
||||
{
|
||||
if (should_render_in_parent (window))
|
||||
{
|
||||
window->x = x;
|
||||
window->y = y;
|
||||
}
|
||||
else if (x != impl->transient_x || y != impl->transient_y)
|
||||
if (x != impl->transient_x || y != impl->transient_y)
|
||||
{
|
||||
impl->transient_x = x;
|
||||
impl->transient_y = y;
|
||||
@@ -564,10 +576,6 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
|
||||
ensure_no_surface (window);
|
||||
ensure_surface (window);
|
||||
}
|
||||
|
||||
/* Redraw parent where we moved to */
|
||||
if (should_render_in_parent (window))
|
||||
redraw_transient (window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -603,7 +611,7 @@ gdk_mir_window_impl_reparent (GdkWindow *window,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_reparent window=%p new-parent=%p\n", window, new_parent);
|
||||
//g_printerr ("gdk_mir_window_impl_reparent window=%p new-parent=%p\n", window, new_parent);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -703,14 +711,14 @@ gdk_mir_window_impl_end_paint (GdkWindow *window)
|
||||
static cairo_region_t *
|
||||
gdk_mir_window_impl_get_shape (GdkWindow *window)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_get_shape window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_get_shape window=%p\n", window);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_mir_window_impl_get_input_shape (GdkWindow *window)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_get_input_shape window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_get_input_shape window=%p\n", window);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -720,7 +728,7 @@ gdk_mir_window_impl_shape_combine_region (GdkWindow *window,
|
||||
gint offset_x,
|
||||
gint offset_y)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_shape_combine_region window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_shape_combine_region window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -742,70 +750,32 @@ gdk_mir_window_impl_destroy (GdkWindow *window,
|
||||
|
||||
impl->visible = FALSE;
|
||||
ensure_no_surface (window);
|
||||
|
||||
if (should_render_in_parent (window))
|
||||
{
|
||||
/* Redraw parent */
|
||||
redraw_transient (window);
|
||||
|
||||
/* Remove from transient list */
|
||||
GdkMirWindowImpl *parent_impl = GDK_MIR_WINDOW_IMPL (impl->transient_for->impl);
|
||||
parent_impl->transient_children = g_list_remove (parent_impl->transient_children, window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_destroy_foreign (GdkWindow *window)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_destroy_foreign window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_destroy_foreign window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_focus (GdkWindow *window,
|
||||
guint32 timestamp)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_focus window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_focus window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_type_hint (GdkWindow *window,
|
||||
GdkWindowTypeHint hint)
|
||||
{
|
||||
MirSurfaceType mir_type = mir_surface_type_normal;
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
|
||||
switch (hint)
|
||||
if (hint != impl->type_hint)
|
||||
{
|
||||
case GDK_WINDOW_TYPE_HINT_NORMAL:
|
||||
case GDK_WINDOW_TYPE_HINT_DOCK:
|
||||
case GDK_WINDOW_TYPE_HINT_DESKTOP:
|
||||
mir_type = mir_surface_type_normal;
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_DIALOG:
|
||||
mir_type = mir_surface_type_dialog;
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_UTILITY:
|
||||
mir_type = mir_surface_type_utility;
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_MENU:
|
||||
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
|
||||
case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
|
||||
case GDK_WINDOW_TYPE_HINT_COMBO:
|
||||
mir_type = mir_surface_type_menu;
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
|
||||
mir_type = mir_surface_type_tip;
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
||||
case GDK_WINDOW_TYPE_HINT_DND:
|
||||
case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
|
||||
mir_type = mir_surface_type_overlay;
|
||||
break;
|
||||
case GDK_WINDOW_TYPE_HINT_TOOLBAR:
|
||||
mir_type = mir_surface_type_satellite;
|
||||
break;
|
||||
impl->type_hint = hint;
|
||||
ensure_no_surface (window);
|
||||
}
|
||||
|
||||
set_surface_type (GDK_MIR_WINDOW_IMPL (window->impl), mir_type);
|
||||
}
|
||||
|
||||
static GdkWindowTypeHint
|
||||
@@ -813,29 +783,7 @@ gdk_mir_window_impl_get_type_hint (GdkWindow *window)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
|
||||
switch (impl->surface_type)
|
||||
{
|
||||
case mir_surface_type_normal:
|
||||
case mir_surface_type_freestyle:
|
||||
case mir_surface_type_inputmethod:
|
||||
return GDK_WINDOW_TYPE_HINT_NORMAL;
|
||||
case mir_surface_type_utility:
|
||||
return GDK_WINDOW_TYPE_HINT_UTILITY;
|
||||
case mir_surface_type_dialog:
|
||||
return GDK_WINDOW_TYPE_HINT_DIALOG;
|
||||
case mir_surface_type_tip:
|
||||
return GDK_WINDOW_TYPE_HINT_TOOLTIP;
|
||||
case mir_surface_type_menu:
|
||||
return GDK_WINDOW_TYPE_HINT_MENU;
|
||||
case mir_surface_type_overlay:
|
||||
return GDK_WINDOW_TYPE_HINT_NOTIFICATION;
|
||||
case mir_surface_type_satellite:
|
||||
return GDK_WINDOW_TYPE_HINT_TOOLBAR;
|
||||
case mir_surface_types:
|
||||
break;
|
||||
}
|
||||
|
||||
return GDK_WINDOW_TYPE_HINT_NORMAL;
|
||||
return impl->type_hint;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -850,21 +798,21 @@ static void
|
||||
gdk_mir_window_impl_set_skip_taskbar_hint (GdkWindow *window,
|
||||
gboolean skips_taskbar)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_skip_taskbar_hint window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_skip_taskbar_hint window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_skip_pager_hint (GdkWindow *window,
|
||||
gboolean skips_pager)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_skip_pager_hint window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_skip_pager_hint window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_urgency_hint (GdkWindow *window,
|
||||
gboolean urgent)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_urgency_hint window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_urgency_hint window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -887,21 +835,21 @@ static void
|
||||
gdk_mir_window_impl_set_role (GdkWindow *window,
|
||||
const gchar *role)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_role window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_role window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_startup_id (GdkWindow *window,
|
||||
const gchar *startup_id)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_startup_id window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_startup_id window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_transient_for (GdkWindow *window,
|
||||
GdkWindow *parent)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_transient_for window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_transient_for window=%p\n", window);
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
|
||||
if (impl->transient_for == parent)
|
||||
@@ -911,78 +859,20 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window,
|
||||
|
||||
/* Link this window to the parent */
|
||||
impl->transient_for = parent;
|
||||
if (should_render_in_parent (window))
|
||||
{
|
||||
GdkMirWindowImpl *parent_impl = GDK_MIR_WINDOW_IMPL (parent->impl);
|
||||
parent_impl->transient_children = g_list_append (parent_impl->transient_children, window);
|
||||
|
||||
/* Move to where the client requested */
|
||||
window->x = impl->transient_x;
|
||||
window->y = impl->transient_y;
|
||||
|
||||
/* Remove surface if we had made one before this was set */
|
||||
ensure_no_surface (window);
|
||||
|
||||
/* Redraw onto parent */
|
||||
redraw_transient (window);
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Remove once we have proper transient window support. */
|
||||
GdkWindow *
|
||||
_gdk_mir_window_get_visible_transient_child (GdkWindow *window,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble *out_x,
|
||||
gdouble *out_y)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
GdkWindow *child = NULL;
|
||||
GList *i;
|
||||
|
||||
x -= window->x;
|
||||
y -= window->y;
|
||||
|
||||
if (x < 0 || x >= window->width || y < 0 || y >= window->height)
|
||||
return NULL;
|
||||
|
||||
for (i = impl->transient_children; i && !child; i = i->next)
|
||||
{
|
||||
if (GDK_MIR_WINDOW_IMPL (GDK_WINDOW (i->data)->impl)->visible)
|
||||
child = _gdk_mir_window_get_visible_transient_child (i->data, x, y, out_x, out_y);
|
||||
}
|
||||
|
||||
if (child)
|
||||
return child;
|
||||
|
||||
*out_x = x;
|
||||
*out_y = y;
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
/* TODO: Remove once we have proper transient window support. */
|
||||
void
|
||||
_gdk_mir_window_transient_children_foreach (GdkWindow *window,
|
||||
void (*func) (GdkWindow *, gpointer),
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
g_list_foreach (impl->transient_children, (GFunc) func, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_get_frame_extents (GdkWindow *window,
|
||||
GdkRectangle *rect)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_get_frame_extents window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_get_frame_extents window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_override_redirect (GdkWindow *window,
|
||||
gboolean override_redirect)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_override_redirect window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_override_redirect window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1013,7 +903,7 @@ static void
|
||||
gdk_mir_window_impl_set_icon_name (GdkWindow *window,
|
||||
const gchar *name)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_icon_name window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_icon_name window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1097,7 +987,7 @@ gdk_mir_window_impl_set_keep_below (GdkWindow *window,
|
||||
static GdkWindow *
|
||||
gdk_mir_window_impl_get_group (GdkWindow *window)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_get_group window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_get_group window=%p\n", window);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1105,21 +995,21 @@ static void
|
||||
gdk_mir_window_impl_set_group (GdkWindow *window,
|
||||
GdkWindow *leader)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_group window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_group window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_decorations (GdkWindow *window,
|
||||
GdkWMDecoration decorations)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_decorations window=%p decorations=%d\n", window, decorations);
|
||||
//g_printerr ("gdk_mir_window_impl_set_decorations window=%p decorations=%d\n", window, decorations);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_window_impl_get_decorations (GdkWindow *window,
|
||||
GdkWMDecoration *decorations)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_get_decorations window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_get_decorations window=%p\n", window);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1127,7 +1017,7 @@ static void
|
||||
gdk_mir_window_impl_set_functions (GdkWindow *window,
|
||||
GdkWMFunction functions)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_functions window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_functions window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1139,7 +1029,7 @@ gdk_mir_window_impl_begin_resize_drag (GdkWindow *window,
|
||||
gint root_y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_begin_resize_drag window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_begin_resize_drag window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1150,19 +1040,19 @@ gdk_mir_window_impl_begin_move_drag (GdkWindow *window,
|
||||
gint root_y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_begin_move_drag window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_begin_move_drag window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_enable_synchronized_configure (GdkWindow *window)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_enable_synchronized_configure window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_enable_synchronized_configure window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_configure_finished (GdkWindow *window)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_configure_finished window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_configure_finished window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1177,27 +1067,27 @@ static void
|
||||
gdk_mir_window_impl_set_composited (GdkWindow *window,
|
||||
gboolean composited)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_set_composited window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_set_composited window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_destroy_notify (GdkWindow *window)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_destroy_notify window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_destroy_notify window=%p\n", window);
|
||||
}
|
||||
|
||||
static GdkDragProtocol
|
||||
gdk_mir_window_impl_get_drag_protocol (GdkWindow *window,
|
||||
GdkWindow **target)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_get_drag_protocol window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_get_drag_protocol window=%p\n", window);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_register_dnd (GdkWindow *window)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_register_dnd window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_register_dnd window=%p\n", window);
|
||||
}
|
||||
|
||||
static GdkDragContext *
|
||||
@@ -1205,7 +1095,7 @@ gdk_mir_window_impl_drag_begin (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GList *targets)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_drag_begin window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_drag_begin window=%p\n", window);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1229,7 +1119,7 @@ gdk_mir_window_impl_process_updates_recurse (GdkWindow *window,
|
||||
static void
|
||||
gdk_mir_window_impl_sync_rendering (GdkWindow *window)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_sync_rendering window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_sync_rendering window=%p\n", window);
|
||||
// FIXME: Only used for benchmarking
|
||||
}
|
||||
|
||||
@@ -1241,7 +1131,7 @@ gdk_mir_window_impl_simulate_key (GdkWindow *window,
|
||||
GdkModifierType modifiers,
|
||||
GdkEventType key_pressrelease)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_simulate_key window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_simulate_key window=%p\n", window);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1253,7 +1143,7 @@ gdk_mir_window_impl_simulate_button (GdkWindow *window,
|
||||
GdkModifierType modifiers,
|
||||
GdkEventType button_pressrelease)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_simulate_button window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_simulate_button window=%p\n", window);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1269,7 +1159,7 @@ gdk_mir_window_impl_get_property (GdkWindow *window,
|
||||
gint *actual_length,
|
||||
guchar **data)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_get_property window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_get_property window=%p\n", window);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1282,7 +1172,7 @@ gdk_mir_window_impl_change_property (GdkWindow *window,
|
||||
const guchar *data,
|
||||
gint nelements)
|
||||
{
|
||||
g_printerr ("gdk_mir_window_impl_change_property window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_change_property window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1509,7 +1399,7 @@ _gdk_mir_window_get_egl_surface (GdkWindow *window,
|
||||
ensure_surface_full (window, mir_buffer_usage_hardware);
|
||||
|
||||
egl_display = _gdk_mir_display_get_egl_display (gdk_window_get_display (window));
|
||||
egl_window = (EGLNativeWindowType) mir_surface_get_egl_native_window (impl->surface);
|
||||
egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (mir_surface_get_buffer_stream (impl->surface));
|
||||
|
||||
impl->egl_surface =
|
||||
eglCreateWindowSurface (egl_display, config, egl_window, NULL);
|
||||
@@ -1533,11 +1423,8 @@ _gdk_mir_window_get_dummy_egl_surface (GdkWindow *window,
|
||||
EGLNativeWindowType egl_window;
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
impl->dummy_surface = create_mir_surface (display, 1, 1,
|
||||
mir_buffer_usage_hardware);
|
||||
|
||||
egl_display = _gdk_mir_display_get_egl_display (display);
|
||||
egl_window = (EGLNativeWindowType) mir_surface_get_egl_native_window (impl->surface);
|
||||
egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (mir_surface_get_buffer_stream (impl->surface));
|
||||
|
||||
impl->dummy_egl_surface =
|
||||
eglCreateWindowSurface (egl_display, config, egl_window, NULL);
|
||||
|
||||
+177
-32
@@ -68,7 +68,8 @@ struct _GdkWaylandDeviceData
|
||||
|
||||
GHashTable *touches;
|
||||
|
||||
GdkModifierType modifiers;
|
||||
GdkModifierType key_modifiers;
|
||||
GdkModifierType button_modifiers;
|
||||
GdkWindow *pointer_focus;
|
||||
GdkWindow *keyboard_focus;
|
||||
struct wl_data_device *data_device;
|
||||
@@ -347,11 +348,90 @@ gdk_wayland_device_query_state (GdkDevice *device,
|
||||
if (child_window)
|
||||
*child_window = wd->pointer_focus;
|
||||
if (mask)
|
||||
*mask = wd->modifiers;
|
||||
*mask = wd->button_modifiers | wd->key_modifiers;
|
||||
|
||||
get_coordinates (wd, win_x, win_y, root_x, root_y);
|
||||
}
|
||||
|
||||
static void
|
||||
emulate_crossing (GdkWindow *window,
|
||||
GdkWindow *subwindow,
|
||||
GdkDevice *device,
|
||||
GdkEventType type,
|
||||
GdkCrossingMode mode,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (type);
|
||||
event->crossing.window = window ? g_object_ref (window) : NULL;
|
||||
event->crossing.subwindow = subwindow ? g_object_ref (subwindow) : NULL;
|
||||
event->crossing.time = time_;
|
||||
event->crossing.mode = mode;
|
||||
event->crossing.detail = GDK_NOTIFY_NONLINEAR;
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, device);
|
||||
|
||||
gdk_window_get_device_position_double (window, device,
|
||||
&event->crossing.x, &event->crossing.y,
|
||||
&event->crossing.state);
|
||||
event->crossing.x_root = event->crossing.x;
|
||||
event->crossing.y_root = event->crossing.y;
|
||||
|
||||
_gdk_wayland_display_deliver_event (gdk_window_get_display (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
emulate_focus (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
gboolean focus_in,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_FOCUS_CHANGE);
|
||||
event->focus_change.window = g_object_ref (window);
|
||||
event->focus_change.in = focus_in;
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, device);
|
||||
|
||||
_gdk_wayland_display_deliver_event (gdk_window_get_display (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
device_emit_grab_crossing (GdkDevice *device,
|
||||
GdkWindow *from,
|
||||
GdkWindow *to,
|
||||
GdkCrossingMode mode,
|
||||
guint32 time_)
|
||||
{
|
||||
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
||||
{
|
||||
if (from)
|
||||
emulate_focus (from, device, FALSE, time_);
|
||||
if (to)
|
||||
emulate_focus (to, device, TRUE, time_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (from)
|
||||
emulate_crossing (from, to, device, GDK_LEAVE_NOTIFY, mode, time_);
|
||||
if (to)
|
||||
emulate_crossing (to, from, device, GDK_ENTER_NOTIFY, mode, time_);
|
||||
}
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_wayland_device_get_focus (GdkDevice *device)
|
||||
{
|
||||
GdkWaylandDeviceData *wayland_device = GDK_WAYLAND_DEVICE (device)->device;
|
||||
|
||||
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
||||
return wayland_device->keyboard_focus;
|
||||
else
|
||||
return wayland_device->pointer_focus;
|
||||
}
|
||||
|
||||
static GdkGrabStatus
|
||||
gdk_wayland_device_grab (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
@@ -362,6 +442,10 @@ gdk_wayland_device_grab (GdkDevice *device,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWaylandDeviceData *wayland_device = GDK_WAYLAND_DEVICE (device)->device;
|
||||
GdkWindow *prev_focus = gdk_wayland_device_get_focus (device);
|
||||
|
||||
if (prev_focus != window)
|
||||
device_emit_grab_crossing (device, prev_focus, window, GDK_CROSSING_GRAB, time_);
|
||||
|
||||
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
||||
{
|
||||
@@ -411,9 +495,23 @@ gdk_wayland_device_ungrab (GdkDevice *device,
|
||||
GdkWaylandDeviceData *wayland_device = GDK_WAYLAND_DEVICE (device)->device;
|
||||
GdkDisplay *display;
|
||||
GdkDeviceGrabInfo *grab;
|
||||
GdkWindow *focus, *prev_focus = NULL;
|
||||
|
||||
display = gdk_device_get_display (device);
|
||||
|
||||
grab = _gdk_display_get_last_device_grab (display, device);
|
||||
|
||||
if (grab)
|
||||
{
|
||||
grab->serial_end = grab->serial_start;
|
||||
prev_focus = grab->window;
|
||||
}
|
||||
|
||||
focus = gdk_wayland_device_get_focus (device);
|
||||
|
||||
if (focus != prev_focus)
|
||||
device_emit_grab_crossing (device, prev_focus, focus, GDK_CROSSING_UNGRAB, time_);
|
||||
|
||||
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
||||
{
|
||||
/* Device is a keyboard */
|
||||
@@ -421,11 +519,6 @@ gdk_wayland_device_ungrab (GdkDevice *device,
|
||||
else
|
||||
{
|
||||
/* Device is a pointer */
|
||||
grab = _gdk_display_get_last_device_grab (display, device);
|
||||
|
||||
if (grab)
|
||||
grab->serial_end = grab->serial_start;
|
||||
|
||||
g_clear_object (&wayland_device->grab_cursor);
|
||||
gdk_wayland_device_update_window_cursor (wayland_device);
|
||||
|
||||
@@ -452,7 +545,7 @@ gdk_wayland_device_window_at_position (GdkDevice *device,
|
||||
if (win_y)
|
||||
*win_y = wd->surface_y;
|
||||
if (mask)
|
||||
*mask = wd->modifiers;
|
||||
*mask = wd->button_modifiers | wd->key_modifiers;
|
||||
|
||||
return wd->pointer_focus;
|
||||
}
|
||||
@@ -595,8 +688,7 @@ data_device_data_offer (void *data,
|
||||
g_message ("data device data offer, data device %p, offer %p",
|
||||
data_device, offer));
|
||||
|
||||
gdk_wayland_selection_set_offer (device->display, offer);
|
||||
emit_selection_owner_change_forall (gdk_atom_intern_static_string ("GdkWaylandSelection"));
|
||||
gdk_wayland_selection_ensure_offer (device->display, offer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -610,6 +702,7 @@ data_device_enter (void *data,
|
||||
{
|
||||
GdkWaylandDeviceData *device = (GdkWaylandDeviceData *)data;
|
||||
GdkWindow *dest_window, *dnd_owner;
|
||||
GdkAtom selection;
|
||||
|
||||
dest_window = wl_surface_get_user_data (surface);
|
||||
|
||||
@@ -627,7 +720,8 @@ data_device_enter (void *data,
|
||||
|
||||
gdk_wayland_drop_context_update_targets (device->drop_context);
|
||||
|
||||
dnd_owner = gdk_selection_owner_get_for_display (device->display, gdk_drag_get_selection (device->drop_context));
|
||||
selection = gdk_drag_get_selection (device->drop_context);
|
||||
dnd_owner = gdk_selection_owner_get_for_display (device->display, selection);
|
||||
|
||||
if (!dnd_owner)
|
||||
dnd_owner = device->foreign_dnd_window;
|
||||
@@ -641,9 +735,9 @@ data_device_enter (void *data,
|
||||
wl_fixed_to_double (y));
|
||||
_gdk_wayland_drag_context_emit_event (device->drop_context, GDK_DRAG_ENTER,
|
||||
GDK_CURRENT_TIME);
|
||||
gdk_wayland_selection_set_offer (device->display, offer);
|
||||
emit_selection_owner_change (dest_window,
|
||||
gdk_atom_intern_static_string ("GdkWaylandSelection"));
|
||||
|
||||
gdk_wayland_selection_set_offer (device->display, selection, offer);
|
||||
emit_selection_owner_change_forall (selection);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -706,12 +800,7 @@ data_device_drop (void *data,
|
||||
local_dnd_owner = gdk_selection_owner_get_for_display (device->display, gdk_drag_get_selection (device->drop_context));
|
||||
|
||||
if (local_dnd_owner)
|
||||
{
|
||||
GdkDragContext *source_context;
|
||||
|
||||
source_context = gdk_wayland_drag_context_lookup_by_source_window (local_dnd_owner);
|
||||
gdk_wayland_drag_context_undo_grab (source_context);
|
||||
}
|
||||
gdk_wayland_device_unset_grab (device->master_pointer);
|
||||
|
||||
_gdk_wayland_drag_context_emit_event (device->drop_context,
|
||||
GDK_DROP_START, GDK_CURRENT_TIME);
|
||||
@@ -723,13 +812,15 @@ data_device_selection (void *data,
|
||||
struct wl_data_offer *offer)
|
||||
{
|
||||
GdkWaylandDeviceData *device = (GdkWaylandDeviceData *) data;
|
||||
GdkAtom selection;
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("data device selection, data device %p, data offer %p",
|
||||
wl_data_device, offer));
|
||||
|
||||
gdk_wayland_selection_set_offer (device->display, offer);
|
||||
emit_selection_owner_change_forall (gdk_atom_intern_static_string ("CLIPBOARD"));
|
||||
selection = gdk_atom_intern_static_string ("CLIPBOARD");
|
||||
gdk_wayland_selection_set_offer (device->display, selection, offer);
|
||||
emit_selection_owner_change_forall (selection);
|
||||
}
|
||||
|
||||
static const struct wl_data_device_listener data_device_listener = {
|
||||
@@ -874,7 +965,7 @@ pointer_handle_motion (void *data,
|
||||
gdk_event_set_source_device (event, device->pointer);
|
||||
event->motion.time = time;
|
||||
event->motion.axes = NULL;
|
||||
event->motion.state = device->modifiers;
|
||||
event->motion.state = device->button_modifiers | device->key_modifiers;
|
||||
event->motion.is_hint = 0;
|
||||
gdk_event_set_screen (event, display->screen);
|
||||
|
||||
@@ -933,7 +1024,7 @@ pointer_handle_button (void *data,
|
||||
gdk_event_set_source_device (event, device->pointer);
|
||||
event->button.time = time;
|
||||
event->button.axes = NULL;
|
||||
event->button.state = device->modifiers;
|
||||
event->button.state = device->button_modifiers | device->key_modifiers;
|
||||
event->button.button = gdk_button;
|
||||
gdk_event_set_screen (event, display->screen);
|
||||
|
||||
@@ -945,9 +1036,9 @@ pointer_handle_button (void *data,
|
||||
|
||||
modifier = 1 << (8 + gdk_button - 1);
|
||||
if (state)
|
||||
device->modifiers |= modifier;
|
||||
device->button_modifiers |= modifier;
|
||||
else
|
||||
device->modifiers &= ~modifier;
|
||||
device->button_modifiers &= ~modifier;
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("button %d %s, device %p state %d",
|
||||
@@ -998,7 +1089,7 @@ pointer_handle_axis (void *data,
|
||||
event->scroll.direction = GDK_SCROLL_SMOOTH;
|
||||
event->scroll.delta_x = delta_x;
|
||||
event->scroll.delta_y = delta_y;
|
||||
event->scroll.state = device->modifiers;
|
||||
event->scroll.state = device->button_modifiers | device->key_modifiers;
|
||||
gdk_event_set_screen (event, display->screen);
|
||||
|
||||
get_coordinates (device,
|
||||
@@ -1254,14 +1345,14 @@ deliver_key_event (GdkWaylandDeviceData *device,
|
||||
sym = xkb_state_key_get_one_sym (xkb_state, key);
|
||||
|
||||
device->time = time_;
|
||||
device->modifiers = gdk_keymap_get_modifier_state (keymap);
|
||||
device->key_modifiers = gdk_keymap_get_modifier_state (keymap);
|
||||
|
||||
event = gdk_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
|
||||
event->key.window = device->keyboard_focus ? g_object_ref (device->keyboard_focus) : NULL;
|
||||
gdk_event_set_device (event, device->master_keyboard);
|
||||
gdk_event_set_source_device (event, device->keyboard);
|
||||
event->key.time = time_;
|
||||
event->key.state = device->modifiers;
|
||||
event->key.state = device->button_modifiers | device->key_modifiers;
|
||||
event->key.group = 0;
|
||||
event->key.hardware_keycode = key;
|
||||
event->key.keyval = sym;
|
||||
@@ -1364,7 +1455,7 @@ keyboard_handle_modifiers (void *data,
|
||||
keymap = device->keymap;
|
||||
direction = gdk_keymap_get_direction (keymap);
|
||||
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
|
||||
device->modifiers = mods_depressed | mods_latched | mods_locked;
|
||||
device->key_modifiers = mods_depressed | mods_latched | mods_locked;
|
||||
|
||||
xkb_state_update_mask (xkb_state, mods_depressed, mods_latched, mods_locked, group, 0, 0);
|
||||
|
||||
@@ -1432,7 +1523,7 @@ _create_touch_event (GdkWaylandDeviceData *device,
|
||||
gdk_event_set_device (event, device->master_pointer);
|
||||
gdk_event_set_source_device (event, device->touch);
|
||||
event->touch.time = time;
|
||||
event->touch.state = device->modifiers;
|
||||
event->touch.state = device->button_modifiers | device->key_modifiers;
|
||||
gdk_event_set_screen (event, display->screen);
|
||||
event->touch.sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
|
||||
|
||||
@@ -1621,7 +1712,7 @@ seat_handle_capabilities (void *data,
|
||||
device_manager->devices =
|
||||
g_list_prepend (device_manager->devices, device->pointer);
|
||||
|
||||
device->drop_context = _gdk_wayland_drop_context_new (device->pointer,
|
||||
device->drop_context = _gdk_wayland_drop_context_new (device->master_pointer,
|
||||
device->data_device);
|
||||
|
||||
g_signal_emit_by_name (device_manager, "device-added", device->pointer);
|
||||
@@ -2102,3 +2193,57 @@ gdk_wayland_device_set_selection (GdkDevice *gdk_device,
|
||||
wl_data_device_set_selection (device->data_device, source,
|
||||
_gdk_wayland_display_get_serial (display_wayland));
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_device_unset_grab (GdkDevice *gdk_device)
|
||||
{
|
||||
GdkWaylandDeviceData *device;
|
||||
GdkEventSequence *sequence;
|
||||
GdkModifierType state;
|
||||
GdkEvent *event;
|
||||
guint button;
|
||||
gdouble x, y;
|
||||
|
||||
device = GDK_WAYLAND_DEVICE (gdk_device)->device;
|
||||
_gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (gdk_device), &sequence);
|
||||
gdk_window_get_device_position_double (device->pointer_grab_window,
|
||||
gdk_device, &x, &y, &state);
|
||||
|
||||
if (sequence)
|
||||
{
|
||||
event = gdk_event_new (GDK_TOUCH_END);
|
||||
event->touch.window = g_object_ref (device->pointer_grab_window);
|
||||
event->touch.send_event = TRUE;
|
||||
event->touch.sequence = sequence;
|
||||
event->touch.time = GDK_CURRENT_TIME;
|
||||
event->touch.x = event->touch.x_root = x;
|
||||
event->touch.y = event->touch.y_root = y;
|
||||
}
|
||||
else if (state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))
|
||||
{
|
||||
if (state & GDK_BUTTON1_MASK)
|
||||
button = 1;
|
||||
else if (state & GDK_BUTTON2_MASK)
|
||||
button = 2;
|
||||
else if (state & GDK_BUTTON3_MASK)
|
||||
button = 3;
|
||||
else
|
||||
return;
|
||||
|
||||
event = gdk_event_new (GDK_BUTTON_RELEASE);
|
||||
event->button.window = g_object_ref (device->pointer_grab_window);
|
||||
event->button.send_event = TRUE;
|
||||
event->button.button = button;
|
||||
event->button.time = GDK_CURRENT_TIME;
|
||||
event->button.x = event->button.x_root = x;
|
||||
event->button.y = event->button.y_root = y;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
device->button_modifiers = 0;
|
||||
gdk_event_set_device (event, gdk_device);
|
||||
gdk_event_set_source_device (event, gdk_device);
|
||||
|
||||
_gdk_wayland_display_deliver_event (gdk_device_get_display (gdk_device), event);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ struct _GdkWaylandDragContext
|
||||
GdkWindow *dnd_window;
|
||||
struct wl_surface *dnd_surface;
|
||||
struct wl_data_source *data_source;
|
||||
struct wl_data_offer *offer;
|
||||
uint32_t serial;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
@@ -196,8 +195,10 @@ gdk_wayland_drop_context_set_status (GdkDragContext *context,
|
||||
struct wl_data_offer *wl_offer;
|
||||
|
||||
context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
display = gdk_window_get_display (context->source_window);
|
||||
wl_offer = gdk_wayland_selection_get_offer (display);
|
||||
|
||||
display = gdk_device_get_display (gdk_drag_context_get_device (context));
|
||||
wl_offer = gdk_wayland_selection_get_offer (display,
|
||||
gdk_drag_get_selection (context));
|
||||
|
||||
if (!wl_offer)
|
||||
return;
|
||||
@@ -214,8 +215,10 @@ gdk_wayland_drop_context_set_status (GdkDragContext *context,
|
||||
|
||||
if (l)
|
||||
{
|
||||
wl_data_offer_accept (wl_offer, context_wayland->serial,
|
||||
gdk_atom_name (l->data));
|
||||
gchar *mimetype = gdk_atom_name (l->data);
|
||||
|
||||
wl_data_offer_accept (wl_offer, context_wayland->serial, mimetype);
|
||||
g_free (mimetype);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -245,10 +248,15 @@ gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
guint32 time)
|
||||
{
|
||||
GdkDisplay *display = gdk_window_get_display (context->source_window);
|
||||
GdkDisplay *display = gdk_device_get_display (gdk_drag_context_get_device (context));
|
||||
GdkAtom selection;
|
||||
|
||||
if (gdk_selection_owner_get_for_display (display, gdk_drag_get_selection (context)))
|
||||
gdk_wayland_selection_unset_data_source (display, gdk_drag_get_selection (context));
|
||||
selection = gdk_drag_get_selection (context);
|
||||
|
||||
if (gdk_selection_owner_get_for_display (display, selection))
|
||||
gdk_wayland_selection_unset_data_source (display, selection);
|
||||
|
||||
gdk_wayland_selection_set_offer (display, selection, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -353,7 +361,12 @@ _gdk_wayland_window_drag_begin (GdkWindow *window,
|
||||
gdk_wayland_drag_context_get_selection (context));
|
||||
|
||||
for (l = context->targets; l; l = l->next)
|
||||
wl_data_source_offer (context_wayland->data_source, gdk_atom_name (l->data));
|
||||
{
|
||||
gchar *mimetype = gdk_atom_name (l->data);
|
||||
|
||||
wl_data_source_offer (context_wayland->data_source, mimetype);
|
||||
g_free (mimetype);
|
||||
}
|
||||
|
||||
wl_data_device_start_drag (gdk_wayland_device_get_data_device (device),
|
||||
context_wayland->data_source,
|
||||
@@ -389,7 +402,8 @@ gdk_wayland_drop_context_update_targets (GdkDragContext *context)
|
||||
device = gdk_drag_context_get_device (context);
|
||||
display = gdk_device_get_display (device);
|
||||
g_list_free (context->targets);
|
||||
context->targets = g_list_copy (gdk_wayland_selection_get_targets (display));
|
||||
context->targets = g_list_copy (gdk_wayland_selection_get_targets (display,
|
||||
gdk_drag_get_selection (context)));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -463,59 +477,6 @@ gdk_wayland_drag_context_get_data_source (GdkDragContext *context)
|
||||
return GDK_WAYLAND_DRAG_CONTEXT (context)->data_source;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_drag_context_undo_grab (GdkDragContext *context)
|
||||
{
|
||||
GdkEventSequence *sequence;
|
||||
GdkModifierType state;
|
||||
GdkDevice *device;
|
||||
GdkEvent *event;
|
||||
guint button;
|
||||
gdouble x, y;
|
||||
|
||||
device = gdk_drag_context_get_device (context);
|
||||
_gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device), &sequence);
|
||||
gdk_window_get_device_position_double (gdk_drag_context_get_source_window (context),
|
||||
device, &x, &y, &state);
|
||||
|
||||
if (sequence)
|
||||
{
|
||||
event = gdk_event_new (GDK_TOUCH_END);
|
||||
event->touch.window = g_object_ref (gdk_drag_context_get_source_window (context));
|
||||
event->touch.send_event = TRUE;
|
||||
event->touch.sequence = sequence;
|
||||
event->touch.time = GDK_CURRENT_TIME;
|
||||
event->touch.x = event->touch.x_root = x;
|
||||
event->touch.y = event->touch.y_root = y;
|
||||
}
|
||||
else if (state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))
|
||||
{
|
||||
if (state & GDK_BUTTON1_MASK)
|
||||
button = 1;
|
||||
else if (state & GDK_BUTTON2_MASK)
|
||||
button = 2;
|
||||
else if (state & GDK_BUTTON3_MASK)
|
||||
button = 3;
|
||||
else
|
||||
return;
|
||||
|
||||
event = gdk_event_new (GDK_BUTTON_RELEASE);
|
||||
event->button.window = g_object_ref (gdk_drag_context_get_source_window (context));
|
||||
event->button.send_event = TRUE;
|
||||
event->button.button = button;
|
||||
event->button.time = GDK_CURRENT_TIME;
|
||||
event->button.x = event->button.x_root = x;
|
||||
event->button.y = event->button.y_root = y;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, device);
|
||||
|
||||
_gdk_wayland_display_deliver_event (gdk_device_get_display (device), event);
|
||||
}
|
||||
|
||||
GdkWindow *
|
||||
gdk_wayland_drag_context_get_dnd_window (GdkDragContext *context)
|
||||
{
|
||||
|
||||
@@ -125,8 +125,6 @@ GdkDragContext * gdk_wayland_drag_context_lookup_by_data_source (struct wl_dat
|
||||
GdkDragContext * gdk_wayland_drag_context_lookup_by_source_window (GdkWindow *window);
|
||||
struct wl_data_source * gdk_wayland_drag_context_get_data_source (GdkDragContext *context);
|
||||
|
||||
void gdk_wayland_drag_context_undo_grab (GdkDragContext *context);
|
||||
|
||||
void gdk_wayland_drop_context_update_targets (GdkDragContext *context);
|
||||
|
||||
void _gdk_wayland_display_create_window_impl (GdkDisplay *display,
|
||||
@@ -187,6 +185,8 @@ struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_devic
|
||||
void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
|
||||
struct wl_data_source *source);
|
||||
|
||||
void gdk_wayland_device_unset_grab (GdkDevice *device);
|
||||
|
||||
void gdk_wayland_device_unset_touch_grab (GdkDevice *device,
|
||||
GdkEventSequence *sequence);
|
||||
|
||||
@@ -237,10 +237,15 @@ GdkWaylandSelection * gdk_wayland_display_get_selection (GdkDisplay *display);
|
||||
GdkWaylandSelection * gdk_wayland_selection_new (void);
|
||||
void gdk_wayland_selection_free (GdkWaylandSelection *selection);
|
||||
|
||||
void gdk_wayland_selection_ensure_offer (GdkDisplay *display,
|
||||
struct wl_data_offer *wl_offer);
|
||||
void gdk_wayland_selection_set_offer (GdkDisplay *display,
|
||||
GdkAtom selection,
|
||||
struct wl_data_offer *wl_offer);
|
||||
struct wl_data_offer * gdk_wayland_selection_get_offer (GdkDisplay *display);
|
||||
GList * gdk_wayland_selection_get_targets (GdkDisplay *display);
|
||||
struct wl_data_offer * gdk_wayland_selection_get_offer (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
GList * gdk_wayland_selection_get_targets (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
|
||||
void gdk_wayland_selection_store (GdkWindow *window,
|
||||
GdkAtom type,
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
typedef struct _SelectionBuffer SelectionBuffer;
|
||||
typedef struct _StoredSelection StoredSelection;
|
||||
typedef struct _AsyncWriteData AsyncWriteData;
|
||||
typedef struct _DataOfferData DataOfferData;
|
||||
|
||||
struct _SelectionBuffer
|
||||
{
|
||||
@@ -64,6 +65,13 @@ struct _DataSourceData
|
||||
GdkAtom selection;
|
||||
};
|
||||
|
||||
struct _DataOfferData
|
||||
{
|
||||
struct wl_data_offer *offer;
|
||||
GList *targets; /* List of GdkAtom */
|
||||
GdkAtom requested_target;
|
||||
};
|
||||
|
||||
struct _AsyncWriteData
|
||||
{
|
||||
GOutputStream *stream;
|
||||
@@ -81,14 +89,14 @@ static GdkAtom atoms[2] = { 0 };
|
||||
struct _GdkWaylandSelection
|
||||
{
|
||||
/* Destination-side data */
|
||||
struct wl_data_offer *offer;
|
||||
GdkAtom source_requested_target;
|
||||
|
||||
DataOfferData *dnd_offer;
|
||||
DataOfferData *clipboard_offer;
|
||||
GHashTable *offers; /* Currently alive offers, Hashtable of wl_data_offer->DataOfferData */
|
||||
GHashTable *selection_buffers; /* Hashtable of target_atom->SelectionBuffer */
|
||||
GList *targets; /* List of GdkAtom */
|
||||
|
||||
/* Source-side data */
|
||||
StoredSelection stored_selection;
|
||||
GArray *source_targets;
|
||||
|
||||
struct wl_data_source *clipboard_source;
|
||||
GdkWindow *clipboard_owner;
|
||||
@@ -259,6 +267,25 @@ selection_buffer_read (SelectionBuffer *buffer)
|
||||
buffer);
|
||||
}
|
||||
|
||||
static DataOfferData *
|
||||
data_offer_data_new (struct wl_data_offer *offer)
|
||||
{
|
||||
DataOfferData *info;
|
||||
|
||||
info = g_slice_new0 (DataOfferData);
|
||||
info->offer = offer;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
static void
|
||||
data_offer_data_free (DataOfferData *info)
|
||||
{
|
||||
wl_data_offer_destroy (info->offer);
|
||||
g_list_free (info->targets);
|
||||
g_slice_free (DataOfferData, info);
|
||||
}
|
||||
|
||||
GdkWaylandSelection *
|
||||
gdk_wayland_selection_new (void)
|
||||
{
|
||||
@@ -270,8 +297,13 @@ gdk_wayland_selection_new (void)
|
||||
|
||||
selection = g_new0 (GdkWaylandSelection, 1);
|
||||
selection->selection_buffers =
|
||||
g_hash_table_new_full (NULL, NULL, NULL,
|
||||
(GDestroyNotify) selection_buffer_cancel_and_unref);
|
||||
g_hash_table_new_full (NULL, NULL, NULL,
|
||||
(GDestroyNotify) selection_buffer_cancel_and_unref);
|
||||
selection->offers =
|
||||
g_hash_table_new_full (NULL, NULL, NULL,
|
||||
(GDestroyNotify) data_offer_data_free);
|
||||
selection->stored_selection.fd = -1;
|
||||
selection->source_targets = g_array_new (FALSE, FALSE, sizeof (GdkAtom));
|
||||
return selection;
|
||||
}
|
||||
|
||||
@@ -279,10 +311,9 @@ void
|
||||
gdk_wayland_selection_free (GdkWaylandSelection *selection)
|
||||
{
|
||||
g_hash_table_destroy (selection->selection_buffers);
|
||||
g_array_unref (selection->source_targets);
|
||||
|
||||
if (selection->targets)
|
||||
g_list_free (selection->targets);
|
||||
|
||||
g_hash_table_destroy (selection->offers);
|
||||
g_free (selection->stored_selection.data);
|
||||
|
||||
if (selection->stored_selection.cancellable)
|
||||
@@ -294,8 +325,6 @@ gdk_wayland_selection_free (GdkWaylandSelection *selection)
|
||||
if (selection->stored_selection.fd > 0)
|
||||
close (selection->stored_selection.fd);
|
||||
|
||||
if (selection->offer)
|
||||
wl_data_offer_destroy (selection->offer);
|
||||
if (selection->clipboard_source)
|
||||
wl_data_source_destroy (selection->clipboard_source);
|
||||
if (selection->dnd_source)
|
||||
@@ -310,57 +339,105 @@ data_offer_offer (void *data,
|
||||
const char *type)
|
||||
{
|
||||
GdkWaylandSelection *selection = data;
|
||||
DataOfferData *info;
|
||||
GdkAtom atom = gdk_atom_intern (type, FALSE);
|
||||
|
||||
if (g_list_find (selection->targets, atom))
|
||||
info = g_hash_table_lookup (selection->offers, wl_data_offer);
|
||||
|
||||
if (!info || g_list_find (info->targets, atom))
|
||||
return;
|
||||
|
||||
selection->targets = g_list_prepend (selection->targets, atom);
|
||||
info->targets = g_list_prepend (info->targets, atom);
|
||||
}
|
||||
|
||||
static const struct wl_data_offer_listener data_offer_listener = {
|
||||
data_offer_offer,
|
||||
};
|
||||
|
||||
DataOfferData *
|
||||
selection_lookup_offer_by_atom (GdkWaylandSelection *selection,
|
||||
GdkAtom selection_atom)
|
||||
{
|
||||
if (selection_atom == atoms[ATOM_CLIPBOARD])
|
||||
return selection->clipboard_offer;
|
||||
else if (selection_atom == atoms[ATOM_DND])
|
||||
return selection->dnd_offer;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_selection_ensure_offer (GdkDisplay *display,
|
||||
struct wl_data_offer *wl_offer)
|
||||
{
|
||||
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
|
||||
DataOfferData *info;
|
||||
|
||||
info = g_hash_table_lookup (selection->offers, wl_offer);
|
||||
|
||||
if (!info)
|
||||
{
|
||||
info = data_offer_data_new (wl_offer);
|
||||
g_hash_table_insert (selection->offers, wl_offer, info);
|
||||
wl_data_offer_add_listener (wl_offer,
|
||||
&data_offer_listener,
|
||||
selection);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_selection_set_offer (GdkDisplay *display,
|
||||
GdkAtom selection_atom,
|
||||
struct wl_data_offer *wl_offer)
|
||||
{
|
||||
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
|
||||
struct wl_data_offer *prev_offer;
|
||||
DataOfferData *info;
|
||||
|
||||
if (selection->offer == wl_offer)
|
||||
return;
|
||||
info = g_hash_table_lookup (selection->offers, wl_offer);
|
||||
|
||||
if (selection->offer)
|
||||
wl_data_offer_destroy (selection->offer);
|
||||
prev_offer = gdk_wayland_selection_get_offer (display, selection_atom);
|
||||
|
||||
selection->offer = wl_offer;
|
||||
if (prev_offer)
|
||||
g_hash_table_remove (selection->offers, prev_offer);
|
||||
|
||||
if (wl_offer)
|
||||
wl_data_offer_add_listener (wl_offer,
|
||||
&data_offer_listener,
|
||||
selection);
|
||||
if (selection_atom == atoms[ATOM_CLIPBOARD])
|
||||
selection->clipboard_offer = info;
|
||||
else if (selection_atom == atoms[ATOM_DND])
|
||||
selection->dnd_offer = info;
|
||||
|
||||
/* Clear all buffers */
|
||||
g_hash_table_remove_all (selection->selection_buffers);
|
||||
g_list_free (selection->targets);
|
||||
selection->targets = NULL;
|
||||
}
|
||||
|
||||
struct wl_data_offer *
|
||||
gdk_wayland_selection_get_offer (GdkDisplay *display)
|
||||
gdk_wayland_selection_get_offer (GdkDisplay *display,
|
||||
GdkAtom selection_atom)
|
||||
{
|
||||
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
|
||||
const DataOfferData *info;
|
||||
|
||||
return selection->offer;
|
||||
info = selection_lookup_offer_by_atom (selection, selection_atom);
|
||||
|
||||
if (info)
|
||||
return info->offer;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GList *
|
||||
gdk_wayland_selection_get_targets (GdkDisplay *display)
|
||||
gdk_wayland_selection_get_targets (GdkDisplay *display,
|
||||
GdkAtom selection_atom)
|
||||
{
|
||||
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
|
||||
const DataOfferData *info;
|
||||
|
||||
return selection->targets;
|
||||
info = selection_lookup_offer_by_atom (selection, selection_atom);
|
||||
|
||||
if (info)
|
||||
return info->targets;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -465,6 +542,15 @@ gdk_wayland_selection_check_write (GdkWaylandSelection *selection)
|
||||
selection->stored_selection.data_len == 0)
|
||||
return FALSE;
|
||||
|
||||
/* Cancel any previous ongoing async write */
|
||||
if (selection->stored_selection.cancellable)
|
||||
{
|
||||
g_cancellable_cancel (selection->stored_selection.cancellable);
|
||||
g_object_unref (selection->stored_selection.cancellable);
|
||||
}
|
||||
|
||||
selection->stored_selection.cancellable = g_cancellable_new ();
|
||||
|
||||
write_data = async_write_data_new (selection);
|
||||
async_write_data_write (write_data);
|
||||
selection->stored_selection.fd = -1;
|
||||
@@ -491,10 +577,16 @@ gdk_wayland_selection_store (GdkWindow *window,
|
||||
if (mode != GDK_PROP_MODE_REPLACE &&
|
||||
type != selection->stored_selection.type)
|
||||
{
|
||||
gchar *type_str, *stored_str;
|
||||
|
||||
type_str = gdk_atom_name (type);
|
||||
stored_str = gdk_atom_name (selection->stored_selection.type);
|
||||
|
||||
g_warning (G_STRLOC ": Attempted to append/prepend selection data with "
|
||||
"type %s into the current selection with type %s",
|
||||
gdk_atom_name (type),
|
||||
gdk_atom_name (selection->stored_selection.type));
|
||||
type_str, stored_str);
|
||||
g_free (type_str);
|
||||
g_free (stored_str);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -511,17 +603,10 @@ gdk_wayland_selection_store (GdkWindow *window,
|
||||
g_free (selection->stored_selection.data);
|
||||
}
|
||||
|
||||
if (selection->stored_selection.cancellable)
|
||||
{
|
||||
g_cancellable_cancel (selection->stored_selection.cancellable);
|
||||
g_object_unref (selection->stored_selection.cancellable);
|
||||
}
|
||||
|
||||
selection->stored_selection.source = window;
|
||||
selection->stored_selection.data_len = array->len;
|
||||
selection->stored_selection.data = (guchar *) g_array_free (array, FALSE);
|
||||
selection->stored_selection.type = type;
|
||||
selection->stored_selection.cancellable = g_cancellable_new ();
|
||||
|
||||
gdk_wayland_selection_check_write (selection);
|
||||
}
|
||||
@@ -545,12 +630,34 @@ gdk_wayland_selection_lookup_requestor_buffer (GdkWindow *requestor)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_selection_source_handles_target (GdkWaylandSelection *wayland_selection,
|
||||
GdkAtom target)
|
||||
{
|
||||
GdkAtom atom;
|
||||
guint i;
|
||||
|
||||
if (target == GDK_NONE)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < wayland_selection->source_targets->len; i++)
|
||||
{
|
||||
atom = g_array_index (wayland_selection->source_targets, GdkAtom, i);
|
||||
|
||||
if (atom == target)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
|
||||
GdkWindow *window,
|
||||
GdkAtom target,
|
||||
gint fd)
|
||||
{
|
||||
DataOfferData *offer;
|
||||
GdkAtom selection;
|
||||
|
||||
if (wayland_selection->clipboard_owner == window)
|
||||
@@ -560,19 +667,33 @@ gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
offer = selection_lookup_offer_by_atom (wayland_selection, selection);
|
||||
|
||||
if (wayland_selection->stored_selection.fd == fd &&
|
||||
wayland_selection->source_requested_target == target)
|
||||
offer->requested_target == target)
|
||||
return FALSE;
|
||||
|
||||
/* If we didn't issue gdk_wayland_selection_check_write() yet
|
||||
* on a previous fd, it will still linger here. Just close it,
|
||||
* as we can't have more than one fd on the fly.
|
||||
*/
|
||||
if (wayland_selection->stored_selection.fd >= 0)
|
||||
close (wayland_selection->stored_selection.fd);
|
||||
|
||||
wayland_selection->stored_selection.fd = fd;
|
||||
offer->requested_target = target;
|
||||
|
||||
wayland_selection->source_requested_target = target;
|
||||
|
||||
if (window && target != GDK_NONE)
|
||||
if (window &&
|
||||
gdk_wayland_selection_source_handles_target (wayland_selection, target))
|
||||
{
|
||||
gdk_wayland_selection_emit_request (window, selection, target);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
close (fd);
|
||||
wayland_selection->stored_selection.fd = -1;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -633,7 +754,10 @@ data_source_send (void *data,
|
||||
G_STRFUNC, source, mime_type, fd);
|
||||
|
||||
if (!mime_type)
|
||||
return;
|
||||
{
|
||||
close (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
context = gdk_wayland_drag_context_lookup_by_data_source (source);
|
||||
|
||||
@@ -642,7 +766,10 @@ data_source_send (void *data,
|
||||
else if (source == wayland_selection->clipboard_source)
|
||||
window = wayland_selection->clipboard_owner;
|
||||
else
|
||||
return;
|
||||
{
|
||||
close (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gdk_wayland_selection_request_target (wayland_selection, window,
|
||||
gdk_atom_intern (mime_type, FALSE),
|
||||
@@ -651,12 +778,10 @@ data_source_send (void *data,
|
||||
|
||||
if (context)
|
||||
{
|
||||
gdk_wayland_drag_context_undo_grab (context);
|
||||
gdk_wayland_device_unset_grab (gdk_drag_context_get_device (context));
|
||||
_gdk_wayland_drag_context_emit_event (context, GDK_DROP_FINISHED,
|
||||
GDK_CURRENT_TIME);
|
||||
}
|
||||
|
||||
wayland_selection->source_requested_target = GDK_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -679,7 +804,7 @@ data_source_cancelled (void *data,
|
||||
context = gdk_wayland_drag_context_lookup_by_data_source (source);
|
||||
|
||||
if (context)
|
||||
gdk_wayland_drag_context_undo_grab (context);
|
||||
gdk_wayland_device_unset_grab (gdk_drag_context_get_device (context));
|
||||
}
|
||||
else if (source == wayland_selection->clipboard_source)
|
||||
gdk_wayland_selection_unset_data_source (display, atoms[ATOM_CLIPBOARD]);
|
||||
@@ -879,8 +1004,14 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
|
||||
{
|
||||
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
|
||||
SelectionBuffer *buffer_data;
|
||||
struct wl_data_offer *offer;
|
||||
gchar *mimetype;
|
||||
GList *target_list;
|
||||
|
||||
if (!wayland_selection->offer)
|
||||
offer = gdk_wayland_selection_get_offer (display, selection);
|
||||
target_list = gdk_wayland_selection_get_targets (display, selection);
|
||||
|
||||
if (!offer)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
@@ -898,10 +1029,12 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
|
||||
return;
|
||||
}
|
||||
|
||||
mimetype = gdk_atom_name (target);
|
||||
|
||||
if (target != gdk_atom_intern_static_string ("TARGETS"))
|
||||
wl_data_offer_accept (wayland_selection->offer,
|
||||
wl_data_offer_accept (offer,
|
||||
_gdk_wayland_display_get_serial (GDK_WAYLAND_DISPLAY (display)),
|
||||
gdk_atom_name (target));
|
||||
mimetype);
|
||||
|
||||
buffer_data = g_hash_table_lookup (wayland_selection->selection_buffers,
|
||||
target);
|
||||
@@ -912,25 +1045,23 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
|
||||
{
|
||||
GInputStream *stream = NULL;
|
||||
int pipe_fd[2], natoms = 0;
|
||||
GdkAtom *atoms = NULL;
|
||||
GdkAtom *targets = NULL;
|
||||
|
||||
if (target == gdk_atom_intern_static_string ("TARGETS"))
|
||||
{
|
||||
gint i = 0;
|
||||
GList *l;
|
||||
|
||||
natoms = g_list_length (wayland_selection->targets);
|
||||
atoms = g_new0 (GdkAtom, natoms);
|
||||
natoms = g_list_length (target_list);
|
||||
targets = g_new0 (GdkAtom, natoms);
|
||||
|
||||
for (l = wayland_selection->targets; l; l = l->next)
|
||||
atoms[i++] = l->data;
|
||||
for (l = target_list; l; l = l->next)
|
||||
targets[i++] = l->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_unix_open_pipe (pipe_fd, FD_CLOEXEC, NULL);
|
||||
wl_data_offer_receive (wayland_selection->offer,
|
||||
gdk_atom_name (target),
|
||||
pipe_fd[1]);
|
||||
wl_data_offer_receive (offer, mimetype, pipe_fd[1]);
|
||||
stream = g_unix_input_stream_new (pipe_fd[0], TRUE);
|
||||
close (pipe_fd[1]);
|
||||
}
|
||||
@@ -941,11 +1072,11 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
|
||||
if (stream)
|
||||
g_object_unref (stream);
|
||||
|
||||
if (atoms)
|
||||
if (targets)
|
||||
{
|
||||
/* Store directly the local atoms */
|
||||
selection_buffer_append_data (buffer_data, atoms, natoms * sizeof (GdkAtom));
|
||||
g_free (atoms);
|
||||
selection_buffer_append_data (buffer_data, targets, natoms * sizeof (GdkAtom));
|
||||
g_free (targets);
|
||||
}
|
||||
|
||||
g_hash_table_insert (wayland_selection->selection_buffers,
|
||||
@@ -955,6 +1086,8 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
|
||||
|
||||
if (!buffer_data->stream)
|
||||
selection_buffer_notify (buffer_data);
|
||||
|
||||
g_free (mimetype);
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -1011,6 +1144,8 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
|
||||
guint ntargets,
|
||||
GdkAtom *targets)
|
||||
{
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
|
||||
struct wl_data_source *data_source;
|
||||
guint i;
|
||||
|
||||
@@ -1021,8 +1156,15 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
|
||||
if (!data_source)
|
||||
return;
|
||||
|
||||
g_array_append_vals (wayland_selection->source_targets, targets, ntargets);
|
||||
|
||||
for (i = 0; i < ntargets; i++)
|
||||
wl_data_source_offer (data_source, gdk_atom_name (targets[i]));
|
||||
{
|
||||
gchar *mimetype = gdk_atom_name (targets[i]);
|
||||
|
||||
wl_data_source_offer (data_source, mimetype);
|
||||
g_free (mimetype);
|
||||
}
|
||||
|
||||
if (selection == atoms[ATOM_CLIPBOARD])
|
||||
{
|
||||
@@ -1041,5 +1183,8 @@ void
|
||||
gdk_wayland_selection_clear_targets (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
|
||||
|
||||
g_array_set_size (wayland_selection->source_targets, 0);
|
||||
gdk_wayland_selection_unset_data_source (display, selection);
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ struct _GdkWindowImplWayland
|
||||
unsigned int use_custom_surface : 1;
|
||||
unsigned int pending_commit : 1;
|
||||
unsigned int awaiting_frame : 1;
|
||||
unsigned int position_set : 1;
|
||||
GdkWindowTypeHint hint;
|
||||
GdkWindow *transient_for;
|
||||
|
||||
@@ -157,6 +158,8 @@ static void gdk_wayland_window_configure (GdkWindow *window,
|
||||
|
||||
static void maybe_set_gtk_surface_dbus_properties (GdkWindow *window);
|
||||
|
||||
static void gdk_window_request_transient_parent_commit (GdkWindow *window);
|
||||
|
||||
GType _gdk_window_impl_wayland_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE (GdkWindowImplWayland, _gdk_window_impl_wayland, GDK_TYPE_WINDOW_IMPL)
|
||||
@@ -881,6 +884,7 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
|
||||
impl->surface, parent_impl->surface);
|
||||
wl_subsurface_set_position (impl->subsurface, window->x, window->y);
|
||||
wl_subsurface_set_desync (impl->subsurface);
|
||||
gdk_window_request_transient_parent_commit (window);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1108,12 +1112,6 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
|
||||
x = window->x - parent_x;
|
||||
y = window->y - parent_y;
|
||||
|
||||
if (parent_impl->xdg_surface)
|
||||
{
|
||||
x -= parent_impl->margin_left;
|
||||
y -= parent_impl->margin_top;
|
||||
}
|
||||
|
||||
impl->xdg_popup = xdg_shell_get_xdg_popup (display->xdg_shell,
|
||||
impl->surface,
|
||||
parent_impl->surface,
|
||||
@@ -1179,7 +1177,7 @@ static void
|
||||
gdk_wayland_window_map (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
GdkWindow *transient_for;
|
||||
GdkWindow *transient_for = NULL;
|
||||
|
||||
if (!should_be_mapped (window))
|
||||
return;
|
||||
@@ -1189,17 +1187,50 @@ gdk_wayland_window_map (GdkWindow *window)
|
||||
/* Popup menus can appear without a transient parent, which means they
|
||||
* cannot be positioned properly on Wayland. This attempts to guess the
|
||||
* surface they should be positioned with by finding the surface beneath
|
||||
* the device that created the grab for the popup window
|
||||
* the device that created the grab for the popup window.
|
||||
*/
|
||||
if (!impl->transient_for && impl->hint == GDK_WINDOW_TYPE_HINT_POPUP_MENU)
|
||||
{
|
||||
transient_for = gdk_device_get_window_at_position (impl->grab_device, NULL, NULL);
|
||||
transient_for = gdk_window_get_toplevel (transient_for);
|
||||
GdkDevice *grab_device;
|
||||
|
||||
/* start the popup at the position of the device that holds the grab */
|
||||
gdk_window_get_device_position (transient_for,
|
||||
impl->grab_device,
|
||||
&window->x, &window->y, NULL);
|
||||
/* The popup menu window is not the grabbed window. This may mean
|
||||
* that a "transfer window" (see gtkmenu.c) is used, and we need
|
||||
* to find that window to get the grab device. If so is the case
|
||||
* the "transfer window" can be retrieved via the
|
||||
* "gdk-attached-grab-window" associated data field.
|
||||
*/
|
||||
if (!impl->grab_device)
|
||||
{
|
||||
GdkWindow *attached_grab_window =
|
||||
g_object_get_data (G_OBJECT (window),
|
||||
"gdk-attached-grab-window");
|
||||
if (attached_grab_window)
|
||||
{
|
||||
GdkWindowImplWayland *attached_impl =
|
||||
GDK_WINDOW_IMPL_WAYLAND (attached_grab_window->impl);
|
||||
grab_device = attached_impl->grab_device;
|
||||
transient_for =
|
||||
gdk_device_get_window_at_position (grab_device,
|
||||
NULL, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
grab_device = impl->grab_device;
|
||||
transient_for =
|
||||
gdk_device_get_window_at_position (grab_device, NULL, NULL);
|
||||
}
|
||||
|
||||
if (transient_for)
|
||||
transient_for = gdk_window_get_toplevel (transient_for);
|
||||
|
||||
/* If the position was not explicitly set, start the popup at the
|
||||
* position of the device that holds the grab.
|
||||
*/
|
||||
if (!impl->position_set)
|
||||
gdk_window_get_device_position (transient_for,
|
||||
impl->grab_device,
|
||||
&window->x, &window->y, NULL);
|
||||
}
|
||||
else
|
||||
transient_for = impl->transient_for;
|
||||
@@ -1418,6 +1449,7 @@ gdk_window_wayland_move_resize (GdkWindow *window,
|
||||
{
|
||||
window->x = x;
|
||||
window->y = y;
|
||||
impl->position_set = 1;
|
||||
|
||||
if (impl->subsurface)
|
||||
{
|
||||
|
||||
+4
-4
@@ -610,12 +610,12 @@ _gdk_x11_get_window_child_info (GdkDisplay *display,
|
||||
{
|
||||
xResourceReq *resource_req;
|
||||
xGetPropertyReq *prop_req;
|
||||
Window window = state.children[i];
|
||||
Window win = state.children[i];
|
||||
|
||||
if (get_wm_state)
|
||||
{
|
||||
GetReq (GetProperty, prop_req);
|
||||
prop_req->window = window;
|
||||
prop_req->window = win;
|
||||
prop_req->property = wm_state_atom;
|
||||
prop_req->type = AnyPropertyType;
|
||||
prop_req->delete = False;
|
||||
@@ -625,10 +625,10 @@ _gdk_x11_get_window_child_info (GdkDisplay *display,
|
||||
state.child_states[i].seq[CHILD_INFO_GET_PROPERTY] = dpy->request;
|
||||
}
|
||||
|
||||
GetResReq(GetWindowAttributes, window, resource_req);
|
||||
GetResReq(GetWindowAttributes, win, resource_req);
|
||||
state.child_states[i].seq[CHILD_INFO_GET_WA] = dpy->request;
|
||||
|
||||
GetResReq(GetGeometry, window, resource_req);
|
||||
GetResReq(GetGeometry, win, resource_req);
|
||||
state.child_states[i].seq[CHILD_INFO_GET_GEOMETRY] = dpy->request;
|
||||
}
|
||||
|
||||
|
||||
@@ -466,10 +466,9 @@ gdk_x11_device_core_window_at_position (GdkDevice *device,
|
||||
{
|
||||
gint width, height;
|
||||
GList *toplevels, *list;
|
||||
Window pointer_window, root, child;
|
||||
Window pointer_window;
|
||||
int rootx = -1, rooty = -1;
|
||||
int winx, winy;
|
||||
unsigned int xmask;
|
||||
|
||||
/* FIXME: untrusted clients case not multidevice-safe */
|
||||
pointer_window = None;
|
||||
|
||||
@@ -534,7 +534,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
||||
{
|
||||
gint width, height;
|
||||
GList *toplevels, *list;
|
||||
Window pointer_window, root, child;
|
||||
Window pointer_window;
|
||||
|
||||
/* FIXME: untrusted clients case not multidevice-safe */
|
||||
pointer_window = None;
|
||||
|
||||
@@ -214,7 +214,6 @@ translate_device_classes (GdkDisplay *display,
|
||||
case XIKeyClass:
|
||||
{
|
||||
XIKeyClassInfo *key_info = (XIKeyClassInfo *) class_info;
|
||||
gint i;
|
||||
|
||||
_gdk_device_set_keys (device, key_info->num_keycodes);
|
||||
|
||||
@@ -1508,11 +1507,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
if (gdk_device_get_mode (event->motion.device) == GDK_MODE_WINDOW)
|
||||
{
|
||||
GdkDevice *device = event->motion.device;
|
||||
|
||||
/* Update event coordinates from axes */
|
||||
gdk_device_get_axis (device, event->motion.axes, GDK_AXIS_X, &event->motion.x);
|
||||
gdk_device_get_axis (device, event->motion.axes, GDK_AXIS_Y, &event->motion.y);
|
||||
gdk_device_get_axis (event->motion.device, event->motion.axes, GDK_AXIS_X, &event->motion.x);
|
||||
gdk_device_get_axis (event->motion.device, event->motion.axes, GDK_AXIS_Y, &event->motion.y);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -151,7 +151,7 @@ _gdk_x11_display_free_translate_queue (GdkDisplay *display)
|
||||
|
||||
static void
|
||||
gdk_window_queue (GdkWindow *window,
|
||||
GdkWindowQueueItem *item)
|
||||
GdkWindowQueueItem *new_item)
|
||||
{
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (GDK_WINDOW_DISPLAY (window));
|
||||
|
||||
@@ -205,13 +205,13 @@ gdk_window_queue (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
item->window = window;
|
||||
item->serial = NextRequest (GDK_WINDOW_XDISPLAY (window));
|
||||
new_item->window = window;
|
||||
new_item->serial = NextRequest (GDK_WINDOW_XDISPLAY (window));
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (window),
|
||||
(gpointer *)&(item->window));
|
||||
(gpointer *)&(new_item->window));
|
||||
|
||||
g_queue_push_tail (display_x11->translate_queue, item);
|
||||
g_queue_push_tail (display_x11->translate_queue, new_item);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -372,17 +372,17 @@ update_keymaps (GdkX11Keymap *keymap_x11)
|
||||
for (i = 0; i < map_size; i++)
|
||||
{
|
||||
/* Get the key code at this point in the map. */
|
||||
gint keycode = keymap_x11->mod_keymap->modifiermap[i];
|
||||
gint code = keymap_x11->mod_keymap->modifiermap[i];
|
||||
gint j;
|
||||
KeySym *syms;
|
||||
guint mask;
|
||||
|
||||
/* Ignore invalid keycodes. */
|
||||
if (keycode < keymap_x11->min_keycode ||
|
||||
keycode > keymap_x11->max_keycode)
|
||||
if (code < keymap_x11->min_keycode ||
|
||||
code > keymap_x11->max_keycode)
|
||||
continue;
|
||||
|
||||
syms = keymap_x11->keymap + (keycode - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
|
||||
syms = keymap_x11->keymap + (code - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
|
||||
|
||||
mask = 0;
|
||||
for (j = 0; j < keymap_x11->keysyms_per_keycode; j++)
|
||||
@@ -398,7 +398,7 @@ update_keymaps (GdkX11Keymap *keymap_x11)
|
||||
mask |= GDK_SUPER_MASK;
|
||||
}
|
||||
|
||||
keymap_x11->modmap[i/keymap_x11->mod_keymap->max_keypermod] |= mask;
|
||||
keymap_x11->modmap[i / keymap_x11->mod_keymap->max_keypermod] |= mask;
|
||||
|
||||
/* The fourth modifier, GDK_MOD1_MASK is 1 << 3.
|
||||
* Each group of max_keypermod entries refers to the same modifier.
|
||||
|
||||
@@ -37,94 +37,7 @@
|
||||
#include <X11/Xatom.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
static const gchar xatoms_string[] =
|
||||
/* These are all the standard predefined X atoms */
|
||||
"\0" /* leave a space for None, even though it is not a predefined atom */
|
||||
"PRIMARY\0"
|
||||
"SECONDARY\0"
|
||||
"ARC\0"
|
||||
"ATOM\0"
|
||||
"BITMAP\0"
|
||||
"CARDINAL\0"
|
||||
"COLORMAP\0"
|
||||
"CURSOR\0"
|
||||
"CUT_BUFFER0\0"
|
||||
"CUT_BUFFER1\0"
|
||||
"CUT_BUFFER2\0"
|
||||
"CUT_BUFFER3\0"
|
||||
"CUT_BUFFER4\0"
|
||||
"CUT_BUFFER5\0"
|
||||
"CUT_BUFFER6\0"
|
||||
"CUT_BUFFER7\0"
|
||||
"DRAWABLE\0"
|
||||
"FONT\0"
|
||||
"INTEGER\0"
|
||||
"PIXMAP\0"
|
||||
"POINT\0"
|
||||
"RECTANGLE\0"
|
||||
"RESOURCE_MANAGER\0"
|
||||
"RGB_COLOR_MAP\0"
|
||||
"RGB_BEST_MAP\0"
|
||||
"RGB_BLUE_MAP\0"
|
||||
"RGB_DEFAULT_MAP\0"
|
||||
"RGB_GRAY_MAP\0"
|
||||
"RGB_GREEN_MAP\0"
|
||||
"RGB_RED_MAP\0"
|
||||
"STRING\0"
|
||||
"VISUALID\0"
|
||||
"WINDOW\0"
|
||||
"WM_COMMAND\0"
|
||||
"WM_HINTS\0"
|
||||
"WM_CLIENT_MACHINE\0"
|
||||
"WM_ICON_NAME\0"
|
||||
"WM_ICON_SIZE\0"
|
||||
"WM_NAME\0"
|
||||
"WM_NORMAL_HINTS\0"
|
||||
"WM_SIZE_HINTS\0"
|
||||
"WM_ZOOM_HINTS\0"
|
||||
"MIN_SPACE\0"
|
||||
"NORM_SPACE\0"
|
||||
"MAX_SPACE\0"
|
||||
"END_SPACE\0"
|
||||
"SUPERSCRIPT_X\0"
|
||||
"SUPERSCRIPT_Y\0"
|
||||
"SUBSCRIPT_X\0"
|
||||
"SUBSCRIPT_Y\0"
|
||||
"UNDERLINE_POSITION\0"
|
||||
"UNDERLINE_THICKNESS\0"
|
||||
"STRIKEOUT_ASCENT\0"
|
||||
"STRIKEOUT_DESCENT\0"
|
||||
"ITALIC_ANGLE\0"
|
||||
"X_HEIGHT\0"
|
||||
"QUAD_WIDTH\0"
|
||||
"WEIGHT\0"
|
||||
"POINT_SIZE\0"
|
||||
"RESOLUTION\0"
|
||||
"COPYRIGHT\0"
|
||||
"NOTICE\0"
|
||||
"FONT_NAME\0"
|
||||
"FAMILY_NAME\0"
|
||||
"FULL_NAME\0"
|
||||
"CAP_HEIGHT\0"
|
||||
"WM_CLASS\0"
|
||||
"WM_TRANSIENT_FOR\0"
|
||||
/* Below here, these are our additions. Increment N_CUSTOM_PREDEFINED
|
||||
* if you add any.
|
||||
*/
|
||||
"CLIPBOARD\0" /* = 69 */
|
||||
;
|
||||
|
||||
static const gint xatoms_offset[] = {
|
||||
0, 1, 9, 19, 23, 28, 35, 44, 53, 60, 72, 84,
|
||||
96, 108, 120, 132, 144, 156, 165, 170, 178, 185, 189, 201,
|
||||
218, 232, 245, 258, 274, 287, 301, 313, 320, 329, 336, 347,
|
||||
356, 374, 387, 400, 408, 424, 438, 452, 462, 473, 483, 493,
|
||||
507, 521, 533, 545, 564, 584, 601, 619, 632, 641, 652, 659,
|
||||
670, 681, 691, 698, 708, 720, 730, 741, 750, 767
|
||||
};
|
||||
|
||||
#define N_CUSTOM_PREDEFINED 1
|
||||
#define N_PREDEFINED_ATOMS 69
|
||||
|
||||
#define ATOM_TO_INDEX(atom) (GPOINTER_TO_UINT(atom))
|
||||
#define INDEX_TO_ATOM(atom) ((GdkAtom)GUINT_TO_POINTER(atom))
|
||||
@@ -156,7 +69,7 @@ lookup_cached_xatom (GdkDisplay *display,
|
||||
{
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
|
||||
if (ATOM_TO_INDEX (atom) < G_N_ELEMENTS (xatoms_offset) - N_CUSTOM_PREDEFINED)
|
||||
if (ATOM_TO_INDEX (atom) < N_PREDEFINED_ATOMS)
|
||||
return ATOM_TO_INDEX (atom);
|
||||
|
||||
if (display_x11->atom_from_virtual)
|
||||
@@ -291,7 +204,7 @@ gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
|
||||
|
||||
display_x11 = GDK_X11_DISPLAY (display);
|
||||
|
||||
if (xatom < G_N_ELEMENTS (xatoms_offset) - N_CUSTOM_PREDEFINED)
|
||||
if (xatom < N_PREDEFINED_ATOMS)
|
||||
return INDEX_TO_ATOM (xatom);
|
||||
|
||||
if (display_x11->atom_to_virtual)
|
||||
|
||||
@@ -53,20 +53,6 @@ static gboolean gdk_visual_equal (Visual *a,
|
||||
Visual *b);
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
static const gchar *const visual_names[] =
|
||||
{
|
||||
"static gray",
|
||||
"grayscale",
|
||||
"static color",
|
||||
"pseudo color",
|
||||
"true color",
|
||||
"direct color",
|
||||
};
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
G_DEFINE_TYPE (GdkX11Visual, gdk_x11_visual, GDK_TYPE_VISUAL)
|
||||
|
||||
static void
|
||||
|
||||
+8
-2
@@ -474,6 +474,7 @@ gtk_private_h_sources = \
|
||||
gtkorientableprivate.h \
|
||||
gtkpango.h \
|
||||
gtkpathbar.h \
|
||||
gtkplacessidebarprivate.h \
|
||||
gtkpopoverprivate.h \
|
||||
gtkprintoperation-private.h \
|
||||
gtkprintutils.h \
|
||||
@@ -481,6 +482,7 @@ gtk_private_h_sources = \
|
||||
gtkpixelcacheprivate.h \
|
||||
gtkquery.h \
|
||||
gtkrangeprivate.h \
|
||||
gtkrenderopsprivate.h \
|
||||
gtkrbtree.h \
|
||||
gtkrecentchooserdefault.h \
|
||||
gtkrecentchooserprivate.h \
|
||||
@@ -496,6 +498,7 @@ gtk_private_h_sources = \
|
||||
gtksearchenginesimple.h \
|
||||
gtksearchentryprivate.h \
|
||||
gtkselectionprivate.h \
|
||||
gtksidebarrowprivate.h \
|
||||
gtksettingsprivate.h \
|
||||
gtksizegroup-private.h \
|
||||
gtksizerequestcacheprivate.h \
|
||||
@@ -780,6 +783,7 @@ gtk_base_c_sources = \
|
||||
gtkrenderbackground.c \
|
||||
gtkrenderborder.c \
|
||||
gtkrendericon.c \
|
||||
gtkrenderops.c \
|
||||
gtkresources.c \
|
||||
gtkrevealer.c \
|
||||
gtkroundedbox.c \
|
||||
@@ -793,6 +797,7 @@ gtk_base_c_sources = \
|
||||
gtkseparatormenuitem.c \
|
||||
gtkseparatortoolitem.c \
|
||||
gtksettings.c \
|
||||
gtksidebarrow.c \
|
||||
gtksizegroup.c \
|
||||
gtksizerequest.c \
|
||||
gtksizerequestcache.c \
|
||||
@@ -1086,7 +1091,8 @@ templates = \
|
||||
ui/gtksearchbar.ui \
|
||||
ui/gtkscalebutton.ui \
|
||||
ui/gtkstatusbar.ui \
|
||||
ui/gtkvolumebutton.ui
|
||||
ui/gtkvolumebutton.ui \
|
||||
ui/gtksidebarrow.ui
|
||||
|
||||
#
|
||||
# rules to generate built sources
|
||||
@@ -1340,7 +1346,7 @@ distclean-local:
|
||||
if HAVE_INTROSPECTION
|
||||
introspection_files = \
|
||||
$(filter-out %private.h gtktextdisplay.h gtktextlayout.h gtkx.h, $(gtkinclude_HEADERS) $(a11yinclude_HEADERS) $(deprecatedinclude_HEADERS)) \
|
||||
$(filter-out %win32.c %quartz.c, $(gtk_base_c_sources)) \
|
||||
$(filter-out %win32.c, $(gtk_base_c_sources)) \
|
||||
gtkprintoperation-unix.c \
|
||||
gtktypebuiltins.h \
|
||||
gtktypebuiltins.c
|
||||
|
||||
@@ -136,6 +136,15 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
widget_class->get_preferred_height_for_width = gtk_alignment_get_preferred_height_for_width;
|
||||
widget_class->get_preferred_height_and_baseline_for_width = gtk_alignment_get_preferred_height_and_baseline_for_width;
|
||||
|
||||
/**
|
||||
* GtkAlignment:xalign:
|
||||
*
|
||||
* Horizontal position of child in available space. A value of 0.0
|
||||
* will flush the child left (or right, in RTL locales); a value
|
||||
* of 1.0 will flush the child right (or left, in RTL locales).
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_halign() on the child instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_XALIGN,
|
||||
g_param_spec_float("xalign",
|
||||
@@ -146,6 +155,15 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
0.5,
|
||||
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
|
||||
|
||||
/**
|
||||
* GtkAlignment:yalign:
|
||||
*
|
||||
* Vertical position of child in available space. A value of 0.0
|
||||
* will flush the child to the top; a value of 1.0 will flush the
|
||||
* child to the bottom.
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_valign() on the child instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_YALIGN,
|
||||
g_param_spec_float("yalign",
|
||||
@@ -155,6 +173,15 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
1.0,
|
||||
0.5,
|
||||
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
|
||||
/**
|
||||
* GtkAlignment:xscale:
|
||||
*
|
||||
* If available horizontal space is bigger than needed, how much
|
||||
* of it to use for the child. A value of 0.0 means none; a value
|
||||
* of 1.0 means all.
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_hexpand() on the child instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_XSCALE,
|
||||
g_param_spec_float("xscale",
|
||||
@@ -164,6 +191,15 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
1.0,
|
||||
1.0,
|
||||
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
|
||||
/**
|
||||
* GtkAlignment:yscale:
|
||||
*
|
||||
* If available vertical space is bigger than needed, how much
|
||||
* of it to use for the child. A value of 0.0 means none; a value
|
||||
* of 1.0 means all.
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_vexpand() on the child instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_YSCALE,
|
||||
g_param_spec_float("yscale",
|
||||
@@ -181,6 +217,8 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
* The padding to insert at the top of the widget.
|
||||
*
|
||||
* Since: 2.4
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_margin_top() instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TOP_PADDING,
|
||||
@@ -198,6 +236,8 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
* The padding to insert at the bottom of the widget.
|
||||
*
|
||||
* Since: 2.4
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_margin_bottom() instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BOTTOM_PADDING,
|
||||
@@ -215,6 +255,8 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
* The padding to insert at the left of the widget.
|
||||
*
|
||||
* Since: 2.4
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_margin_start() instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LEFT_PADDING,
|
||||
@@ -232,6 +274,8 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
* The padding to insert at the right of the widget.
|
||||
*
|
||||
* Since: 2.4
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_margin_end() instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_RIGHT_PADDING,
|
||||
|
||||
@@ -188,7 +188,8 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
|
||||
*
|
||||
* Child widget to appear next to the menu text.
|
||||
*
|
||||
* Deprecated: 3.10
|
||||
* Deprecated: 3.10: Use a #GtkMenuItem containing a #GtkBox with
|
||||
* a #GtkAccelLabel and a #GtkImage instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_IMAGE,
|
||||
@@ -205,7 +206,7 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
|
||||
*
|
||||
* Since: 2.16
|
||||
*
|
||||
* Deprecated: 3.10
|
||||
* Deprecated: 3.10: Use a named icon from the #GtkIconTheme instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_USE_STOCK,
|
||||
@@ -225,7 +226,8 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
|
||||
*
|
||||
* Since: 2.16
|
||||
*
|
||||
* Deprecated: 3.10
|
||||
* Deprecated: 3.10: Use a #GtkMenuItem containing a #GtkBox with
|
||||
* a #GtkAccelLabel and a #GtkImage instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ALWAYS_SHOW_IMAGE,
|
||||
@@ -242,7 +244,7 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
|
||||
*
|
||||
* Since: 2.16
|
||||
*
|
||||
* Deprecated: 3.10
|
||||
* Deprecated: 3.10: Use gtk_widget_add_accelerator() instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ACCEL_GROUP,
|
||||
|
||||
@@ -98,6 +98,16 @@ gtk_misc_class_init (GtkMiscClass *class)
|
||||
|
||||
widget_class->realize = gtk_misc_realize;
|
||||
|
||||
/**
|
||||
* GtkMisc:xalign:
|
||||
*
|
||||
* The horizontal alignment. A value of 0.0 means left alignment (or right
|
||||
* on RTL locales); a value of 1.0 means right alignment (or left on RTL
|
||||
* locales).
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_halign() instead. If you are using
|
||||
* #GtkLabel, use #GtkLabel:xalign instead.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_XALIGN,
|
||||
g_param_spec_float ("xalign",
|
||||
@@ -108,6 +118,15 @@ gtk_misc_class_init (GtkMiscClass *class)
|
||||
0.5,
|
||||
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
|
||||
|
||||
/**
|
||||
* GtkMisc:yalign:
|
||||
*
|
||||
* The vertical alignment. A value of 0.0 means top alignment;
|
||||
* a value of 1.0 means bottom alignment.
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_valign() instead. If you are using
|
||||
* #GtkLabel, use #GtkLabel:yalign instead.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_YALIGN,
|
||||
g_param_spec_float ("yalign",
|
||||
@@ -118,6 +137,15 @@ gtk_misc_class_init (GtkMiscClass *class)
|
||||
0.5,
|
||||
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
|
||||
|
||||
/**
|
||||
* GtkMisc:xpad:
|
||||
*
|
||||
* The amount of space to add on the left and right of the widget, in
|
||||
* pixels.
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_margin_start() and
|
||||
* gtk_widget_set_margin_end() instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_XPAD,
|
||||
g_param_spec_int ("xpad",
|
||||
@@ -128,6 +156,15 @@ gtk_misc_class_init (GtkMiscClass *class)
|
||||
0,
|
||||
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
|
||||
|
||||
/**
|
||||
* GtkMisc:ypad:
|
||||
*
|
||||
* The amount of space to add on the top and bottom of the widget, in
|
||||
* pixels.
|
||||
*
|
||||
* Deprecated: 3.14: Use gtk_widget_set_margin_top() and
|
||||
* gtk_widget_set_margin_bottom() instead
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_YPAD,
|
||||
g_param_spec_int ("ypad",
|
||||
|
||||
@@ -704,89 +704,6 @@ static const GScannerConfig gtk_rc_scanner_config =
|
||||
TRUE /* symbol_2_token */,
|
||||
FALSE /* scope_0_fallback */,
|
||||
};
|
||||
|
||||
static const gchar symbol_names[] =
|
||||
"include\0"
|
||||
"NORMAL\0"
|
||||
"ACTIVE\0"
|
||||
"PRELIGHT\0"
|
||||
"SELECTED\0"
|
||||
"INSENSITIVE\0"
|
||||
"fg\0"
|
||||
"bg\0"
|
||||
"text\0"
|
||||
"base\0"
|
||||
"xthickness\0"
|
||||
"ythickness\0"
|
||||
"font\0"
|
||||
"fontset\0"
|
||||
"font_name\0"
|
||||
"bg_pixmap\0"
|
||||
"pixmap_path\0"
|
||||
"style\0"
|
||||
"binding\0"
|
||||
"bind\0"
|
||||
"widget\0"
|
||||
"widget_class\0"
|
||||
"class\0"
|
||||
"lowest\0"
|
||||
"gtk\0"
|
||||
"application\0"
|
||||
"theme\0"
|
||||
"rc\0"
|
||||
"highest\0"
|
||||
"engine\0"
|
||||
"module_path\0"
|
||||
"stock\0"
|
||||
"im_module_file\0"
|
||||
"LTR\0"
|
||||
"RTL\0"
|
||||
"color\0"
|
||||
"unbind\0";
|
||||
|
||||
static const struct
|
||||
{
|
||||
guint name_offset;
|
||||
guint token;
|
||||
} symbols[] = {
|
||||
{ 0, GTK_RC_TOKEN_INCLUDE },
|
||||
{ 8, GTK_RC_TOKEN_NORMAL },
|
||||
{ 15, GTK_RC_TOKEN_ACTIVE },
|
||||
{ 22, GTK_RC_TOKEN_PRELIGHT },
|
||||
{ 31, GTK_RC_TOKEN_SELECTED },
|
||||
{ 40, GTK_RC_TOKEN_INSENSITIVE },
|
||||
{ 52, GTK_RC_TOKEN_FG },
|
||||
{ 55, GTK_RC_TOKEN_BG },
|
||||
{ 58, GTK_RC_TOKEN_TEXT },
|
||||
{ 63, GTK_RC_TOKEN_BASE },
|
||||
{ 68, GTK_RC_TOKEN_XTHICKNESS },
|
||||
{ 79, GTK_RC_TOKEN_YTHICKNESS },
|
||||
{ 90, GTK_RC_TOKEN_FONT },
|
||||
{ 95, GTK_RC_TOKEN_FONTSET },
|
||||
{ 103, GTK_RC_TOKEN_FONT_NAME },
|
||||
{ 113, GTK_RC_TOKEN_BG_PIXMAP },
|
||||
{ 123, GTK_RC_TOKEN_PIXMAP_PATH },
|
||||
{ 135, GTK_RC_TOKEN_STYLE },
|
||||
{ 141, GTK_RC_TOKEN_BINDING },
|
||||
{ 149, GTK_RC_TOKEN_BIND },
|
||||
{ 154, GTK_RC_TOKEN_WIDGET },
|
||||
{ 161, GTK_RC_TOKEN_WIDGET_CLASS },
|
||||
{ 174, GTK_RC_TOKEN_CLASS },
|
||||
{ 180, GTK_RC_TOKEN_LOWEST },
|
||||
{ 187, GTK_RC_TOKEN_GTK },
|
||||
{ 191, GTK_RC_TOKEN_APPLICATION },
|
||||
{ 203, GTK_RC_TOKEN_THEME },
|
||||
{ 209, GTK_RC_TOKEN_RC },
|
||||
{ 212, GTK_RC_TOKEN_HIGHEST },
|
||||
{ 220, GTK_RC_TOKEN_ENGINE },
|
||||
{ 227, GTK_RC_TOKEN_MODULE_PATH },
|
||||
{ 239, GTK_RC_TOKEN_STOCK },
|
||||
{ 245, GTK_RC_TOKEN_IM_MODULE_FILE },
|
||||
{ 260, GTK_RC_TOKEN_LTR },
|
||||
{ 264, GTK_RC_TOKEN_RTL },
|
||||
{ 268, GTK_RC_TOKEN_COLOR },
|
||||
{ 274, GTK_RC_TOKEN_UNBIND }
|
||||
};
|
||||
|
||||
static GHashTable *realized_style_ht = NULL;
|
||||
|
||||
@@ -1090,8 +1007,6 @@ gtk_rc_style_finalize (GObject *object)
|
||||
|
||||
if (rc_style->rc_properties)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < rc_style->rc_properties->len; i++)
|
||||
{
|
||||
GtkRcProperty *node = &g_array_index (rc_style->rc_properties, GtkRcProperty, i);
|
||||
@@ -1280,8 +1195,6 @@ gtk_rc_style_real_merge (GtkRcStyle *dest,
|
||||
|
||||
if (src->rc_properties)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < src->rc_properties->len; i++)
|
||||
insert_rc_property (dest,
|
||||
&g_array_index (src->rc_properties, GtkRcProperty, i),
|
||||
|
||||
@@ -154,9 +154,8 @@ gtk_recent_action_unselect_uri (GtkRecentChooser *chooser,
|
||||
|
||||
for (l = priv->choosers; l; l = l->next)
|
||||
{
|
||||
GtkRecentChooser *chooser = l->data;
|
||||
|
||||
gtk_recent_chooser_unselect_uri (chooser, uri);
|
||||
GtkRecentChooser *c = l->data;
|
||||
gtk_recent_chooser_unselect_uri (c, uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider,
|
||||
{
|
||||
GtkCssStyleProperty *prop = key;
|
||||
PropertyData *data = value;
|
||||
GtkCssValue *value;
|
||||
GtkCssValue *val;
|
||||
guint id;
|
||||
|
||||
id = _gtk_css_style_property_get_id (prop);
|
||||
@@ -325,11 +325,11 @@ gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider,
|
||||
if (!_gtk_css_lookup_is_missing (lookup, id))
|
||||
continue;
|
||||
|
||||
value = property_data_match_state (data, _gtk_css_matcher_get_state (matcher));
|
||||
if (value == NULL)
|
||||
val = property_data_match_state (data, _gtk_css_matcher_get_state (matcher));
|
||||
if (val == NULL)
|
||||
continue;
|
||||
|
||||
_gtk_css_lookup_set (lookup, id, NULL, value);
|
||||
_gtk_css_lookup_set (lookup, id, NULL, val);
|
||||
}
|
||||
|
||||
if (change)
|
||||
@@ -846,7 +846,7 @@ gtk_style_properties_merge (GtkStyleProperties *props,
|
||||
{
|
||||
GtkStylePropertiesPrivate *priv, *priv_to_merge;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
gpointer key, val;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props_to_merge));
|
||||
@@ -859,13 +859,13 @@ gtk_style_properties_merge (GtkStyleProperties *props,
|
||||
{
|
||||
g_hash_table_iter_init (&iter, priv_to_merge->color_map);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
while (g_hash_table_iter_next (&iter, &key, &val))
|
||||
{
|
||||
const gchar *name;
|
||||
GtkSymbolicColor *color;
|
||||
|
||||
name = key;
|
||||
color = value;
|
||||
color = val;
|
||||
|
||||
if (!replace &&
|
||||
g_hash_table_lookup (priv->color_map, name))
|
||||
@@ -878,9 +878,9 @@ gtk_style_properties_merge (GtkStyleProperties *props,
|
||||
/* Merge symbolic style properties */
|
||||
g_hash_table_iter_init (&iter, priv_to_merge->properties);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
while (g_hash_table_iter_next (&iter, &key, &val))
|
||||
{
|
||||
PropertyData *prop_to_merge = value;
|
||||
PropertyData *prop_to_merge = val;
|
||||
PropertyData *prop;
|
||||
guint i;
|
||||
|
||||
@@ -926,7 +926,6 @@ gtk_style_properties_merge (GtkStyleProperties *props,
|
||||
value->value != NULL)
|
||||
{
|
||||
GPtrArray *array, *array_to_merge;
|
||||
gint i;
|
||||
|
||||
/* Append the array, mainly thought
|
||||
* for the gtk-key-bindings property
|
||||
|
||||
@@ -1792,10 +1792,10 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
|
||||
for (col = 0; col < priv->ncols; col++)
|
||||
if (priv->cols[col].shrink)
|
||||
{
|
||||
gint allocation = priv->cols[col].allocation;
|
||||
gint alloc = priv->cols[col].allocation;
|
||||
|
||||
priv->cols[col].allocation = MAX (1, (gint) priv->cols[col].allocation - extra / nshrink);
|
||||
extra -= allocation - priv->cols[col].allocation;
|
||||
extra -= alloc - priv->cols[col].allocation;
|
||||
nshrink -= 1;
|
||||
if (priv->cols[col].allocation < 2)
|
||||
{
|
||||
@@ -1884,10 +1884,10 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
|
||||
for (row = 0; row < priv->nrows; row++)
|
||||
if (priv->rows[row].shrink)
|
||||
{
|
||||
gint allocation = priv->rows[row].allocation;
|
||||
gint alloc = priv->rows[row].allocation;
|
||||
|
||||
priv->rows[row].allocation = MAX (1, (gint) priv->rows[row].allocation - extra / nshrink);
|
||||
extra -= allocation - priv->rows[row].allocation;
|
||||
extra -= alloc - priv->rows[row].allocation;
|
||||
nshrink -= 1;
|
||||
if (priv->rows[row].allocation < 2)
|
||||
{
|
||||
|
||||
@@ -2952,9 +2952,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
if (in_popup && !popup_accels)
|
||||
{
|
||||
/* don't show accels in popups */
|
||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (info->proxy));
|
||||
if (GTK_IS_ACCEL_LABEL (child))
|
||||
g_object_set (child, "accel-closure", NULL, NULL);
|
||||
GtkWidget *c = gtk_bin_get_child (GTK_BIN (info->proxy));
|
||||
if (GTK_IS_ACCEL_LABEL (c))
|
||||
g_object_set (c, "accel-closure", NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,6 +132,8 @@ needs_explicit_setting (MyParserData *data,
|
||||
{ "GtkRadioButton", "draw-indicator", 0 },
|
||||
{ "GtkGrid", "left-attach", 1 },
|
||||
{ "GtkGrid", "top-attach", 1 },
|
||||
{ "GtkWidget", "hexpand", 0 },
|
||||
{ "GtkWidget", "vexpand", 0 },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
const gchar *class_name;
|
||||
|
||||
@@ -2108,7 +2108,6 @@ text_buffer_new (GtkAboutDialog *about,
|
||||
gchar *link;
|
||||
gchar *uri;
|
||||
const gchar *link_type;
|
||||
GtkTextTag *tag;
|
||||
|
||||
if (*q1 == '<')
|
||||
{
|
||||
|
||||
+3
-2
@@ -132,7 +132,6 @@ enum {
|
||||
static GHashTable *accel_entry_ht = NULL; /* accel_path -> AccelEntry */
|
||||
static GSList *accel_filters = NULL;
|
||||
static gulong accel_map_signals[LAST_SIGNAL] = { 0, };
|
||||
static GtkAccelMap *accel_map;
|
||||
|
||||
/* --- prototypes --- */
|
||||
static void do_accel_map_changed (AccelEntry *entry);
|
||||
@@ -1021,10 +1020,12 @@ gtk_accel_map_class_init (GtkAccelMapClass *accel_map_class)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_accel_map_init (GtkAccelMap *accel_map)
|
||||
gtk_accel_map_init (GtkAccelMap *map)
|
||||
{
|
||||
}
|
||||
|
||||
static GtkAccelMap *accel_map;
|
||||
|
||||
/**
|
||||
* gtk_accel_map_get:
|
||||
*
|
||||
|
||||
@@ -414,7 +414,6 @@ accels_set_accels_for_action (Accels *accels,
|
||||
if (keys)
|
||||
{
|
||||
gchar *my_key;
|
||||
gint i;
|
||||
|
||||
my_key = g_strdup (action_and_target);
|
||||
|
||||
|
||||
+109
-6
@@ -84,6 +84,7 @@ struct _GtkAssistantPage
|
||||
GtkAssistantPageType type;
|
||||
guint complete : 1;
|
||||
guint complete_set : 1;
|
||||
guint has_padding : 1;
|
||||
|
||||
gchar *title;
|
||||
|
||||
@@ -196,7 +197,8 @@ enum
|
||||
CHILD_PROP_PAGE_TITLE,
|
||||
CHILD_PROP_PAGE_HEADER_IMAGE,
|
||||
CHILD_PROP_PAGE_SIDEBAR_IMAGE,
|
||||
CHILD_PROP_PAGE_COMPLETE
|
||||
CHILD_PROP_PAGE_COMPLETE,
|
||||
CHILD_PROP_HAS_PADDING
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -622,6 +624,10 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gtk_container_class_install_child_property (container_class, CHILD_PROP_HAS_PADDING,
|
||||
g_param_spec_boolean ("has-padding", P_("Has padding"), P_("Whether the assistant adds padding around the page"),
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
|
||||
/* Bind class to template
|
||||
*/
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
@@ -1109,8 +1115,8 @@ on_page_notify_visibility (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
assistant_remove_page_cb (GtkNotebook *notebook,
|
||||
GtkWidget *page,
|
||||
assistant_remove_page_cb (GtkNotebook *notebook,
|
||||
GtkWidget *page,
|
||||
GtkAssistant *assistant)
|
||||
{
|
||||
GtkAssistantPrivate *priv = assistant->priv;
|
||||
@@ -1118,6 +1124,15 @@ assistant_remove_page_cb (GtkNotebook *notebook,
|
||||
GList *page_node;
|
||||
GList *element;
|
||||
|
||||
if (GTK_IS_BOX (page))
|
||||
{
|
||||
GList *children;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (page));
|
||||
page = GTK_WIDGET (children->data);
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
element = find_page (assistant, page);
|
||||
if (!element)
|
||||
return;
|
||||
@@ -1236,6 +1251,10 @@ gtk_assistant_set_child_property (GtkContainer *container,
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (container), child,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
case CHILD_PROP_HAS_PADDING:
|
||||
gtk_assistant_set_page_has_padding (GTK_ASSISTANT (container), child,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
|
||||
break;
|
||||
@@ -1277,6 +1296,10 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
g_value_set_boolean (value,
|
||||
gtk_assistant_get_page_complete (assistant, child));
|
||||
break;
|
||||
case CHILD_PROP_HAS_PADDING:
|
||||
g_value_set_boolean (value,
|
||||
gtk_assistant_get_page_has_padding (assistant, child));
|
||||
break;
|
||||
default:
|
||||
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
|
||||
break;
|
||||
@@ -1445,12 +1468,16 @@ gtk_assistant_remove (GtkContainer *container,
|
||||
GtkWidget *page)
|
||||
{
|
||||
GtkAssistant *assistant = (GtkAssistant*) container;
|
||||
GtkWidget *box;
|
||||
|
||||
/* Forward this removal to the content notebook */
|
||||
if (gtk_widget_get_parent (page) == assistant->priv->content)
|
||||
box = gtk_widget_get_parent (page);
|
||||
if (GTK_IS_BOX (box) &&
|
||||
assistant->priv->content != NULL &&
|
||||
gtk_widget_get_parent (box) == assistant->priv->content)
|
||||
{
|
||||
container = (GtkContainer *) assistant->priv->content;
|
||||
gtk_container_remove (container, page);
|
||||
gtk_container_remove (container, box);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1743,6 +1770,7 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
|
||||
GtkAssistantPage *page_info;
|
||||
gint n_pages;
|
||||
GtkStyleContext *context;
|
||||
GtkWidget *box;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
|
||||
@@ -1754,6 +1782,7 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
|
||||
page_info = g_slice_new0 (GtkAssistantPage);
|
||||
page_info->page = page;
|
||||
page_info->regular_title = gtk_label_new (NULL);
|
||||
page_info->has_padding = TRUE;
|
||||
gtk_widget_set_no_show_all (page_info->regular_title, TRUE);
|
||||
page_info->current_title = gtk_label_new (NULL);
|
||||
gtk_widget_set_no_show_all (page_info->current_title, TRUE);
|
||||
@@ -1785,7 +1814,12 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
|
||||
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->regular_title, 2 * position);
|
||||
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->current_title, 2 * position + 1);
|
||||
|
||||
gtk_notebook_insert_page (GTK_NOTEBOOK (priv->content), page, NULL, position);
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_show (box);
|
||||
gtk_box_pack_start (GTK_BOX (box), page, TRUE, TRUE, 0);
|
||||
g_object_set (box, "margin", 12, NULL);
|
||||
|
||||
gtk_notebook_insert_page (GTK_NOTEBOOK (priv->content), box, NULL, position);
|
||||
|
||||
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
|
||||
{
|
||||
@@ -2352,6 +2386,75 @@ gtk_assistant_get_page_complete (GtkAssistant *assistant,
|
||||
return page_info->complete;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_assistant_set_page_has_padding:
|
||||
* @assistant: a #GtkAssistant
|
||||
* @page: a page of @assistant
|
||||
* @has_padding: whether this page has padding
|
||||
*
|
||||
* Sets whether the assistant is adding padding around
|
||||
* the page.
|
||||
*
|
||||
* Since: 3.18
|
||||
*/
|
||||
void
|
||||
gtk_assistant_set_page_has_padding (GtkAssistant *assistant,
|
||||
GtkWidget *page,
|
||||
gboolean has_padding)
|
||||
{
|
||||
GtkAssistantPage *page_info;
|
||||
GList *child;
|
||||
|
||||
g_return_if_fail (GTK_IS_ASSISTANT (assistant));
|
||||
g_return_if_fail (GTK_IS_WIDGET (page));
|
||||
|
||||
child = find_page (assistant, page);
|
||||
|
||||
g_return_if_fail (child != NULL);
|
||||
|
||||
page_info = (GtkAssistantPage*) child->data;
|
||||
|
||||
if (page_info->has_padding != has_padding)
|
||||
{
|
||||
page_info->has_padding = has_padding;
|
||||
|
||||
g_object_set (gtk_widget_get_parent (page),
|
||||
"margin", has_padding ? 12 : 0,
|
||||
NULL);
|
||||
|
||||
gtk_container_child_notify (GTK_CONTAINER (assistant), page, "has-padding");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_assistant_get_page_has_padding:
|
||||
* @assistant: a #GtkAssistant
|
||||
* @page: a page of @assistant
|
||||
*
|
||||
* Gets whether page has padding.
|
||||
*
|
||||
* Returns: %TRUE if @page has padding
|
||||
* Since: 3.18
|
||||
*/
|
||||
gboolean
|
||||
gtk_assistant_get_page_has_padding (GtkAssistant *assistant,
|
||||
GtkWidget *page)
|
||||
{
|
||||
GtkAssistantPage *page_info;
|
||||
GList *child;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), FALSE);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (page), FALSE);
|
||||
|
||||
child = find_page (assistant, page);
|
||||
|
||||
g_return_val_if_fail (child != NULL, TRUE);
|
||||
|
||||
page_info = (GtkAssistantPage*) child->data;
|
||||
|
||||
return page_info->has_padding;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_assistant_update_buttons_state:
|
||||
* @assistant: a #GtkAssistant
|
||||
|
||||
@@ -217,6 +217,14 @@ void gtk_assistant_update_buttons_state (GtkAssistant *assista
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_assistant_commit (GtkAssistant *assistant);
|
||||
|
||||
GDK_AVAILABLE_IN_3_18
|
||||
void gtk_assistant_set_page_has_padding (GtkAssistant *assistant,
|
||||
GtkWidget *page,
|
||||
gboolean has_padding);
|
||||
GDK_AVAILABLE_IN_3_18
|
||||
gboolean gtk_assistant_get_page_has_padding (GtkAssistant *assistant,
|
||||
GtkWidget *page);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ASSISTANT_H__ */
|
||||
|
||||
@@ -163,11 +163,11 @@ gtk_builder_menu_start_element (GMarkupParseContext *context,
|
||||
{
|
||||
const gchar *typestr;
|
||||
const gchar *name;
|
||||
const gchar *context;
|
||||
const gchar *ctxt;
|
||||
|
||||
if (COLLECT (STRING, "name", &name,
|
||||
OPTIONAL | BOOLEAN, "translatable", &state->translatable,
|
||||
OPTIONAL | STRING, "context", &context,
|
||||
OPTIONAL | STRING, "context", &ctxt,
|
||||
OPTIONAL | STRING, "comments", NULL, /* ignore, just for translators */
|
||||
OPTIONAL | STRING, "type", &typestr))
|
||||
{
|
||||
@@ -182,7 +182,7 @@ gtk_builder_menu_start_element (GMarkupParseContext *context,
|
||||
state->type = typestr ? g_variant_type_new (typestr) : NULL;
|
||||
state->string = g_string_new (NULL);
|
||||
state->attribute = g_strdup (name);
|
||||
state->context = g_strdup (context);
|
||||
state->context = g_strdup (ctxt);
|
||||
|
||||
gtk_builder_menu_push_frame (state, NULL, NULL);
|
||||
}
|
||||
|
||||
+1
-1
@@ -2435,7 +2435,7 @@ gtk_builder_add_callback_symbols (GtkBuilder *builder,
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_builder_lookup_callback_symbol:
|
||||
* gtk_builder_lookup_callback_symbol: (skip)
|
||||
* @builder: a #GtkBuilder
|
||||
* @callback_name: The name of the callback
|
||||
*
|
||||
|
||||
@@ -15,13 +15,6 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* TODO
|
||||
* - touch
|
||||
* - accessible relations for popups
|
||||
* - saving per-application (?)
|
||||
* - better popup theming
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkcoloreditorprivate.h"
|
||||
@@ -209,7 +202,9 @@ popup_edit (GtkWidget *widget,
|
||||
focus = editor->priv->a_entry;
|
||||
}
|
||||
|
||||
if (popup)
|
||||
if (popup == editor->priv->current_popup)
|
||||
dismiss_current_popup (editor);
|
||||
else if (popup)
|
||||
{
|
||||
dismiss_current_popup (editor);
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (editor));
|
||||
|
||||
+17
-4
@@ -41,6 +41,7 @@ struct _GtkColorSwatchPrivate
|
||||
guint has_color : 1;
|
||||
guint use_alpha : 1;
|
||||
guint selectable : 1;
|
||||
guint has_menu : 1;
|
||||
|
||||
GdkWindow *event_window;
|
||||
|
||||
@@ -52,7 +53,8 @@ enum
|
||||
{
|
||||
PROP_ZERO,
|
||||
PROP_RGBA,
|
||||
PROP_SELECTABLE
|
||||
PROP_SELECTABLE,
|
||||
PROP_HAS_MENU
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -82,6 +84,7 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
|
||||
swatch->priv = gtk_color_swatch_get_instance_private (swatch);
|
||||
swatch->priv->use_alpha = TRUE;
|
||||
swatch->priv->selectable = TRUE;
|
||||
swatch->priv->has_menu = TRUE;
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (swatch), TRUE);
|
||||
gtk_widget_set_has_window (GTK_WIDGET (swatch), FALSE);
|
||||
@@ -357,7 +360,7 @@ swatch_key_press (GtkWidget *widget,
|
||||
event->keyval == GDK_KEY_KP_Enter ||
|
||||
event->keyval == GDK_KEY_KP_Space)
|
||||
{
|
||||
if (swatch->priv->has_color &&
|
||||
if (swatch->priv->has_color &&
|
||||
swatch->priv->selectable &&
|
||||
(gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_SELECTED) == 0)
|
||||
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_SELECTED, FALSE);
|
||||
@@ -517,7 +520,7 @@ tap_action (GtkGestureMultiPress *gesture,
|
||||
}
|
||||
else if (button == GDK_BUTTON_SECONDARY)
|
||||
{
|
||||
if (swatch->priv->has_color)
|
||||
if (swatch->priv->has_color && swatch->priv->has_menu)
|
||||
do_popup (GTK_WIDGET (swatch), button, gtk_get_current_event_time ());
|
||||
}
|
||||
}
|
||||
@@ -575,7 +578,7 @@ swatch_realize (GtkWidget *widget)
|
||||
gtk_widget_set_window (widget, window);
|
||||
g_object_ref (window);
|
||||
|
||||
swatch->priv->event_window =
|
||||
swatch->priv->event_window =
|
||||
gdk_window_new (window,
|
||||
&attributes, attributes_mask);
|
||||
gtk_widget_register_window (widget, swatch->priv->event_window);
|
||||
@@ -641,6 +644,9 @@ swatch_get_property (GObject *object,
|
||||
case PROP_SELECTABLE:
|
||||
g_value_set_boolean (value, gtk_color_swatch_get_selectable (swatch));
|
||||
break;
|
||||
case PROP_HAS_MENU:
|
||||
g_value_set_boolean (value, swatch->priv->has_menu);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -663,6 +669,9 @@ swatch_set_property (GObject *object,
|
||||
case PROP_SELECTABLE:
|
||||
gtk_color_swatch_set_selectable (swatch, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_HAS_MENU:
|
||||
swatch->priv->has_menu = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -728,10 +737,14 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class)
|
||||
g_object_class_install_property (object_class, PROP_SELECTABLE,
|
||||
g_param_spec_boolean ("selectable", P_("Selectable"), P_("Whether the swatch is selectable"),
|
||||
TRUE, GTK_PARAM_READWRITE));
|
||||
g_object_class_install_property (object_class, PROP_HAS_MENU,
|
||||
g_param_spec_boolean ("has-menu", P_("Has Menu"), P_("Whether the swatch should offer customization"),
|
||||
TRUE, GTK_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_COLOR_SWATCH_ACCESSIBLE);
|
||||
}
|
||||
|
||||
|
||||
/* Public API {{{1 */
|
||||
|
||||
GtkWidget *
|
||||
|
||||
+2
-3
@@ -2622,14 +2622,13 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (gtk_widget_get_visible (priv->popup_widget))
|
||||
{
|
||||
gint width, menu_width;
|
||||
gint menu_width;
|
||||
|
||||
if (priv->wrap_width == 0)
|
||||
{
|
||||
GtkAllocation combo_box_allocation;
|
||||
|
||||
gtk_widget_get_allocation (GTK_WIDGET (combo_box), &combo_box_allocation);
|
||||
width = combo_box_allocation.width;
|
||||
gtk_widget_set_size_request (priv->popup_widget, -1, -1);
|
||||
|
||||
if (combo_box->priv->popup_fixed_width)
|
||||
@@ -2638,7 +2637,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
||||
gtk_widget_get_preferred_width (priv->popup_widget, NULL, &menu_width);
|
||||
|
||||
gtk_widget_set_size_request (priv->popup_widget,
|
||||
MAX (width, menu_width), -1);
|
||||
MAX (combo_box_allocation.width, menu_width), -1);
|
||||
}
|
||||
|
||||
/* reposition the menu after giving it a new width */
|
||||
|
||||
@@ -41,18 +41,18 @@ gtk_css_image_win32_draw (GtkCssImage *image,
|
||||
if (wimage->state2 >= 0)
|
||||
{
|
||||
cairo_surface_t *surface2;
|
||||
cairo_t *cr;
|
||||
cairo_t *cr2;
|
||||
int dx2, dy2;
|
||||
|
||||
surface2 = _gtk_win32_theme_part_create_surface (wimage->theme, wimage->part2, wimage->state2, wimage->margins,
|
||||
width, height, &dx2, &dy2);
|
||||
|
||||
cr = cairo_create (surface);
|
||||
cr2 = cairo_create (surface);
|
||||
|
||||
cairo_set_source_surface (cr, surface2, dx2 - dx, dy2-dy);
|
||||
cairo_paint_with_alpha (cr, wimage->over_alpha);
|
||||
|
||||
cairo_destroy (cr);
|
||||
cairo_set_source_surface (cr2, surface2, dx2 - dx, dy2-dy);
|
||||
cairo_paint_with_alpha (cr2, wimage->over_alpha);
|
||||
|
||||
cairo_destroy (cr2);
|
||||
|
||||
cairo_surface_destroy (surface2);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
{
|
||||
PangoFontDescription *description;
|
||||
char *font_name;
|
||||
GtkCssValue *value;
|
||||
|
||||
g_object_get (settings, "gtk-font-name", &font_name, NULL);
|
||||
description = pango_font_description_from_string (font_name);
|
||||
@@ -76,9 +75,12 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
|
||||
if (pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_FAMILY)
|
||||
{
|
||||
value = _gtk_css_array_value_new (_gtk_css_string_value_new (pango_font_description_get_family (description)));
|
||||
GtkCssValue *val;
|
||||
|
||||
val = _gtk_css_array_value_new (_gtk_css_string_value_new (pango_font_description_get_family (description)));
|
||||
pango_font_description_free (description);
|
||||
return value;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
pango_font_description_free (description);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user