Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/e3c61704eee5fd1f4095410682c86199f41b91bf
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/e3c61704eee5fd1f4095410682c86199f41b91bf
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/e3c61704eee5fd1f4095410682c86199f41b91bf

The branch, vince/qt6 has been updated
       via  e3c61704eee5fd1f4095410682c86199f41b91bf (commit)
      from  bb606f6b5957690662f46143bd047cd756e53db6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=e3c61704eee5fd1f4095410682c86199f41b91bf
commit e3c61704eee5fd1f4095410682c86199f41b91bf
Author: Vincent Sanders <vi...@kyllikki.org>
Commit: Vincent Sanders <vi...@kyllikki.org>

    split out widget and urlbar method implementations

diff --git a/frontends/qt/Makefile b/frontends/qt/Makefile
index f3afee1..91e29fe 100644
--- a/frontends/qt/Makefile
+++ b/frontends/qt/Makefile
@@ -42,8 +42,16 @@ S_RESOURCE :=
 # ----------------------------------------------------------------------------
 
 # S_FRONTEND are sources purely for the QT frontend
-S_FRONTEND := main.cpp misc.cpp window.cpp fetch.cpp bitmap.cpp layout.cpp \
-       plotters.cpp resources.cpp \
+S_FRONTEND := main.cpp \
+       misc.cpp \
+       window.cpp \
+       widget.cpp \
+       urlbar.cpp \
+       fetch.cpp \
+       bitmap.cpp \
+       layout.cpp \
+       plotters.cpp \
+       resources.cpp \
        window.cls.moc.cpp widget.cls.moc.cpp urlbar.cls.moc.cpp
 
 # This is the final source build list
