__wlInputPanel->changeVisibility(visible);
}
+stGeometry DSTextInputPrivate::inputPanelGetGeometry(DSWaylandSurface *window)
+{
+ return __wlInputPanel->getSurfaceGeometry(window);
+}
+
DSTextInput::DSTextInput()
: DS_INIT_PRIVATE_PTR(DSTextInput)
#include <DSCore.h>
#include <DSTextInput.h>
+#include <DSStruct.h>
namespace display_server
{
void updateInputPanelState(bool waitUpdate);
void setInputPanelTransientFor(DSWaylandSurface *window);
void changeInputPanelVisibility(bool visible);
+ stGeometry inputPanelGetGeometry(DSWaylandSurface *window);
private:
DSWaylandCompositor *__wlCompositor;
{
__dsTextInputPrivate->contextShowInputPanel();
int x = 0, y = 0, w = 0, h = 0;
- /* TODO: get gemetry from input panel */
+ stGeometry geometry = __dsTextInputPrivate->inputPanelGetGeometry(nullptr);
+ x = geometry.x;
+ y = geometry.y;
+ w = geometry.w;
+ h = geometry.h;
__dsTextInputPrivate->contextUpdateIseGeometry(x, y, w, h);
}
}
return __inputPanelFloating;
}
+stGeometry DSWaylandInputPanel::getSurfaceGeometry(DSWaylandSurface *wlSurface)
+{
+ return __inputPanelSurface->getGeometry(wlSurface);
+}
+
void DSWaylandInputPanel::__onEventIdleEnterer(void *data)
{
}
#endif
}
+stGeometry DSWaylandInputPanelSurfacePrivate::getGeometry(DSWaylandSurface *wlSurface)
+{
+ DSWindowManager *windowManager = DSWindowManager::getInstance();
+ stGeometry geometry = {0, };
+ for (auto it = __dataMap.begin(); it != __dataMap.end(); it++)
+ {
+ DSWaylandInputPanelSurfaceData *surfaceData = (*it).second;
+ if (!wlSurface || (wlSurface == surfaceData->getWlSurface()))
+ {
+ return windowManager->getWindowGeometry(surfaceData->getWlSurface());
+ }
+ }
+ windowManager->releaseInstance();
+ return geometry;
+}
+
void DSWaylandInputPanelSurfacePrivate::input_panel_surface_destroy_resource(Resource *resource)
{
auto it = __dataMap.find(resource);
priv->setFloatingPosition(x, y);
}
+stGeometry DSWaylandInputPanelSurface::getGeometry(DSWaylandSurface *wlSurface)
+{
+ DS_GET_PRIV(DSWaylandInputPanelSurface);
+
+ return priv->getGeometry(wlSurface);
+}
}
#include "DSCore.h"
#include "DSObject.h"
+#include "DSStruct.h"
#include "DSWaylandCompositor.h"
#include "DSEventLoop.h"
#include "DSTextInputPrivate.h"
bool isEffectRunning(DSWaylandSurface *window);
void setFloatingPosition(int x, int y);
DSWaylandInputPanelFloating *getFloatingData();
+ stGeometry getSurfaceGeometry(DSWaylandSurface *wlSurface);
private:
DSWaylandCompositor *__compositor;
#include "DSCore.h"
#include "DSObject.h"
+#include "DSStruct.h"
#include "DSWaylandInputPanel.h"
namespace display_server
bool isEffectRunning(DSWaylandSurface *window);
void setPosition(DSWaylandSurface *window, int width, int height);
void setFloatingPosition(int x, int y);
+ stGeometry getGeometry(DSWaylandSurface *wlSurface);
protected:
#include "DSCore.h"
#include "DSObjectPrivate.h"
+#include "DSStruct.h"
#include "DSWaylandInputPanelSurface.h"
namespace display_server
void setTransientForSurface(DSWaylandSurface *parent);
void updateSurfaceVisibility(bool visible);
void setFloatingPosition(int x, int y);
+ stGeometry getGeometry(DSWaylandSurface *wlSurface);
protected:
void input_panel_surface_destroy_resource(Resource *resource);
DSWaylandCompositor::releaseInstance();
}
+TEST_F(DSWaylandInputPanelTest, GetSurfaceGeometry)
+{
+ DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
+ DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
+ EXPECT_TRUE(inputPanel != nullptr);
+
+ inputPanel->getSurfaceGeometry(nullptr);
+
+ delete inputPanel;
+ DSWaylandCompositor::releaseInstance();
+}
+
DSWaylandCompositor::releaseInstance();
}
+TEST_F(DSWaylandInputPanelSurfaceTest, GetGeometry)
+{
+ DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
+ DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp);
+ DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel);
+ EXPECT_TRUE(inputPanelSurface != nullptr);
+
+ inputPanelSurface->getGeometry(nullptr);
+
+ delete inputPanelSurface;
+ delete inputPanel;
+ DSWaylandCompositor::releaseInstance();
+}
+