File: gtk4inputwindow.h

package info (click to toggle)
fcitx5-gtk 5.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 608 kB
  • sloc: cpp: 6,313; ansic: 1,268; makefile: 5
file content (47 lines) | stat: -rw-r--r-- 1,176 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * SPDX-FileCopyrightText: 2021~2021 CSSlayer <wengxt@gmail.com>
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 */
#ifndef _GTK3_GTK3INPUTWINDOW_H_
#define _GTK3_GTK3INPUTWINDOW_H_

#include "inputwindow.h"
#include <gtk/gtk.h>

namespace fcitx::gtk {

class Gtk4InputWindow : public InputWindow {
public:
    Gtk4InputWindow(ClassicUIConfig *config, FcitxGClient *client);

    ~Gtk4InputWindow();

    void setParent(GtkWidget *parent);
    void update() override;
    void setCursorRect(GdkRectangle rect);

private:
    void draw(cairo_t *cr);
    gboolean event(GdkEvent *event);
    void reposition();
    void surfaceNotifyMapped(GdkSurface *surface);
    void resetWindow();
    void syncFontOptions();

    bool supportAlpha = false;
    // Dummy widget to track font options.
    UniqueCPtr<GtkWindow, gtk_window_destroy> dummyWidget_;
    UniqueCPtr<GdkSurface, gdk_surface_destroy> window_;
    UniqueCPtr<GdkCairoContext, g_object_unref> cairoCcontext_;
    GtkWidget *parent_ = nullptr;
    size_t width_ = 1;
    size_t height_ = 1;
    GdkRectangle rect_;
    double scrollDelta_ = 0;
};

} // namespace fcitx::gtk

#endif // _GTK3_GTK3INPUTWINDOW_H_