diff --git a/frontends/qt/urlbar.cpp b/frontends/qt/urlbar.cpp
new file mode 100644
index 0000000..a54f5d7
--- /dev/null
+++ b/frontends/qt/urlbar.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2023 Vincent Sanders <vi...@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Widget methods for browsing context display.
+ */
+
+#include <QLineEdit>
+
+#include "qt/urlbar.cls.h"
+
+/**
+ * urlbar constructor
+ */
+NS_URLBar::NS_URLBar(QWidget* parent, struct browser_window *bw)
+       : QToolBar(parent), m_bw(bw)
+{
+       addAction(QIcon(":/icons/back.png"), "Back");
+       addAction(QIcon(":/icons/forward.png"), "Forward");
+       QLineEdit *input=new QLineEdit();
+       addWidget(input);
+}
+
+#if 0
+/**
+ * widget representing url bar
+ */
+class NS_URLBar : public Fl_Pack
+{
+private:
+       struct browser_window *m_bw;
+       Fl_Button *m_back_button;
+       Fl_Button *m_forward_button;
+       Fl_Input *m_input;
+
+       void back_callback(Fl_Button *button);
+       void forward_callback(Fl_Button *button);
+public:
+       NS_URLBar(int X,int Y,int W,int H, struct browser_window *bw);
+       nserror set_url(struct nsurl *url);
+
+       /* static wrapper for qt callbacks */
+       static void static_back_callback(Fl_Widget *w, void *f);
+       static void static_forward_callback(Fl_Widget *w, void *f);
+
+};
+
+NS_URLBar::NS_URLBar(int X,int Y,int W,int H, struct browser_window *bw)
+       : Fl_Pack(X,Y,W,H), m_bw(bw)
+{
+       type(Fl_Pack::HORIZONTAL);
+       spacing(4);
+
+       m_back_button = new Fl_Button(0,0,H,H, "B");
+       m_back_button->callback(static_back_callback, (void *)this);
+
+       m_forward_button = new Fl_Button(0,0,H,H, "F");
+       m_forward_button->callback(static_forward_callback, (void *)this);
+
+       m_input = new Fl_Input(0,0,W,H);
+
+       end();
+
+       resizable(m_input);
+}
+
+nserror NS_URLBar::set_url(struct nsurl *url)
+{
+       size_t idn_url_l;
+       char *idn_url_s = NULL;
+       if (nsurl_get_utf8(url, &idn_url_s, &idn_url_l) == NSERROR_OK) {
+               m_input->value(idn_url_s, idn_url_l-1);
+               free(idn_url_s);
+       } else {
+               m_input->value(nsurl_access(url));
+       }
+       return NSERROR_OK;
+}
+
+void NS_URLBar::back_callback(Fl_Button *button)
+{
+       browser_window_history_back(m_bw, false);
+}
+
+void NS_URLBar::forward_callback(Fl_Button *button)
+{
+       browser_window_history_forward(m_bw, false);
+}
+
+
+void NS_URLBar::static_back_callback(Fl_Widget *w, void *f)
+{
+       ((NS_URLBar *)f)->back_callback((Fl_Button *)w);
+}
+
+void NS_URLBar::static_forward_callback(Fl_Widget *w, void *f)
+{
+       ((NS_URLBar *)f)->forward_callback((Fl_Button *)w);
+}
+
+#endif
diff --git a/frontends/qt/widget.cpp b/frontends/qt/widget.cpp
new file mode 100644
index 0000000..e69d799
--- /dev/null
+++ b/frontends/qt/widget.cpp
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2023 Vincent Sanders <vi...@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Widget methods for browsing context display.
+ */
+
+#include <QPaintEvent>
+#include <QPainter>
+
+extern "C" {
+#include "utils/errors.h"
+#include "netsurf/plotters.h"
+}
+
+#include "qt/widget.cls.h"
+
+#include "qt/plotters.h"
+
+/**
+ * widget has been resized
+ */
+void NS_Widget::resizeEvent(QResizeEvent *event)
+{
+       browser_window_schedule_reformat(m_bw);
+}
+
+/**
+ * redraw the netsurf browsing widget
+ */
+void NS_Widget::paintEvent(QPaintEvent *event)
+{
+       struct rect clip;
+       QPainter *painter;
+       struct redraw_context ctx = {
+               .interactive = true,
+               .background_images = true,
+               .plot = &nsqt_plotters,
+               .priv = NULL,
+       };
+
+       /* netsurf render clip region coordinates */
+       clip.x0 = event->rect().left();
+       clip.y0 = event->rect().top();
+       clip.x1 = clip.x0 + event->rect().width();
+       clip.y1 = clip.y0 + event->rect().height();
+
+       painter = new QPainter(this);
+       ctx.priv = painter;
+
+       browser_window_redraw(m_bw,
+                             - m_xoffset,
+                             - m_yoffset,
+                             &clip,
+                             &ctx);
+
+       delete painter;
+}
+
+/**
+ * get the current scroll offsets
+ */
+bool NS_Widget::get_scroll(int *sx, int *sy)
+{
+       *sx = m_xoffset;
+       *sy = m_yoffset;
+
+       return true;
+}
+
+
+/**
+ * get the viewable dimensions of browsing context
+ */
+nserror NS_Widget::get_dimensions(int *width, int *height)
+{
+       *width = size().width();
+       *height = size().height();
+
+       return NSERROR_OK;
+}
+
+
+/**
+ * mark an area of the browsing context as invalid
+ */
+nserror NS_Widget::invalidate(const struct rect *rect)
+{
+       
+       if (rect == NULL) {
+               update();
+       } else {
+               update(rect->x0,
+                      rect->y0,
+                      rect->x1 - rect->x0,
+                      rect->y1 - rect->y0);
+                      }
+       return NSERROR_OK;
+
+}
+
+
+#if 0
+/**
+ * handle events on the netsurf browsing widget
+ */
+int NS_Widget::handle(int event)
+{
+       int state = BROWSER_MOUSE_HOVER;
+       int button;
+
+       switch (event) {
+               
+       case FL_PUSH:
+               button = Fl::event_button();
+               if (button == FL_LEFT_MOUSE) {
+                       state |= BROWSER_MOUSE_PRESS_1;
+               }
+               browser_window_mouse_click(m_bw,
+                                          (browser_mouse_state)state,
+                                          Fl::event_x() - x() + m_xoffset,
+                                          Fl::event_y() - y() + m_yoffset);
+               return 1;
+
+       case FL_RELEASE:
+               button = Fl::event_button();
+               if (button == FL_LEFT_MOUSE) {
+                       state |= BROWSER_MOUSE_CLICK_1;
+
+               }
+               browser_window_mouse_click(m_bw,
+                                          (browser_mouse_state)state,
+                                          Fl::event_x() - x() + m_xoffset,
+                                          Fl::event_y() - y() + m_yoffset);
+
+               return 1;
+       default:
+               return Fl_Widget::handle(event);
+               
+       }
+               
+}
+#endif
+
+
+
+#if 0
+/**
+ * vertical scrollbar position has been changed
+ */
+void NS_Widget::vscroll_callback(Fl_Scrollbar *sb)
+{
+       m_yoffset = sb->value();
+       //damage(FL_DAMAGE_SCROLL);
+}
+
+
+/**
+ * horizontal scrollbar position has been changed
+ */
+void NS_Widget::hscroll_callback(Fl_Scrollbar *sb)
+{
+       m_xoffset = sb->value();
+       //damage(FL_DAMAGE_SCROLL);
+}
+#endif
diff --git a/frontends/qt/window.cpp b/frontends/qt/window.cpp
index 7c577ca..039516c 100644
--- a/frontends/qt/window.cpp
+++ b/frontends/qt/window.cpp
@@ -23,8 +23,6 @@
 
 #include <stddef.h>
 #include <QWidget>
