This file is indexed.

/usr/share/openscenegraph/examples/osgviewerGTK/osggtkdrawingarea.cpp is in openscenegraph-examples 3.2.0~rc1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#include "osggtkdrawingarea.h"

OSGGTKDrawingArea::OSGGTKDrawingArea():
_widget   (gtk_drawing_area_new()),
_glconfig (0),
_context  (0),
_drawable (0),
_state    (0),
_queue    (*getEventQueue()) {
    setCameraManipulator(new osgGA::TrackballManipulator());
}

OSGGTKDrawingArea::~OSGGTKDrawingArea() {
}

bool OSGGTKDrawingArea::createWidget(int width, int height) {
    _glconfig = gdk_gl_config_new_by_mode(static_cast<GdkGLConfigMode>(
        GDK_GL_MODE_RGBA |
        GDK_GL_MODE_DEPTH |
        GDK_GL_MODE_DOUBLE
    ));

    if(not _glconfig) {
        osg::notify(osg::FATAL) << "Fail!" << std::endl;

        return false;
    }

    gtk_widget_set_size_request(_widget, width, height);

    gtk_widget_set_gl_capability(
        _widget,
        _glconfig,
        0,
        true,
        GDK_GL_RGBA_TYPE
    );

    gtk_widget_add_events(
        _widget,
        GDK_BUTTON1_MOTION_MASK |
        GDK_BUTTON2_MOTION_MASK |
        GDK_BUTTON3_MOTION_MASK |
        GDK_POINTER_MOTION_MASK |
        GDK_BUTTON_PRESS_MASK |
        GDK_BUTTON_RELEASE_MASK |
        GDK_KEY_PRESS_MASK |
        GDK_KEY_RELEASE_MASK |
        GDK_VISIBILITY_NOTIFY_MASK
    );

    // We do this so that we don't have to suck up ALL the input to the
    // window, but instead just when the drawing area is focused.
    g_object_set(_widget, "can-focus", true, NULL);

    _connect("realize", G_CALLBACK(&OSGGTKDrawingArea::_srealize));
    _connect("unrealize", G_CALLBACK(&OSGGTKDrawingArea::_sunrealize));
    _connect("expose_event", G_CALLBACK(&OSGGTKDrawingArea::_sexpose_event));
    _connect("configure_event", G_CALLBACK(&OSGGTKDrawingArea::_sconfigure_event));
    _connect("motion_notify_event", G_CALLBACK(&OSGGTKDrawingArea::_smotion_notify_event));
    _connect("button_press_event", G_CALLBACK(&OSGGTKDrawingArea::_sbutton_press_event));
    _connect("button_release_event", G_CALLBACK(&OSGGTKDrawingArea::_sbutton_press_event));
    _connect("key_press_event", G_CALLBACK(&OSGGTKDrawingArea::_skey_press_event));

    _gw = setUpViewerAsEmbeddedInWindow(0, 0, width, height);

    return true;
}

void OSGGTKDrawingArea::_realize(GtkWidget* widget) {
    _context  = gtk_widget_get_gl_context(widget);
    _drawable = gtk_widget_get_gl_drawable(widget);

    gtkRealize();
}

void OSGGTKDrawingArea::_unrealize(GtkWidget* widget) {
    gtkUnrealize();
}

bool OSGGTKDrawingArea::_expose_event(GtkWidget* widget, GdkEventExpose* event) {
    if(not gtkGLBegin()) return false;

    frame();

    gtkGLSwap();
    gtkGLEnd();

    return gtkExpose();
}

bool OSGGTKDrawingArea::_configure_event(GtkWidget* widget, GdkEventConfigure* event) {
    gtkGLBegin();

    _queue.windowResize(0, 0, event->width, event->height);

    _gw->resized(0, 0, event->width, event->height);

    gtkGLEnd();

    return gtkConfigure(event->width, event->height);
}

bool OSGGTKDrawingArea::_motion_notify_event(GtkWidget* widget, GdkEventMotion* event) {
    _state = event->state;

    _queue.mouseMotion(event->x, event->y);

    return gtkMotionNotify(event->x, event->y);
}

bool OSGGTKDrawingArea::_button_press_event(GtkWidget* widget, GdkEventButton* event) {
    _state = event->state;

    if(event->type == GDK_BUTTON_PRESS) {
        if(event->button == 1) gtk_widget_grab_focus(_widget);

        _queue.mouseButtonPress(event->x, event->y, event->button);

        return gtkButtonPress(event->x, event->y, event->button);
    }

    else if(event->type == GDK_BUTTON_RELEASE) {
        _queue.mouseButtonRelease(event->x, event->y, event->button);

        return gtkButtonRelease(event->x, event->y, event->button);
    }

    else return false;
}

bool OSGGTKDrawingArea::_key_press_event(GtkWidget* widget, GdkEventKey* event) {
    _state = event->state;

    if(event->type == GDK_KEY_PRESS) {
        _queue.keyPress(event->keyval);

        return gtkKeyPress(event->keyval);
    }

    else if(event->type == GDK_KEY_RELEASE) {
        _queue.keyRelease(event->keyval);

        return gtkKeyRelease(event->keyval);
    }

    else return false;
}