File: gtk3inputwindow.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 (49 lines) | stat: -rw-r--r-- 1,139 bytes parent folder | download | duplicates (3)
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
48
49
/*
 * 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 Gtk3InputWindow : public InputWindow {
public:
    Gtk3InputWindow(ClassicUIConfig *config, FcitxGClient *client,
                    bool isWayland);

    ~Gtk3InputWindow();

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

private:
    void init();
    void draw(cairo_t *cr);
    void screenChanged();
    void reposition();
    void scroll(GdkEvent *event);
    void motion(GdkEvent *event);
    void release(GdkEvent *event);
    void leave();

    bool supportAlpha = false;
    UniqueCPtr<GtkWidget, gtk_widget_destroy> window_;
    GdkWindow *parent_ = nullptr;
    int width_ = 1;
    int height_ = 1;
    GdkRectangle rect_;
    double scrollDelta_ = 0;
    const bool isWayland_ = false;
    GdkRectangle lastRect_ = {0, 0, 0, 0};
};

} // namespace fcitx::gtk

#endif // _GTK3_GTK3INPUTWINDOW_H_