-#include <QPaintEvent>
-#include <QPainter>
 #include <QGridLayout>
 #include <QHBoxLayout>
 #include <QPushButton>
@@ -52,7 +50,6 @@ extern "C" {
 #include "qt/urlbar.cls.h"
 
 #include "qt/window.h"
-#include "qt/plotters.h"
 
 extern bool nsqt_done;
 
@@ -61,242 +58,6 @@ struct gui_window {
 };
 
 
-#if 0
-/**
- * handle events on the netsurf browsing widget
- */
-int NS_Widget::handle(int event)
-{
-       int state = BROWSER_MOUSE_HOVER;
-       int button;
-
-       switch (event) {
-               
-       case FL_PUSH:
-               button = Fl::event_button();
-               if (button == FL_LEFT_MOUSE) {
-                       state |= BROWSER_MOUSE_PRESS_1;
-               }
-               browser_window_mouse_click(m_bw,
-                                          (browser_mouse_state)state,
-                                          Fl::event_x() - x() + m_xoffset,
-                                          Fl::event_y() - y() + m_yoffset);
-               return 1;
-
-       case FL_RELEASE:
-               button = Fl::event_button();
-               if (button == FL_LEFT_MOUSE) {
-                       state |= BROWSER_MOUSE_CLICK_1;
-
-               }
-               browser_window_mouse_click(m_bw,
-                                          (browser_mouse_state)state,
-                                          Fl::event_x() - x() + m_xoffset,
-                                          Fl::event_y() - y() + m_yoffset);
-
-               return 1;
-       default:
-               return Fl_Widget::handle(event);
-               
-       }
-               
-}
-#endif
-
-/**
- * widget has been resized
- */
-void NS_Widget::resizeEvent(QResizeEvent *event)
-{
-       browser_window_schedule_reformat(m_bw);
-}
-
-/**
- * redraw the netsurf browsing widget
- */
-void NS_Widget::paintEvent(QPaintEvent *event)
-{
-       struct rect clip;
-       QPainter *painter;
-       struct redraw_context ctx = {
-               .interactive = true,
-               .background_images = true,
-               .plot = &nsqt_plotters,
-               .priv = NULL,
-       };
-
-       /* netsurf render clip region coordinates */
-       clip.x0 = event->rect().left();
-       clip.y0 = event->rect().top();
-       clip.x1 = clip.x0 + event->rect().width();
-       clip.y1 = clip.y0 + event->rect().height();
-
-       painter = new QPainter(this);
-       ctx.priv = painter;
-
-       //NSLOG(netsurf, WARNING, "redrawing");
-       browser_window_redraw(m_bw,
-                             - m_xoffset,
-                             - m_yoffset,
-                             &clip,
-                             &ctx);
-
-       delete painter;
-
-}
-
-#if 0
-/**
- * vertical scrollbar position has been changed
- */
-void NS_Widget::vscroll_callback(Fl_Scrollbar *sb)
-{
-       m_yoffset = sb->value();
-       //damage(FL_DAMAGE_SCROLL);
-}
-
-
-/**
- * horizontal scrollbar position has been changed
- */
-void NS_Widget::hscroll_callback(Fl_Scrollbar *sb)
-{
-       m_xoffset = sb->value();
-       //damage(FL_DAMAGE_SCROLL);
-}
-#endif
-/**
- * get the current scroll offsets
- */
-bool NS_Widget::get_scroll(int *sx, int *sy)
-{
-       *sx = m_xoffset;
-       *sy = m_yoffset;
-
-       return true;
-}
-
-
-/**
- * get the viewable dimensions of browsing context
- */
-nserror NS_Widget::get_dimensions(int *width, int *height)
-{
-       *width = size().width();
-       *height = size().height();
-
-       return NSERROR_OK;
-}
-
-
-/**
- * mark an area of the browsing context as invalid
- */
-nserror NS_Widget::invalidate(const struct rect *rect)
-{
-       
-       if (rect == NULL) {
-               update();
-       } else {
-               update(rect->x0,
-                      rect->y0,
-                      rect->x1 - rect->x0,
-                      rect->y1 - rect->y0);
-                      }
-       return NSERROR_OK;
-
-}
-#include <QLineEdit>
-
-NS_URLBar::NS_URLBar(QWidget* parent, struct browser_window *bw)
-       : QToolBar(parent), m_bw(bw)
-{
-       addAction(QIcon(":/icons/back.png"), "Back");
-       addAction(QIcon(":/icons/forward.png"), "Forward");
-       QLineEdit *input=new QLineEdit();
-       addWidget(input);
-}
-
-#if 0
-/**
- * widget representing url bar
- */
-class NS_URLBar : public Fl_Pack
-{
-private:
-       struct browser_window *m_bw;
-       Fl_Button *m_back_button;
-       Fl_Button *m_forward_button;
-       Fl_Input *m_input;
-
-       void back_callback(Fl_Button *button);
-       void forward_callback(Fl_Button *button);
-public:
-       NS_URLBar(int X,int Y,int W,int H, struct browser_window *bw);
-       nserror set_url(struct nsurl *url);
-
-       /* static wrapper for qt callbacks */
-       static void static_back_callback(Fl_Widget *w, void *f);
-       static void static_forward_callback(Fl_Widget *w, void *f);
-
-};
-
-NS_URLBar::NS_URLBar(int X,int Y,int W,int H, struct browser_window *bw)
-       : Fl_Pack(X,Y,W,H), m_bw(bw)
-{
-       type(Fl_Pack::HORIZONTAL);
-       spacing(4);
-
-       m_back_button = new Fl_Button(0,0,H,H, "B");
-       m_back_button->callback(static_back_callback, (void *)this);
-
-       m_forward_button = new Fl_Button(0,0,H,H, "F");
-       m_forward_button->callback(static_forward_callback, (void *)this);
-
-       m_input = new Fl_Input(0,0,W,H);
-
-       end();
-
-       resizable(m_input);
-}
-
-nserror NS_URLBar::set_url(struct nsurl *url)
-{
-       size_t idn_url_l;
-       char *idn_url_s = NULL;
-       if (nsurl_get_utf8(url, &idn_url_s, &idn_url_l) == NSERROR_OK) {
-               m_input->value(idn_url_s, idn_url_l-1);
-               free(idn_url_s);
-       } else {
-               m_input->value(nsurl_access(url));
-       }
-       return NSERROR_OK;
-}
-
-void NS_URLBar::back_callback(Fl_Button *button)
-{
-       browser_window_history_back(m_bw, false);
-}
-
-void NS_URLBar::forward_callback(Fl_Button *button)
-{
-       browser_window_history_forward(m_bw, false);
-}
-
-
-void NS_URLBar::static_back_callback(Fl_Widget *w, void *f)
-{
-       ((NS_URLBar *)f)->back_callback((Fl_Button *)w);
-}
-
-void NS_URLBar::static_forward_callback(Fl_Widget *w, void *f)
-{
-       ((NS_URLBar *)f)->forward_callback((Fl_Button *)w);
-}
-
-#endif
-
-
 /**
  * netsurf window class constructor
  */
@@ -360,15 +121,6 @@ void NS_Window::closeEvent(QCloseEvent *event)
        browser_window_destroy(m_bw);
 }
 
