Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
Qt
QtWebEngine
Commits
0fa35038
Commit
0fa35038
authored
11 years ago
by
Pierre Rossi
Browse files
Options
Download
Patches
Plain Diff
Basic event translation
parent
20b79124
dev
0.9
5.10
5.11
5.12
5.12.1
5.12.10
5.12.11
5.12.12
5.12.2
5.12.3
5.12.4
5.12.5
5.12.6
5.12.7
5.12.8
5.12.9
5.13
5.13.0
5.13.1
5.13.2
5.14
5.14.0
5.14.1
5.14.2
5.15
5.15.0
5.15.1
5.15.2
5.15.3
5.15.4
5.15.5
5.15.6
5.15.7
5.4
5.5
5.6
5.7
5.8
5.9
5.9.8
6.2
6.2.0
6.2.1
6.2.2
wip/47-based
wip/qtpdf
v5.15.0-alpha1
v5.14.1
v5.14.0
v5.14.0-rc2
v5.14.0-rc1
v5.14.0-beta3
v5.14.0-beta2
v5.14.0-beta1
v5.14.0-alpha1
v5.13.2
v5.13.1
v5.13.0
v5.13.0-rc3
v5.13.0-rc2
v5.13.0-rc1
v5.13.0-beta4
v5.13.0-beta3
v5.13.0-beta2
v5.13.0-beta1
v5.13.0-alpha1
v5.12.7
v5.12.6
v5.12.5
v5.12.4
v5.12.3
v5.12.2
v5.12.1
v5.12.0
v5.12.0-rc2
v5.12.0-rc1
v5.12.0-beta4
v5.12.0-beta3
v5.12.0-beta2
v5.12.0-beta1
v5.12.0-alpha1
v5.11.3
v5.11.2
v5.11.1
v5.11.0
v5.11.0-rc2
v5.11.0-rc1
v5.11.0-beta4
v5.11.0-beta3
v5.11.0-beta2
v5.11.0-beta1
v5.11.0-alpha1
v5.10.1
v5.10.0
v5.10.0-rc3
v5.10.0-rc2
v5.10.0-rc1
v5.10.0-beta4
v5.10.0-beta3
v5.10.0-beta2
v5.10.0-beta1
v5.10.0-alpha1
v5.9.9
v5.9.8
v5.9.7
v5.9.6
v5.9.5
v5.9.4
v5.9.3
v5.9.2
v5.9.1
v5.9.0
v5.9.0-rc2
v5.9.0-rc1
v5.9.0-beta4
v5.9.0-beta3
v5.9.0-beta2
v5.9.0-beta1
v5.9.0-alpha1
v5.8.0
v5.8.0-rc1
v5.8.0-beta1
v5.8.0-alpha1
v5.7.1
v5.7.0
v5.7.0-rc1
v5.7.0-beta1
v5.7.0-alpha1
v5.6.3
v5.6.2
v5.6.1
v5.6.1-1
v5.6.0
v5.6.0-rc1
v5.6.0-beta1
v5.6.0-alpha1
v5.5.1
v5.5.0
v5.5.0-rc1
v5.5.0-beta1
v5.5.0-alpha1
v5.4.2
v5.4.1
v5.4.0
v5.4.0-rc1
v5.4.0-beta1
v5.4.0-alpha1
v0.1.0-tp1
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
lib/blinqpage.cpp
+1
-4
lib/blinqpage.cpp
lib/lib.pro
+3
-1
lib/lib.pro
lib/raster_window.cpp
+3
-7
lib/raster_window.cpp
lib/render_widget_host_view_qt.cpp
+15
-15
lib/render_widget_host_view_qt.cpp
lib/render_widget_host_view_qt.h
+4
-2
lib/render_widget_host_view_qt.h
lib/web_event_factory.cpp
+85
-0
lib/web_event_factory.cpp
lib/web_event_factory.h
+19
-0
lib/web_event_factory.h
with
130 additions
and
29 deletions
lib/blinqpage.cpp
+
1
−
4
View file @
0fa35038
...
...
@@ -39,7 +39,6 @@
#include
"content/browser/renderer_host/backing_store_gtk.h"
#include
"webkit/user_agent/user_agent_util.h"
#include
"skia/ext/platform_canvas.h"
#include
"third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include
"backing_store_qt.h"
#include
"raster_window.h"
...
...
@@ -51,12 +50,9 @@
#include
<QGuiApplication>
#include
<qpa/qplatformwindow.h>
#include
<QLabel>
#include
<QMouseEvent>
#include
<QPainter>
#include
<qpa/qplatformnativeinterface.h>
#include
<X11/Xutil.h>
namespace
{
class
Context
;
...
...
@@ -165,6 +161,7 @@ inline net::URLRequestContext* ResourceContext::GetRequestContext()
return
context
->
GetRequestContext
()
->
GetURLRequestContext
();
}
class
RenderViewHost
:
public
content
::
RenderViewHostImpl
{
public:
...
...
This diff is collapsed.
Click to expand it.
lib/lib.pro
+
3
−
1
View file @
0fa35038
...
...
@@ -23,12 +23,14 @@ SOURCES = \
render_widget_host_view_qt
.
cpp
\
shell_qt
.
cpp
\
signal_connector
.
cpp
\
moc_signal_connector
.
cpp
web_event_factory
.
cpp
\
moc_signal_connector
.
cpp
HEADERS
=
\
backing_store_qt
.
h
\
blinqpage
.
h
\
raster_window
.
h
\
render_widget_host_view_qt
.
h
\
web_event_factory
.
h
\
signal_connector
.
h
This diff is collapsed.
Click to expand it.
lib/raster_window.cpp
+
3
−
7
View file @
0fa35038
...
...
@@ -46,12 +46,8 @@ bool RasterWindow::event(QEvent *event)
case
QEvent
::
UpdateRequest
:
renderNow
();
return
true
;
case
QEvent
::
MouseButtonDblClick
:
case
QEvent
::
MouseButtonPress
:
case
QEvent
::
MouseButtonRelease
:
// case QEvent::KeyPress:
if
(
m_view
)
return
m_view
->
handleEvent
(
event
);
}
return
QWindow
::
event
(
event
);
if
(
!
m_view
||
!
m_view
->
handleEvent
(
event
))
return
QWindow
::
event
(
event
);
return
true
;
}
This diff is collapsed.
Click to expand it.
lib/render_widget_host_view_qt.cpp
+
15
−
15
View file @
0fa35038
#include
"render_widget_host_view_qt.h"
#include
"backing_store_qt.h"
#include
"web_event_factory.h"
#include
"content/browser/renderer_host/render_view_host_impl.h"
#include
"content/common/gpu/gpu_messages.h"
#include
"raster_window.h"
...
...
@@ -8,6 +10,7 @@
#include
<QEvent>
#include
<QMouseEvent>
#include
<QKeyEvent>
#include
<QScreen>
#include
<QDebug>
...
...
@@ -54,13 +57,15 @@ bool RenderWidgetHostView::handleEvent(QEvent* event) {
case
QEvent
::
MouseButtonDblClick
:
case
QEvent
::
MouseButtonPress
:
case
QEvent
::
MouseButtonRelease
:
case
QEvent
::
MouseMove
:
handleMouseEvent
(
static_cast
<
QMouseEvent
*>
(
event
));
break
;
// case QEvent::KeyPress:
// handleKeyEvent(event);
// break;
case
QEvent
::
KeyPress
:
case
QEvent
::
KeyRelease
:
handleKeyEvent
(
static_cast
<
QKeyEvent
*>
(
event
));
break
;
default:
Q_ASSERT
(
false
);
// not reached
return
false
;
}
return
true
;
}
...
...
@@ -419,17 +424,12 @@ bool RenderWidgetHostView::IsPopup() const
void
RenderWidgetHostView
::
handleMouseEvent
(
QMouseEvent
*
ev
)
{
qDebug
()
<<
ev
<<
ev
->
pos
();
WebKit
::
WebMouseEvent
webKitEvent
;
webKitEvent
.
x
=
ev
->
x
();
webKitEvent
.
y
=
ev
->
y
();
webKitEvent
.
globalX
=
ev
->
globalX
();
webKitEvent
.
globalY
=
ev
->
globalY
();
webKitEvent
.
clickCount
=
(
ev
->
type
()
==
QEvent
::
MouseButtonDblClick
)
?
2
:
1
;
webKitEvent
.
button
=
mouseButtonForEvent
(
ev
);
//FIXME: and window coordinates ?
m_host
->
ForwardMouseEvent
(
webKitEvent
);
m_host
->
ForwardMouseEvent
(
WebEventFactory
::
toWebMouseEvent
(
ev
));
}
void
RenderWidgetHostView
::
handleKeyEvent
(
QKeyEvent
*
ev
)
{
m_host
->
ForwardKeyboardEvent
(
WebEventFactory
::
toWebKeyboardEvent
(
ev
));
}
This diff is collapsed.
Click to expand it.
lib/render_widget_host_view_qt.h
+
4
−
2
View file @
0fa35038
...
...
@@ -5,6 +5,7 @@
class
QEvent
;
class
QMouseEvent
;
class
QKeyEvent
;
class
RasterWindow
;
class
RenderWidgetHostView
...
...
@@ -78,11 +79,12 @@ private:
void
Paint
(
const
gfx
::
Rect
&
scroll_rect
);
bool
IsPopup
()
const
;
void
handleMouseEvent
(
QMouseEvent
*
ev
);
void
handleMouseEvent
(
QMouseEvent
*
);
void
handleKeyEvent
(
QKeyEvent
*
);
content
::
RenderWidgetHostImpl
*
m_host
;
RasterWindow
*
m_view
;
gfx
::
Size
m_requestedSize
;
};
#endif
\ No newline at end of file
#endif
This diff is collapsed.
Click to expand it.
lib/web_event_factory.cpp
0 → 100644
+
85
−
0
View file @
0fa35038
#include
"web_event_factory.h"
#include
<QMouseEvent>
#include
<QKeyEvent>
using
namespace
WebKit
;
static
WebMouseEvent
::
Button
mouseButtonForEvent
(
QMouseEvent
*
event
)
{
if
(
event
->
button
()
==
Qt
::
LeftButton
||
(
event
->
buttons
()
&
Qt
::
LeftButton
))
return
WebMouseEvent
::
ButtonLeft
;
else
if
(
event
->
button
()
==
Qt
::
RightButton
||
(
event
->
buttons
()
&
Qt
::
RightButton
))
return
WebMouseEvent
::
ButtonRight
;
else
if
(
event
->
button
()
==
Qt
::
MidButton
||
(
event
->
buttons
()
&
Qt
::
MidButton
))
return
WebMouseEvent
::
ButtonMiddle
;
return
WebMouseEvent
::
ButtonNone
;
}
static
inline
WebInputEvent
::
Modifiers
modifiersForEvent
(
Qt
::
KeyboardModifiers
modifiers
)
{
unsigned
result
=
0
;
if
(
modifiers
&
Qt
::
ShiftModifier
)
result
|=
WebInputEvent
::
ShiftKey
;
if
(
modifiers
&
Qt
::
ControlModifier
)
result
|=
WebInputEvent
::
ControlKey
;
if
(
modifiers
&
Qt
::
AltModifier
)
result
|=
WebInputEvent
::
AltKey
;
if
(
modifiers
&
Qt
::
MetaModifier
)
result
|=
WebInputEvent
::
MetaKey
;
return
(
WebInputEvent
::
Modifiers
)
result
;
}
WebMouseEvent
WebEventFactory
::
toWebMouseEvent
(
QMouseEvent
*
ev
)
{
WebMouseEvent
webKitEvent
;
webKitEvent
.
timeStampSeconds
=
ev
->
timestamp
()
/
1000.0
;
webKitEvent
.
button
=
mouseButtonForEvent
(
ev
);
webKitEvent
.
modifiers
=
modifiersForEvent
(
ev
->
modifiers
());
webKitEvent
.
x
=
webKitEvent
.
windowX
=
ev
->
x
();
webKitEvent
.
y
=
webKitEvent
.
windowY
=
ev
->
y
();
webKitEvent
.
globalX
=
ev
->
globalX
();
webKitEvent
.
globalY
=
ev
->
globalY
();
webKitEvent
.
clickCount
=
0
;
switch
(
ev
->
type
())
{
case
QEvent
::
MouseButtonPress
:
webKitEvent
.
clickCount
=
1
;
webKitEvent
.
type
=
WebInputEvent
::
MouseDown
;
break
;
case
QEvent
::
MouseMove
:
webKitEvent
.
type
=
WebInputEvent
::
MouseMove
;
break
;
case
QEvent
::
MouseButtonRelease
:
webKitEvent
.
type
=
WebInputEvent
::
MouseUp
;
break
;
case
QEvent
::
MouseButtonDblClick
:
webKitEvent
.
clickCount
=
2
;
default:
Q_ASSERT
(
false
);
};
return
webKitEvent
;
}
content
::
NativeWebKeyboardEvent
WebEventFactory
::
toWebKeyboardEvent
(
QKeyEvent
*
ev
)
{
content
::
NativeWebKeyboardEvent
webKitEvent
;
webKitEvent
.
timeStampSeconds
=
ev
->
timestamp
()
/
1000.0
;
webKitEvent
.
modifiers
=
modifiersForEvent
(
ev
->
modifiers
());
switch
(
ev
->
type
())
{
case
QEvent
::
KeyPress
:
webKitEvent
.
type
=
WebInputEvent
::
KeyDown
;
break
;
case
QEvent
::
KeyRelease
:
webKitEvent
.
type
=
WebInputEvent
::
KeyUp
;
break
;
}
webKitEvent
.
nativeKeyCode
=
ev
->
nativeVirtualKey
();
// FIXME: need Windows keycode mapping from WebCore...
memcpy
(
&
webKitEvent
.
text
,
ev
->
text
().
utf16
(),
qMin
(
sizeof
(
webKitEvent
.
text
),
sizeof
(
ev
->
text
().
utf16
())));
return
webKitEvent
;
}
This diff is collapsed.
Click to expand it.
lib/web_event_factory.h
0 → 100644
+
19
−
0
View file @
0fa35038
#ifndef WEB_EVENT_FACTORY_H
#define WEB_EVENT_FACTORY_H
#include
"content/public/browser/native_web_keyboard_event.h"
#include
"third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
class
QMouseEvent
;
class
QKeyEvent
;
class
WebEventFactory
{
public:
static
WebKit
::
WebMouseEvent
toWebMouseEvent
(
QMouseEvent
*
);
static
content
::
NativeWebKeyboardEvent
toWebKeyboardEvent
(
QKeyEvent
*
);
};
#endif
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets