[Libreoffice-commits] core.git: Branch 'feature/lok_dialog' - libreofficekit/qa

2017-11-28 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx|   19 ---
 libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx|   23 +++
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |6 -
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx   |   60 
+-
 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.hxx   |6 +
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx|   35 
+
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx|2 
 libreofficekit/qa/gtktiledviewer/gtv.ui |   49 
+++-
 8 files changed, 172 insertions(+), 28 deletions(-)

New commits:
commit e87eef9b061697710d548e2a6b776ea4c3c3d026
Author: Pranav Kant 
Date:   Tue Nov 28 16:43:54 2017 +0530

gtv: Remember recently executed UNO commands

Saves the recently executed UNO commands in a temp file and make it
accessible to user in a combo box. Useful when debugging.

Change-Id: Ic66961a388cc59dee3f65cb8d4de3c29a8a75eaa

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
index 9dee02a0ac45..5dca746d5f25 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
@@ -148,23 +148,4 @@ const std::string GtvHelpers::getDirPath(const 
std::string& filePath)
 return dirPath;
 }
 
-const std::vector GtvHelpers::splitIntoIntegers(const std::string& 
aPayload, const std::string& aDelim, const int nItems)
-{
-std::vector aRet;
-
-if (!aPayload.empty())
-{
-gchar** ppCoordinates = g_strsplit(aPayload.c_str(), aDelim.c_str(), 
nItems);
-gchar** ppCoordinate  = ppCoordinates;
-while (*ppCoordinate)
-{
-aRet.push_back(atoi(*ppCoordinate));
-++ppCoordinate;
-}
-g_strfreev(ppCoordinates);
-}
-
-return aRet;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx 
b/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx
index 9e984846f0ab..9474f4c0271a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.hxx
@@ -39,7 +39,28 @@ namespace GtvHelpers
 
 const std::string getDirPath(const std::string& filePath);
 
-const std::vector splitIntoIntegers(const std::string& aPayload, 
const std::string& aDelim, const int nItems);
+template
+const std::vector split(const std::string& aPayload, const std::string& 
aDelim, const int nItems)
+{
+std::vector aRet;
+
+if (!aPayload.empty())
+{
+gchar** ppCoordinates = g_strsplit(aPayload.c_str(), 
aDelim.c_str(), nItems);
+gchar** ppCoordinate  = ppCoordinates;
+while (*ppCoordinate)
+{
+std::stringstream strstream(*ppCoordinate);
+T item;
+strstream >> item;
+aRet.push_back(item);
+++ppCoordinate;
+}
+g_strfreev(ppCoordinates);
+}
+
+return aRet;
+}
 }
 
 #endif