-#if 0
-/**
- * qt window has been closed
- */
-void NS_Window::close_callback(Fl_Widget *w)
-{
-       browser_window_destroy(m_bw);
-}
-#endif
 
 /**
  * set the status text
@@ -417,13 +169,6 @@ nserror NS_Window::set_extent(int ew, int eh)
 
 /* static methods */
 #if 0
-/**
- * static window close qt callback which calls the instance
- */
-void NS_Window::static_close_callback(Fl_Widget *w, void *f)
-{
-       ((NS_Window *)f)->close_callback(w);
-}
 
 /**
  * static vertical scrollbar qt callback which calls the instance


-----------------------------------------------------------------------

Summary of changes:
 frontends/qt/Makefile   |   12 ++-
 frontends/qt/urlbar.cpp |  117 ++++++++++++++++++++++
 frontends/qt/widget.cpp |  182 +++++++++++++++++++++++++++++++++
 frontends/qt/window.cpp |  255 -----------------------------------------------
 4 files changed, 309 insertions(+), 257 deletions(-)
 create mode 100644 frontends/qt/urlbar.cpp
 create mode 100644 frontends/qt/widget.cpp

diff --git a/frontends/qt/Makefile b/frontends/qt/Makefile
index f3afee1..91e29fe 100644
--- a/frontends/qt/Makefile
+++ b/frontends/qt/Makefile
@@ -42,8 +42,16 @@ S_RESOURCE :=
 # ----------------------------------------------------------------------------
 
 # S_FRONTEND are sources purely for the QT frontend
-S_FRONTEND := main.cpp misc.cpp window.cpp fetch.cpp bitmap.cpp layout.cpp \
-       plotters.cpp resources.cpp \
+S_FRONTEND := main.cpp \
+       misc.cpp \
+       window.cpp \
+       widget.cpp \
+       urlbar.cpp \
+       fetch.cpp \
+       bitmap.cpp \
+       layout.cpp \
+       plotters.cpp \
+       resources.cpp \
        window.cls.moc.cpp widget.cls.moc.cpp urlbar.cls.moc.cpp
 
 # This is the final source build list
diff --git a/frontends/qt/urlbar.cpp b/frontends/qt/urlbar.cpp
new file mode 100644
index 0000000..a54f5d7
--- /dev/null
+++ b/frontends/qt/urlbar.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2023 Vincent Sanders <vi...@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Widget methods for browsing context display.
+ */
+
+#include <QLineEdit>
+
+#include "qt/urlbar.cls.h"
+
+/**
+ * urlbar constructor
+ */
+NS_URLBar::NS_URLBar(QWidget* parent, struct browser_window *bw)
+       : QToolBar(parent), m_bw(bw)
+{
+       addAction(QIcon(":/icons/back.png"), "Back");
+       addAction(QIcon(":/icons/forward.png"), "Forward");
+       QLineEdit *input=new QLineEdit();
+       addWidget(input);
+}
+
+#if 0
+/**
+ * widget representing url bar
+ */
+class NS_URLBar : public Fl_Pack
+{
+private:
+       struct browser_window *m_bw;
+       Fl_Button *m_back_button;
+       Fl_Button *m_forward_button;
+       Fl_Input *m_input;
+
+       void back_callback(Fl_Button *button);
+       void forward_callback(Fl_Button *button);
+public:
+       NS_URLBar(int X,int Y,int W,int H, struct browser_window *bw);
+       nserror set_url(struct nsurl *url);
+
+       /* static wrapper for qt callbacks */
+       static void static_back_callback(Fl_Widget *w, void *f);
+       static void static_forward_callback(Fl_Widget *w, void *f);
+
+};
+
+NS_URLBar::NS_URLBar(int X,int Y,int W,int H, struct browser_window *bw)
+       : Fl_Pack(X,Y,W,H), m_bw(bw)
+{
+       type(Fl_Pack::HORIZONTAL);
+       spacing(4);
+
+       m_back_button = new Fl_Button(0,0,H,H, "B");
+       m_back_button->callback(static_back_callback, (void *)this);
+
+       m_forward_button = new Fl_Button(0,0,H,H, "F");
+       m_forward_button->callback(static_forward_callback, (void *)this);
+
+       m_input = new Fl_Input(0,0,W,H);
+
+       end();
+
+       resizable(m_input);
+}
+
+nserror NS_URLBar::set_url(struct nsurl *url)
+{
+       size_t idn_url_l;
+       char *idn_url_s = NULL;
+       if (nsurl_get_utf8(url, &idn_url_s, &idn_url_l) == NSERROR_OK) {
+               m_input->value(idn_url_s, idn_url_l-1);
+               free(idn_url_s);
+       } else {
+               m_input->value(nsurl_access(url));
+       }
+       return NSERROR_OK;
+}
+
+void NS_URLBar::back_callback(Fl_Button *button)
+{
+       browser_window_history_back(m_bw, false);
+}
+
+void NS_URLBar::forward_callback(Fl_Button *button)
+{
+       browser_window_history_forward(m_bw, false);
+}
+
+
+void NS_URLBar::static_back_callback(Fl_Widget *w, void *f)
+{
+       ((NS_URLBar *)f)->back_callback((Fl_Button *)w);
+}
+
+void NS_URLBar::static_forward_callback(Fl_Widget *w, void *f)
+{
+       ((NS_URLBar *)f)->forward_callback((Fl_Button *)w);
+}
+
+#endif
diff --git a/frontends/qt/widget.cpp b/frontends/qt/widget.cpp
new file mode 100644
index 0000000..e69d799
--- /dev/null
+++ b/frontends/qt/widget.cpp
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2023 Vincent Sanders <vi...@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Widget methods for browsing context display.
+ */
+
+#include <QPaintEvent>
+#include <QPainter>
+
+extern "C" {
+#include "utils/errors.h"
+#include "netsurf/plotters.h"
+}
+
+#include "qt/widget.cls.h"
+
+#include "qt/plotters.h"
+
+/**
+ * widget has been resized
+ */
+void NS_Widget::resizeEvent(QResizeEvent *event)
+{
+       browser_window_schedule_reformat(m_bw);
+}
+
+/**
+ * redraw the netsurf browsing widget
+ */
+void NS_Widget::paintEvent(QPaintEvent *event)
+{
+       struct rect clip;
+       QPainter *painter;
+       struct redraw_context ctx = {
+               .interactive = true,
+               .background_images = true,
+               .plot = &nsqt_plotters,
+               .priv = NULL,
+       };
+
+       /* netsurf render clip region coordinates */
+       clip.x0 = event->rect().left();
+       clip.y0 = event->rect().top();
+       clip.x1 = clip.x0 + event->rect().width();
+       clip.y1 = clip.y0 + event->rect().height();
+
+       painter = new QPainter(this);
+       ctx.priv = painter;
+
+       browser_window_redraw(m_bw,
+                             - m_xoffset,
+                             - m_yoffset,
+                             &clip,
+                             &ctx);
+
+       delete painter;
+}
+
+/**
+ * get the current scroll offsets
+ */
+bool NS_Widget::get_scroll(int *sx, int *sy)
+{
+       *sx = m_xoffset;
+       *sy = m_yoffset;
+
+       return true;
+}
+
+
+/**
+ * get the viewable dimensions of browsing context
+ */
+nserror NS_Widget::get_dimensions(int *width, int *height)
+{
+       *width = size().width();
+       *height = size().height();
+
+       return NSERROR_OK;
+}
+
+
+/**
+ * mark an area of the browsing context as invalid
+ */
+nserror NS_Widget::invalidate(const struct rect *rect)
+{
+       
+       if (rect == NULL) {
+               update();
+       } else {
+               update(rect->x0,
+                      rect->y0,
+                      rect->x1 - rect->x0,
+                      rect->y1 - rect->y0);
+                      }
+       return NSERROR_OK;
+
+}
+
+
+#if 0
+/**
+ * handle events on the netsurf browsing widget
+ */
+int NS_Widget::handle(int event)
+{
+       int state = BROWSER_MOUSE_HOVER;
+       int button;
+
+       switch (event) {
+               
+       case FL_PUSH:
+               button = Fl::event_button();
+               if (button == FL_LEFT_MOUSE) {
+                       state |= BROWSER_MOUSE_PRESS_1;
+               }
+               browser_window_mouse_click(m_bw,
+                                          (browser_mouse_state)state,
+                                          Fl::event_x() - x() + m_xoffset,
+                                          Fl::event_y() - y() + m_yoffset);
+               return 1;
+
+       case FL_RELEASE:
+               button = Fl::event_button();
+               if (button == FL_LEFT_MOUSE) {
+                       state |= BROWSER_MOUSE_CLICK_1;
+
+               }
+               browser_window_mouse_click(m_bw,
+                                          (browser_mouse_state)state,
+                                          Fl::event_x() - x() + m_xoffset,
+                                          Fl::event_y() - y() + m_yoffset);
+
+               return 1;
+       default:
+               return Fl_Widget::handle(event);
+               
+       }
+               
+}
+#endif
+
+
+
+#if 0
+/**
+ * vertical scrollbar position has been changed
+ */
+void NS_Widget::vscroll_callback(Fl_Scrollbar *sb)
+{
+       m_yoffset = sb->value();
+       //damage(FL_DAMAGE_SCROLL);
+}
+
+
+/**
+ * horizontal scrollbar position has been changed
+ */
+void NS_Widget::hscroll_callback(Fl_Scrollbar *sb)
+{
+       m_xoffset = sb->value();
+       //damage(FL_DAMAGE_SCROLL);
+}
+#endif
diff --git a/frontends/qt/window.cpp b/frontends/qt/window.cpp
index 7c577ca..039516c 100644
--- a/frontends/qt/window.cpp
+++ b/frontends/qt/window.cpp
@@ -23,8 +23,6 @@
 
 #include <stddef.h>
 #include <QWidget>
