1. 24 Apr, 2018 3 commits
    • LRN's avatar
      GDK W32: Switch to GdkCairoContext · 7002f08c
      LRN authored
      * Remove DC refcounting (we trust GDK to always do
        begin_frame/end_frame calls in pairs)
      * Now that there's no GDK-provided double-buffer up the stack,
        double-buffering is implemented here
        (though it's disabled by default - in my tests it didn't provide
         any visual improvements, but did decrease performance).
      * For some reason delaying window resizes until the point where
        we need to blit the double-buffer into the window leads
        to visual glitches, so doulbe-buffered windows are resized
        in begin_frame, same as non-double-buffered ones.
      * New code to clear the paint region, for all drawing modes.
        Hopefully, it isn't duplicated anywhere up the stack.
      * GL has its own context now, so remove any GL-related comments.
      * Layered windows are still used (because cairo actually works
        better with them)
      * A bit more code re-use for layered windows
      * Some functions that were local to gdksurface-win32.c are made
        usable for the whole backend
      * Drag-indicator drawing is temporarily commented out to match
        a similar change in X11 backend
      7002f08c
    • Benjamin Otte's avatar
      drawcontext: Only pass the region that matters · 83ea0b37
      Benjamin Otte authored
      We used to pass 2 regions to GdkDrawCotnext.end_frame() but code was
      confusing what they meant. So we now don't do that anymore and only pass
      the region that matters: The frame region.
      83ea0b37
    • Benjamin Otte's avatar
      gdk: Add Cairo context implementations for all backends · 813e9c95
      Benjamin Otte authored
      And make the GdkCairoContext as abstract.
      
      The idea of this and thje following commits is to get rid of all
      Cairo code in gdksurface.c (and $backend/gdksurface-$backend.c)
      by moving that code into the Cairo context files.
      In particular, the GdkSurfaceClass.begin_frame/end_frame()
      functions (which are currently exclusively used by the Cairo code
      should end up being moved to GdkDrawContextClass.begin/end_frame().
      
      This has multiple benefits:
      
      1. It unifies code between the different drawing contexts.
         GL lives in GLContext, Vulkan in VulkanContext and Cairo in
         CairoContext. In turn, this makes it way easier to reason about
         what's going on in surface-specific code. Currently pretty much
         all backends do things wrong when they want to sync to drawing
         or to the frame clock.
      
      2. It makes the API of GdkSurface smaller. No drawing code (apart
         from creating the contexts) needs to remain.
      
      3. It confines Cairo to the Drawcontext, thereby making it way
         more obvious when backends are still using it in situations
         where it may now conflict with OpenGL (like when doing the dnd
         failed animation or in the APIs that I'm removing in this
         branch).
      
      4. We have 2 very different types of Cairo contexts: The X/win32
         model, where we have a natively supported Cairo backend but do
         double buffering ourselves and use similar surfaces and the
         Wayland/Broadway model where we use image surfaces without any
         Cairo backend support and have to submit the buffers manually.
         By not sharing code between those 2 versions, we can make the
         actual code way smaller. We also get around the need to create
         1x1 image surfaces in the Wayland backend where we pretend
         there's a native Cairo surface.
      813e9c95
  2. 11 Apr, 2018 1 commit
  3. 10 Apr, 2018 1 commit
  4. 09 Apr, 2018 2 commits
    • LRN's avatar
      GDK W32: use clock after_paint signal for timing updates · 27d9f233
      LRN authored
      * Previous commit had misleading info. The code was
      added to begin_paint() instead of end_paint(). Though
      that did not affect its performance in any visible way.
      * Company advised to move the code to an "after_paint" signal
      handler, so that it works on all renderers, not just Cairo.
      This change caused high fluctuation in FPS values in fishbowl
      when it is put in a situation where it cannot achieve 60fps
      (such as using Cairo renderer at ultra-high resolution).
      This seems to be deliberate and not a bug.
      27d9f233
    • LRN's avatar
      GDK W32: set update frequency and timestamp · c7ef6970
      LRN authored
      There is no easily apparent way of being notified when frame updates
      happene exactly, so we just query frame info at the end of each paint.
      If we query too often (faster than DWM refresh rate), we just get
      the same values twice in a row, but that is, hopefully, highly unlikely.
      c7ef6970
  5. 29 Mar, 2018 12 commits
    • LRN's avatar
      GDK W32: Remember surface cursor, implicit surface grab · 79557271
      LRN authored
      This commit ensures that each GdkSurface impl remembers the
      cursor that GDK sets for it, and that this cursor is set
      each time WM_SETCURSOR is called for that sufrace's HWND.
      This is needed because W32, unlike X, has no per-window cursors -
      the cursor on W32 is a global resource, and we need to keep track
      of which cursor should be set when pointer is over which surface
      ourselves (WM_SETCURSOR exists exactly for this reason).
      
      This commit also makes GDK remember the surface that has an implicit
      grab (since implicit grabs are gone from the upper levels of the toolkit),
      and ensures that crossing events are correctly synthesized and the grab
      is broken when surface focus changes. This fixes a bug where opening
      a new window (by clicking something in some other, pre-existing window)
      will make that new window not get any mouse input due to the fact
      that the mouse-button-down event from that click caused an implicit
      grab on the pre-existing window, and that grab was not released afterward.
      79557271
    • LRN's avatar
      GDK W32: Use the new cursor class · a82d67bb
      LRN authored
      This makes all the code use the new cursor class instead of
      raw HCURSOR handles.
      a82d67bb
    • LRN's avatar
      GDK W32: New cursor class · d8da6d38
      LRN authored
      Instead of now-unused GdkWin32Cursor class (a subclass of GdkCursor),
      add a stand-alone GdkWin32HCursor class that is a wrapper around
      HCURSOR handle.
      
      On creation it's given a display instance, a HCURSOR handle and a boolean
      that indicates whether the HCURSOR handle can or cannot be destroyed
      (this depends on how the handle was obtained).
      That information is stored in a hash table inside the GdkWin32Display
      singleton, each entry of that table has reference count.
      When the GdkWin32HCursor object is finalized, it reduces the reference
      count on the table entry in the GdkWin32Display. When it's created,
      it either adds such an entry or refs an existing one.
      This way two pieces of code (or the same piece of code called
      multiple times) that independently obtain the same HCURSOR from the OS
      will get to different GdkWin32HCursor instances, but GdkWin32Display
      will know that both use the same handle.
      
      Once the reference count reaches 0 on the table entry, it is freed
      and the handle (if destroyable) is put on the destruction list,
      and an idle destruction function is queued.
      
      If the same handle is once again registered for use before the
      idle destructior is invoked (this happens, for example, when
      an old cursor is destroyed and then replaced with a new one),
      the handle gets removed from the destruction list.
      
      The destructor just calls DestroyCursor() on each handle, calling
      SetCursor(NULL) before doing that when the handle is in use.
      This ensures that SetCursor(NULL) (which will cause cursor to disappear,
      which is bad by itself, and which will also cause flickering if the
      cursor is set to a non-NULL again shortly afterward)
      is almost never called, unless GTK messes up and keeps using a cursor
      beyond its lifetime.
      
      This scheme also ensures that non-destructable cursors are not destroyed.
      
      It's also possible to call _gdk_win32_display_hcursor_ref()
      and _gdk_win32_display_hcursor_unref() manually instead of creating
      GdkWin32HCursor objects, but that is not recommended.
      d8da6d38
    • LRN's avatar
      GDK W32: the .area member of the expose event is gone · dbda7d77
      LRN authored
      The .area and .count members were removed in commit 5c7ee3a4
      
      https://bugzilla.gnome.org/show_bug.cgi?id=773299
      dbda7d77
    • LRN's avatar
    • LRN's avatar
      d1d94b86
    • LRN's avatar
    • LRN's avatar
    • LRN's avatar
      GDK W32: Adapt to event filter removal · ef01e6ee
      LRN authored
      Add a new W32 backend-specific message filtering mechanism.
      Works roughly the same way old event filtering did, but without
      events (events are GDK/X11 concept that never really made sense
      on W32), so there's no functionality for 'altering' events being
      emitted. If an event needs to be emitted in response to a message
      do it yourself.
      
      Implemented like this, it should give better performance than
      if we were to use GLib signals for this, since W32 sends a LOT
      of messages (unlike X11, which doesn't send events as often)
      all the time, and invoking the signal machinery on *each* message
      would probably be bad.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=773299
      ef01e6ee
    • LRN's avatar
    • LRN's avatar
      GDK W32: Another massive clipboard and DnD update · 54a43071
      LRN authored
      Rename GdkWin32Selection to GdkWin32Clipdrop, since GdkSelection
      is mostly gone, and the word "selection" does not reflect the
      functionality of this object too well.
      
      Clipboard is now handled by a separate thread, most of the code for
      it now lives in gdkclipdrop-win32.c, gdkclipboard-win32.c just uses
      clipdrop as a backend.
      
      The DnD source part is also put into a thread.
      The DnD target part does not spin the main loop, it just
      emits a GDK event and returns a default value if it doesn't get a reply
      by the time the event is processed.
      
      Both clipboard and DnD use a new GOutputStream subclass to get data
      from GTK and put it into a HGLOBAL.
      
      GdkWin32DragContext is split into GdkWin32DragContext and GdkWin32DropContext,
      anticipating a similar change that slated to happen to GdkDragContext.
      
      OLE2 DnD protocol is now used by default, set GDK_WIN32_OLE2_DND envvar to 0
      to make GDK use the old LOCAL and DROPFILES protocols.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=773299
      54a43071
    • Chun-wei Fan's avatar
      gdkglcontext-win32.c: Fix window->surface changes · 934354fb
      Chun-wei Fan authored
      Rename the GdkSurface variables to surface, and make sure that we are
      creating the context GObject correctly.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=773299
      934354fb
  6. 28 Mar, 2018 6 commits
  7. 24 Mar, 2018 4 commits
  8. 21 Mar, 2018 4 commits
  9. 20 Mar, 2018 5 commits
    • Alexander Larsson's avatar
      4ac450b3
    • Alexander Larsson's avatar
      GdkSurface: Rename lots of stuff from window->surface · 3dce0dcc
      Alexander Larsson authored
      Mostly these are internal things, but the major public change is
      that event.window is now event.surface.
      3dce0dcc
    • Alexander Larsson's avatar
      GdkSurface: Rename various functions and variables · 9a7e7211
      Alexander Larsson authored
      This is an automatic rename of various things related
      to the window->surface rename.
      
      Public symbols changed by this is:
       GDK_MODE_WINDOW
       gdk_device_get_window_at_position
       gdk_device_get_window_at_position_double
       gdk_device_get_last_event_window
       gdk_display_get_monitor_at_window
       gdk_drag_context_get_source_window
       gdk_drag_context_get_dest_window
       gdk_drag_context_get_drag_window
       gdk_draw_context_get_window
       gdk_drawing_context_get_window
       gdk_gl_context_get_window
       gdk_synthesize_window_state
       gdk_surface_get_window_type
       gdk_x11_display_set_window_scale
       gsk_renderer_new_for_window
       gsk_renderer_get_window
       gtk_text_view_buffer_to_window_coords
       gtk_tree_view_convert_widget_to_bin_window_coords
       gtk_tree_view_convert_tree_to_bin_window_coords
      
      The commands that generated this are:
      
      git sed -f g "GDK window" "GDK surface"
      git sed -f g window_impl surface_impl
      (cd gdk; git sed -f g impl_window impl_surface)
      git sed -f g WINDOW_IMPL SURFACE_IMPL
      git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
      git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
      git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
      git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
      git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
      git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface
      
      (cd gdk; git sed -f g window_type surface_type)
      git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type
      
      git sed -f g window_at_position surface_at_position
      git sed -f g event_window event_surface
      git sed -f g window_coord surface_coord
      git sed -f g window_state surface_state
      git sed -f g window_cursor surface_cursor
      git sed -f g window_scale surface_scale
      git sed -f g window_events surface_events
      git sed -f g monitor_at_window monitor_at_surface
      git sed -f g window_under_pointer surface_under_pointer
      (cd gdk; git sed -f g for_window for_surface)
      git sed -f g window_anchor surface_anchor
      git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
      git sed -f g native_window native_surface
      git sed -f g source_window source_surface
      git sed -f g dest_window dest_surface
      git sed -f g drag_window drag_surface
      git sed -f g input_window input_surface
      
      git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
      9a7e7211
    • Alexander Larsson's avatar
      GdkWindow -> GdkSurface: File renames · 890080eb
      Alexander Larsson authored
      Rename all *window.[ch] source files.
      
      This is an automatic operation, done by the following commands:
      
      for i in $(git ls-files gdk | grep window); do
          git mv $i $(echo $i | sed s/window/surface/);
          git sed -f g $(basename $i) $(basename $i | sed s/window/surface/) ;
      done
      
      git checkout NEWS* po-properties po
      890080eb
    • Alexander Larsson's avatar
      GdkWindow -> GdkSurface initial type rename · 391727bd
      Alexander Larsson authored
      This renames the GdkWindow class and related classes (impl, backend
      subclasses) to surface. Additionally it renames related types:
      GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
      GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge
      
      This is an automatic conversion using the below commands:
      
      git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass
      
      git sed -f g GdkWindow GdkSurface
      git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
      git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
      git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
      git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
      git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo
      
      git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
      git sed -f g "broadway_window" "broadway_surface"
      git sed -f g "BroadwayWindow" "BroadwaySurface"
      git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
      git sed -f g "wayland_window" "wayland_surface"
      git sed -f g "WaylandWindow" "WaylandSurface"
      git sed -f g "X11_WINDOW" "X11_SURFACE"
      git sed -f g "x11_window" "x11_surface"
      git sed -f g "X11Window" "X11Surface"
      git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
      git sed -f g "win32_window" "win32_surface"
      git sed -f g "Win32Window" "Win32Surface"
      git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
      git sed -f g "quartz_window" "quartz_surface"
      git sed -f g "QuartzWindow" "QuartzSurface"
      
      git checkout NEWS* po-properties
      391727bd
  10. 06 Feb, 2018 1 commit
    • Matthias Clasen's avatar
      The big versioning cleanup · 4c150d8e
      Matthias Clasen authored
      Remove all the old 2.x and 3.x version annotations.
      GTK+ 4 is a new start, and from the perspective of a
      GTK+ 4 developer all these APIs have been around since
      the beginning.
      4c150d8e
  11. 05 Feb, 2018 1 commit
    • Emmanuele Bassi's avatar
      Drop the last mentions of motion hint events · bfcb9780
      Emmanuele Bassi authored
      The GDK_POINTER_MOTION_HINT_MASK enumeration value is gone, but we're
      still keeping around the "is_hint" field in GdkEventMotion, even though
      every backend sets it to `false` — except for the core X11 device
      manager.
      bfcb9780