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_
|