-#include <QPaintEvent>
-#include <QPainter>
 #include <QGridLayout>
 #include <QHBoxLayout>
 #include <QPushButton>
@@ -52,7 +50,6 @@ extern "C" {
 #include "qt/urlbar.cls.h"
 
 #include "qt/window.h"
-#include "qt/plotters.h"
 
 extern bool nsqt_done;
 
@@ -61,242 +58,6 @@ struct gui_window {
 };
 
 
-#if 0
-/**
- * handle events on the netsurf browsing widget
- */
-int NS_Widget::handle(int event)
-{
-       int state = BROWSER_MOUSE_HOVER;
-       int button;
-
-       switch (event) {
-               
-       case FL_PUSH:
-               button = Fl::event_button();
-               if (button == FL_LEFT_MOUSE) {
-                       state |= BROWSER_MOUSE_PRESS_1;
-               }
-               browser_window_mouse_click(m_bw,
-                                          (browser_mouse_state)state,
-                                          Fl::event_x() - x() + m_xoffset,
-                                          Fl::event_y() - y() + m_yoffset);
-               return 1;
-
-       case FL_RELEASE:
-               button = Fl::event_button();
-               if (button == FL_LEFT_MOUSE) {
-                       state |= BROWSER_MOUSE_CLICK_1;
-
-               }
-               browser_window_mouse_click(m_bw,
-                                          (browser_mouse_state)state,
-                                          Fl::event_x() - x() + m_xoffset,
-                                          Fl::event_y() - y() + m_yoffset);
-
-               return 1;
-       default:
-               return Fl_Widget::handle(event);
-               
-       }
-               
-}
-#endif
-
-/**
- * widget has been resized
- */
-void NS_Widget::resizeEvent(QResizeEvent *event)
-{
-       browser_window_schedule_reformat(m_bw);
-}
-
-/**
- * redraw the netsurf browsing widget
- */
-void NS_Widget::paintEvent(QPaintEvent *event)
-{
-       struct rect clip;
-       QPainter *painter;
-       struct redraw_context ctx = {
-               .interactive = true,
-               .background_images = true,
-               .plot = &nsqt_plotters,
-               .priv = NULL,
-       };
-
-       /* netsurf render clip region coordinates */
-       clip.x0 = event->rect().left();
-       clip.y0 = event->rect().top();
-       clip.x1 = clip.x0 + event->rect().width();
-       clip.y1 = clip.y0 + event->rect().height();
-
-       painter = new QPainter(this);
-       ctx.priv = painter;
-
-       //NSLOG(netsurf, WARNING, "redrawing");
-       browser_window_redraw(m_bw,
-                             - m_xoffset,
-                             - m_yoffset,
-                             &clip,
-                             &ctx);
-
-       delete painter;
-
-}
-
-#if 0
-/**
- * vertical scrollbar position has been changed
- */
-void NS_Widget::vscroll_callback(Fl_Scrollbar *sb)
-{
-       m_yoffset = sb->value();
-       //damage(FL_DAMAGE_SCROLL);
-}
-
-
-/**
- * horizontal scrollbar position has been changed
- */
-void NS_Widget::hscroll_callback(Fl_Scrollbar *sb)
-{
-       m_xoffset = sb->value();
-       //damage(FL_DAMAGE_SCROLL);
-}
-#endif
-/**
- * get the current scroll offsets
- */
-bool NS_Widget::get_scroll(int *sx, int *sy)
-{
-       *sx = m_xoffset;
-       *sy = m_yoffset;
-
-       return true;
-}
-
-
-/**
- * get the viewable dimensions of browsing context
- */
-nserror NS_Widget::get_dimensions(int *width, int *height)
-{
-       *width = size().width();
-       *height = size().height();
-
-       return NSERROR_OK;
-}
-
-
-/**
- * mark an area of the browsing context as invalid
- */
-nserror NS_Widget::invalidate(const struct rect *rect)
-{
-       
-       if (rect == NULL) {
-               update();
-       } else {
-               update(rect->x0,
-                      rect->y0,
-                      rect->x1 - rect->x0,
-                      rect->y1 - rect->y0);
-                      }
-       return NSERROR_OK;
-
-}
-#include <QLineEdit>
-
-NS_URLBar::NS_URLBar(QWidget* parent, struct browser_window *bw)
-       : QToolBar(parent), m_bw(bw)
-{
-       addAction(QIcon(":/icons/back.png"), "Back");
-       addAction(QIcon(":/icons/forward.png"), "Forward");
-       QLineEdit *input=new QLineEdit();
-       addWidget(input);
-}
-
-#if 0
-/**
- * widget representing url bar
- */
-class NS_URLBar : public Fl_Pack
-{
-private:
-       struct browser_window *m_bw;
-       Fl_Button *m_back_button;
-       Fl_Button *m_forward_button;
-       Fl_Input *m_input;
-
-       void back_callback(Fl_Button *button);
-       void forward_callback(Fl_Button *button);
-public:
-       NS_URLBar(int X,int Y,int W,int H, struct browser_window *bw);
-       nserror set_url(struct nsurl *url);
-
-       /* static wrapper for qt callbacks */
-       static void static_back_callback(Fl_Widget *w, void *f);
-       static void static_forward_callback(Fl_Widget *w, void *f);
-
-};
-
-NS_URLBar::NS_URLBar(int X,int Y,int W,int H, struct browser_window *bw)
-       : Fl_Pack(X,Y,W,H), m_bw(bw)
-{
-       type(Fl_Pack::HORIZONTAL);
-       spacing(4);
-
-       m_back_button = new Fl_Button(0,0,H,H, "B");
-       m_back_button->callback(static_back_callback, (void *)this);
-
-       m_forward_button = new Fl_Button(0,0,H,H, "F");
-       m_forward_button->callback(static_forward_callback, (void *)this);
-
-       m_input = new Fl_Input(0,0,W,H);
-
-       end();
-
-       resizable(m_input);
-}
-
-nserror NS_URLBar::set_url(struct nsurl *url)
-{
-       size_t idn_url_l;
-       char *idn_url_s = NULL;
-       if (nsurl_get_utf8(url, &idn_url_s, &idn_url_l) == NSERROR_OK) {
-               m_input->value(idn_url_s, idn_url_l-1);
-               free(idn_url_s);
-       } else {
-               m_input->value(nsurl_access(url));
-       }
-       return NSERROR_OK;
-}
-
-void NS_URLBar::back_callback(Fl_Button *button)
-{
-       browser_window_history_back(m_bw, false);
-}
-
-void NS_URLBar::forward_callback(Fl_Button *button)
-{
-       browser_window_history_forward(m_bw, false);
-}
-
-
-void NS_URLBar::static_back_callback(Fl_Widget *w, void *f)
-{
-       ((NS_URLBar *)f)->back_callback((Fl_Button *)w);
-}
-
-void NS_URLBar::static_forward_callback(Fl_Widget *w, void *f)
-{
-       ((NS_URLBar *)f)->forward_callback((Fl_Button *)w);
-}
-
-#endif
-
-
 /**
  * netsurf window class constructor
  */
@@ -360,15 +121,6 @@ void NS_Window::closeEvent(QCloseEvent *event)
        browser_window_destroy(m_bw);
 }
 
-#if 0
-/**
- * qt window has been closed
- */
-void NS_Window::close_callback(Fl_Widget *w)
-{
-       browser_window_destroy(m_bw);
-}
-#endif
 
 /**
  * set the status text
@@ -417,13 +169,6 @@ nserror NS_Window::set_extent(int ew, int eh)
 
 /* static methods */
 #if 0
-/**
- * static window close qt callback which calls the instance
- */
-void NS_Window::static_close_callback(Fl_Widget *w, void *f)
-{
-       ((NS_Window *)f)->close_callback(w);
-}
 
 /**
  * static vertical scrollbar qt callback which calls the instance


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org
To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org

Reply via email to