diff --git 
a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 79839aeccad2..2c97bd4d7393 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -314,7 +314,7 @@ void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, 
gchar* pPayload, gpoint
 if (aAction == "created")
 {
 const std::string aSize = aRoot.get("size");
-std::vector aPoints = GtvHelpers::splitIntoIntegers(aSize, ", ", 
2);
+std::vector aPoints = GtvHelpers::split(aSize, ", ", 2);
 GtkWidget* pDialog = gtv_lok_dialog_new(pDocView, nDialogId, 
aPoints[0], aPoints[1]);
 g_info("created  dialog, for dialogid: %d with size: %s", nDialogId, 
aSize.c_str());
 
@@ -345,7 +345,7 @@ void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, 
gchar* pPayload, gpoint
 else if (aAction == "size_changed")
 {
 const std::string aSize = aRoot.get("size");
-std::vector aSizePoints = 
GtvHelpers::splitIntoIntegers(aSize, ", ", 2);
+std::vector aSizePoints = GtvHelpers::split(aSize, 
", ", 2);
 if (aSizePoints.size() != 2)
 {
 g_error("Malformed size_changed callback");
@@ -366,7 +366,7 @@ void LOKDocViewSigHandlers::dialog(LOKDocView* pDocView, 
gchar* pPayload, gpoint
 try
 {
 const std::string aRectangle = 
aRoot.get("rectangle");
-std::vector aRectPoints = 
GtvHelpers::splitIntoIntegers(aRectangle, ", ", 4);
+std::vector 

[Libreoffice-commits] core.git: Branch 'feature/lok_dialog' - libreofficekit/qa

2017-08-15 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |   58 ++--
 1 file changed, 30 insertions(+), 28 deletions(-)

New commits:
commit c732bf5a6af9dfaea6c2885db8c49f604e854920
Author: Pranav Kant 
Date:   Tue Aug 15 18:54:02 2017 +0530

lokdialog: Smoother mouse move on floating windows

Do away with an early hack to create the floating window with every
invalidate.

This gets rid of persistent blinking when moving the mouse over a
listbox, for example.

Change-Id: Ida9367156605edc9835529f83529363ad97beaee

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index ec734a011a88..43c14712646a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -598,34 +598,34 @@ void gtv_lok_dialog_child_invalidate(GtvLokDialog* 
dialog, int nX, int nY)
 
 GtvLokDialogPrivate* priv = getPrivate(dialog);
 // remove any existing floating windows, for now
-if (priv->pFloatingWin)
-gtk_widget_destroy(priv->pFloatingWin);
-
-priv->pFloatingWin = gtk_window_new(GTK_WINDOW_POPUP);
-GtkWidget* pDrawingArea = gtk_drawing_area_new();
-gtk_container_add(GTK_CONTAINER(priv->pFloatingWin), pDrawingArea);
-
-gtk_window_set_transient_for(GTK_WINDOW(priv->pFloatingWin), 
GTK_WINDOW(dialog));
-gtk_window_set_destroy_with_parent(GTK_WINDOW(priv->pFloatingWin), true);
-
-gtk_widget_add_events(pDrawingArea,
-  GDK_BUTTON_PRESS_MASK
-  |GDK_POINTER_MOTION_MASK
-  |GDK_BUTTON_RELEASE_MASK
-  |GDK_BUTTON_MOTION_MASK);
-
-g_signal_connect(G_OBJECT(pDrawingArea), "draw", 
G_CALLBACK(gtv_lok_dialog_floating_win_draw), dialog);
-g_signal_connect(G_OBJECT(pDrawingArea), "button-press-event", 
G_CALLBACK(gtv_lok_dialog_floating_win_signal_button), dialog);
-g_signal_connect(G_OBJECT(pDrawingArea), "button-release-event", 
G_CALLBACK(gtv_lok_dialog_floating_win_signal_button), dialog);
-g_signal_connect(G_OBJECT(pDrawingArea), "motion-notify-event", 
G_CALLBACK(gtv_lok_dialog_floating_win_signal_motion), dialog);
-
-gtk_widget_set_size_request(priv->pFloatingWin, 1, 1);
-gtk_window_set_type_hint(GTK_WINDOW(priv->pFloatingWin), 
GDK_WINDOW_TYPE_HINT_POPUP_MENU);
-gtk_window_set_screen(GTK_WINDOW(priv->pFloatingWin), 
gtk_window_get_screen(GTK_WINDOW(dialog)));
-
-gtk_widget_show_all(priv->pFloatingWin);
-gtk_window_present(GTK_WINDOW(priv->pFloatingWin));
-gtk_widget_grab_focus(pDrawingArea);
+if (!priv->pFloatingWin)
+{
+priv->pFloatingWin = gtk_window_new(GTK_WINDOW_POPUP);
+GtkWidget* pDrawingArea = gtk_drawing_area_new();
+gtk_container_add(GTK_CONTAINER(priv->pFloatingWin), pDrawingArea);
+
+gtk_window_set_transient_for(GTK_WINDOW(priv->pFloatingWin), 
GTK_WINDOW(dialog));
+gtk_window_set_destroy_with_parent(GTK_WINDOW(priv->pFloatingWin), 
true);
+
+gtk_widget_add_events(pDrawingArea,
+  GDK_BUTTON_PRESS_MASK
+  |GDK_POINTER_MOTION_MASK
+  |GDK_BUTTON_RELEASE_MASK
+  |GDK_BUTTON_MOTION_MASK);
+
+g_signal_connect(G_OBJECT(pDrawingArea), "draw", 
G_CALLBACK(gtv_lok_dialog_floating_win_draw), dialog);
+g_signal_connect(G_OBJECT(pDrawingArea), "button-press-event", 
G_CALLBACK(gtv_lok_dialog_floating_win_signal_button), dialog);
+g_signal_connect(G_OBJECT(pDrawingArea), "button-release-event", 
G_CALLBACK(gtv_lok_dialog_floating_win_signal_button), dialog);
+g_signal_connect(G_OBJECT(pDrawingArea), "motion-notify-event", 
G_CALLBACK(gtv_lok_dialog_floating_win_signal_motion), dialog);
+
+gtk_widget_set_size_request(priv->pFloatingWin, 1, 1);
+gtk_window_set_type_hint(GTK_WINDOW(priv->pFloatingWin), 
GDK_WINDOW_TYPE_HINT_POPUP_MENU);
+gtk_window_set_screen(GTK_WINDOW(priv->pFloatingWin), 
gtk_window_get_screen(GTK_WINDOW(dialog)));
+
+gtk_widget_show_all(priv->pFloatingWin);
+gtk_window_present(GTK_WINDOW(priv->pFloatingWin));
+gtk_widget_grab_focus(pDrawingArea);
+}
 
 // Get the root coords of our new floating window
 GdkWindow* pGdkWin = gtk_widget_get_window(GTK_WIDGET(dialog));
@@ -633,6 +633,8 @@ void gtv_lok_dialog_child_invalidate(GtvLokDialog* dialog, 
int nX, int nY)
 int nrY = 0;
 gdk_window_get_root_coords(pGdkWin, nX, nY, , );
 gtk_window_move(GTK_WINDOW(priv->pFloatingWin), nrX, nrY);
+
+gtk_widget_queue_draw(priv->pFloatingWin);
 }
 
 void gtv_lok_dialog_child_close(GtvLokDialog* dialog)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/lok_dialog' - libreofficekit/qa

2017-08-03 Thread Pranav Kant
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |   14 
+++---
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx |2 -
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |   14 
+-
 3 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 9c44a71a06cb2312fd24ffd7c48302f0ae7807c1
Author: Pranav Kant 
Date:   Thu Aug 3 22:58:04 2017 +0530

lokdialog: Move the floating window to its actual position

gtk_window_move them to the position broadcasted to us by vcl

Change-Id: Id27b52a24e721b51d7a153cc7c0e03197a99ee2f

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index 1bfb9d538ead..6b19ddc506c0 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -460,7 +460,7 @@ gtv_lok_dialog_invalidate(GtvLokDialog* dialog)
 gtk_widget_queue_draw(priv->pDialogDrawingArea);
 }
 
-void gtv_lok_dialog_child_invalidate(GtvLokDialog* dialog)
+void gtv_lok_dialog_child_invalidate(GtvLokDialog* dialog, int nX, int nY)
 {
 g_info("Dialog's floating window invalidate");
 
@@ -474,14 +474,22 @@ void gtv_lok_dialog_child_invalidate(GtvLokDialog* dialog)
 gtk_container_add(GTK_CONTAINER(priv->pFloatingWin), pDrawingArea);
 
 gtk_window_set_transient_for(GTK_WINDOW(priv->pFloatingWin), 
GTK_WINDOW(dialog));
-gtk_window_set_position(GTK_WINDOW(priv->pFloatingWin), GTK_WIN_POS_MOUSE);
 gtk_window_set_destroy_with_parent(GTK_WINDOW(priv->pFloatingWin), true);
-
 g_signal_connect(G_OBJECT(pDrawingArea), "draw", 
G_CALLBACK(gtv_lok_dialog_floating_win_draw), dialog);
 
 gtk_widget_set_size_request(priv->pFloatingWin, 1, 1);
+gtk_window_set_type_hint(GTK_WINDOW(priv->pFloatingWin), 
GDK_WINDOW_TYPE_HINT_POPUP_MENU);
+gtk_window_set_screen(GTK_WINDOW(priv->pFloatingWin), 
gtk_window_get_screen(GTK_WINDOW(dialog)));
+
 gtk_widget_show_all(priv->pFloatingWin);
 gtk_window_present(GTK_WINDOW(priv->pFloatingWin));
+
+// Get the root coords of our new floating window
+GdkWindow* pGdkWin = gtk_widget_get_window(GTK_WIDGET(dialog));
+int nrX = 0;
+int nrY = 0;
+gdk_window_get_root_coords(pGdkWin, nX, nY, , );
+gtk_window_move(GTK_WINDOW(priv->pFloatingWin), nrX, nrY);
 }
 
 void gtv_lok_dialog_child_close(GtvLokDialog* dialog)
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx
index bce9edbadba1..ba565b4cebb0 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx
@@ -39,7 +39,7 @@ GtkWidget* gtv_lok_dialog_new(LOKDocView* pDocView, const 
gchar* dialogId);
 
 void gtv_lok_dialog_invalidate(GtvLokDialog* dialog);
 
-void gtv_lok_dialog_child_invalidate(GtvLokDialog* dialog);
+void gtv_lok_dialog_child_invalidate(GtvLokDialog* dialog, int nX, int nY);
 
 void gtv_lok_dialog_child_close(GtvLokDialog* dialog);
 
diff --git 
a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index d0778cef473d..72916b56f9ce 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -309,6 +309,18 @@ void LOKDocViewSigHandlers::dialogChild(LOKDocView* 
pDocView, gchar* pPayload, g
   boost::property_tree::read_json(aStream, aRoot);
   std::string aDialogId = aRoot.get("dialogId");
   std::string aAction = aRoot.get("action");
+  std::string aPos = aRoot.get("position");
+  gchar** ppCoordinates = g_strsplit(aPos.c_str(), ", ", 2);
+  int nX = 0;
+  int nY = 0;
+
+  if (*ppCoordinates)
+  nX = atoi(*ppCoordinates);
+  ++ppCoordinates;
+  if (*ppCoordinates)
+  nY = atoi(*ppCoordinates);
+
+  g_strfreev(ppCoordinates);
 
   // temporary hack to invalidate/close floating window of all opened dialogs
   GList* pChildWins = gtv_application_window_get_all_child_windows(window);
@@ -316,7 +328,7 @@ void LOKDocViewSigHandlers::dialogChild(LOKDocView* 
pDocView, gchar* pPayload, g
   for (pIt = pChildWins; pIt != nullptr; pIt = pIt->next)
   {
   if (aAction == "invalidate")
-  gtv_lok_dialog_child_invalidate(GTV_LOK_DIALOG(pIt->data));
+  gtv_lok_dialog_child_invalidate(GTV_LOK_DIALOG(pIt->data), nX, nY);
   else if (aAction == "close")
   gtv_lok_dialog_child_close(GTV_LOK_DIALOG(pIt->data));
   }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits