Bug 1414204 Part4: Check headless mode before calling GDK_ROOT_WINDOW. f=bdahl. r=jimm.
authorStone Shih <sshih@mozilla.com>
Wed, 06 Dec 2017 16:54:44 +0800
changeset 448754 8d7a9a3500cac383bdfb19faa3a78d022847114b
parent 448753 a84069a023b390500462582cb7271ff6745eac91
child 448755 26927d4b8975345b805f942d5a569fe256264265
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1414204
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1414204 Part4: Check headless mode before calling GDK_ROOT_WINDOW. f=bdahl. r=jimm.
dom/plugins/base/nsPluginInstanceOwner.cpp
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -2295,17 +2295,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
                                presContext->AppUnitsToDevPixels(appPoint.y));
         const WidgetMouseEvent& mouseEvent = *anEvent.AsMouseEvent();
         // Get reference point relative to screen:
         LayoutDeviceIntPoint rootPoint(-1, -1);
         if (widget) {
           rootPoint = anEvent.mRefPoint + widget->WidgetToScreenOffset();
         }
 #ifdef MOZ_WIDGET_GTK
-        Window root = GDK_ROOT_WINDOW();
+        Window root = gfxPlatform::IsHeadless() ? X11None : GDK_ROOT_WINDOW();
 #else
         Window root = X11None; // Could XQueryTree, but this is not important.
 #endif
 
         switch (anEvent.mMessage) {
           case eMouseOver:
           case eMouseOut:
             {
@@ -2382,17 +2382,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
 
    //XXX case eMouseScrollEventClass: not received.
 
    case eKeyboardEventClass:
       if (anEvent.mPluginEvent)
         {
           XKeyEvent &event = pluginEvent.xkey;
 #ifdef MOZ_WIDGET_GTK
-          event.root = GDK_ROOT_WINDOW();
+          event.root = gfxPlatform::IsHeadless() ? X11None : GDK_ROOT_WINDOW();
           event.time = anEvent.mTime;
           const GdkEventKey* gdkEvent =
             static_cast<const GdkEventKey*>(anEvent.mPluginEvent);
           event.keycode = gdkEvent->hardware_keycode;
           event.state = gdkEvent->state;
           switch (anEvent.mMessage)
             {
             case eKeyDown: