gtk+ 4 status updatehistory 1998 — 1.0 really the gimp toolkit 1999 — 1.2 gobject 2002 — 2.0...

35
GTK+ 4 Status Update Matthias Clasen

Upload: others

Post on 21-Jan-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

GTK+ 4 Status UpdateMatthias Clasen

Page 2: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

History

1998 — 1.0

○ really the Gimp toolkit

1999 — 1.2

○ GObject

2002 — 2.0

○ Pango○ ATK○ cairo

2011 — 3.0

○ client-side windows○ client-side decorations○ CSS○ touch, gestures○ GL rendering○ broadway, wayland

Page 3: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Present

3.22

○ the final, stable 3.x series

3.90 — since mid-2016

○ integrate GSK, fully GL/Vulkan based rendering○ build with meson○ modernize GDK APIs○ fully switch to event controllers○ composite widgets

4.0 — 2018 ?

Page 4: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 3

Window

Button

Label: hello world

...

Page 5: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 3

Window

Button

Label: hello world

...

Create a cairo surface

Page 6: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 3

Call draw() on each widget...

Window

Button

Label: hello world

...

Page 7: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 3

Call draw functions to render CSS background, border, shadow...

Window

Button

Label: hello world

...

Page 8: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 3

Call Pango to render text...

Window

Button

Label: hello world

...

Page 9: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 3

Window

Button

Label: hello world

...

Send the completed frame to the display server

Page 10: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 4

Window

Button

Label: hello world

...

Page 11: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 4

Call snapshot() on each widget to create render nodes...

Window

Button

Label: hello world

...

Container

Shadow Color

Page 12: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 4

Create render nodes for CSS background, border, shadow...

Window

Button

Label: hello world

...

Container

Shadow Color

Clip Shadow Border

Container

Page 13: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 4

Call snapshot functions to create render nodes for text

Window

Button

Label: hello world

...

Container

Shadow Color

Clip Shadow Border

Shadow Glyphs

Container

Page 14: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 4

GSK translates render nodes into backend operations

Container

Shadow Color

Clip Shadow Border

Shadow Glyphs

Container

OpColor

OpLinearGradient

OpBorder

OpTexture

OpInsetShadow

OpText

Page 15: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 4

Upload textures and use Pango to render glyphs

Container

Shadow Color

Clip Shadow Border

Shadow Glyphs

Container

OpColor

OpLinearGradient

OpBorder

OpTexture

OpInsetShadow

OpText

OpColor

OpLinearGradient

Texture

Glyph atlas

Page 16: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Drawing in GTK+ 4

Send the render operations to the GPU

OpColor

OpLinearGradient

OpBorder

OpTexture

OpInsetShadow

OpText

OpColor

OpLinearGradient

Page 17: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Render nodes in the Inspector

Page 18: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Input in GTK+ 3

Window

Paned

Button

...

...

ButtonWindowX, Y

An event arrives

Page 19: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Input in GTK+ 3

Window

Paned

Button

...

...

ButtonWindowX, Y

Route it by matching the window

Window

Page 20: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Input in GTK+ 3

Window

Paned

Button

...

...

ButtonWindowX, Y

Emit event signals

::button-press-event

Page 21: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Input in GTK+ 3

Window

Paned

Button

...

...

ButtonWindowX, Y

...and propagate up

::button-press-event

Page 22: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Input in GTK+ 4

Window

Paned

Button

...

...

ButtonWindowX, Y

An event arrives

Page 23: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Input in GTK+ 4

Window

Paned

Button

...

...

ButtonWindowX, Y

Route it by matching coordinates, top-down (capture)

Page 24: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Input in GTK+ 4

Window

Paned

Button

...

...

ButtonWindowX, Y

...and back up (bubble)

Page 25: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Input in GTK+ 4

Window

Paned

Button

...

...

ButtonWindowX, Y

Pass the event to event controllers at each step

controller1controller2...

Page 26: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Composite Widgets in GTK+ 3

Custom drawing – not the CSS box modelCustom event handlingCode duplicationA spinbutton is an entry

Page 27: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Composite Widgets in GTK+ 4

Any widget can have children

Widgets are close to CSS boxes

Composition instead of subclassing

A switch is composed of○ two labels○ a slider

A spinbutton has○ an entry○ two buttons

Page 28: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

What’s done

Vulkan renderer

GL renderer

New GDK apis

Event controllers

Composite widgets

Page 29: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

What’s left to do

Write cool examples

Complete API cleanups

Expose shaders for applications

Transformations for widgets

‘Complicated’ widgets: treeview, textview

Page 30: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

How you can help

Write cool examples

Port an application

Convert custom widgets to new APIs

Find what doesn’t work, or is too complicated

Page 31: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Porting ?

Widgets are now visible by default

gtk_box_pack_start/end has less arguments

No more event->button

Page 32: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Heroes of GTK+ 4

Benjamin Otte

Emmanuele Bassi

Timm Bäder

Carlos Garnacho

Jonas Ådahl

Daniel Boles

Alexander Larsson

Chun-wei Fan

Руслан Ижбулатов

Page 33: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

References

GTK+ 4 roadmap: https://wiki.gnome.org/Projects/GTK+/Roadmap/GTK4

GTK+ sources: https://git.gnome.org/browse/gtk+/

GTK+ blog: https://blog.gtk.org/

GTK+ docs, migration guide: https://developer.gnome.org/gtk4/

Page 34: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Questions?

Page 35: GTK+ 4 Status UpdateHistory 1998 — 1.0 really the Gimp toolkit 1999 — 1.2 GObject 2002 — 2.0 Pango ATK cairo 2011 — 3.0 client-side windows client-side decorationsPresent 3.22

Thanks!