Gnash  0.8.11dev
gtk_cairo_create.h
Go to the documentation of this file.
1 /* GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #include <gdk/gdkdrawable.h>
21 
22 #include <cairo-xlib.h>
23 #include <gtk/gtk.h>
24 #ifndef _WIN32
25 #include <gdk/gdkx.h>
26 #else
27 #include <gdk/gdk.h>
28 #endif
29 
30 
31 /* copied from gtk+/gdk/gdkcairo.c and gtk+/gdk/x11/gdkdrawable-x11.c
32  * gdk_cairo_create() is be available in gtk 2.8
33  */
34 static cairo_t *
35 gdk_cairo_create (GdkDrawable *target)
36 {
37  int width, height;
38  int x_off=0, y_off=0;
39  cairo_t *cr;
40  cairo_surface_t *surface;
41  GdkDrawable *drawable = target;
42  GdkVisual *visual;
43 
44  if (GDK_IS_WINDOW(target)) {
45  /* query the window's backbuffer if it has one */
46  GdkWindow *window = GDK_WINDOW(target);
47  gdk_window_get_internal_paint_info (window,
48  &drawable, &x_off, &y_off);
49  }
50  visual = gdk_drawable_get_visual (drawable);
51  gdk_drawable_get_size (drawable, &width, &height);
52 
53  if (visual) {
54  surface = cairo_xlib_surface_create (GDK_DRAWABLE_XDISPLAY (drawable),
55  GDK_DRAWABLE_XID (drawable),
56  GDK_VISUAL_XVISUAL (visual),
57  width, height);
58  } else if (gdk_drawable_get_depth (drawable) == 1) {
59  surface = cairo_xlib_surface_create_for_bitmap
60  (GDK_PIXMAP_XDISPLAY (drawable),
61  GDK_PIXMAP_XID (drawable),
62  GDK_SCREEN_XSCREEN (gdk_drawable_get_screen (drawable)),
63  width, height);
64  } else {
65  g_warning ("Using Cairo rendering requires the drawable argument to\n"
66  "have a specified colormap. All windows have a colormap,\n"
67  "however, pixmaps only have colormap by default if they\n"
68  "were created with a non-NULL window argument. Otherwise\n"
69  "a colormap must be set on them with "
70  "gdk_drawable_set_colormap");
71  return NULL;
72  }
73  cairo_surface_set_device_offset (surface, -x_off, -y_off);
74  cr = cairo_create (surface);
75  cairo_surface_destroy (surface);
76  return cr;
77 }
gnash::geometry::SnappingRanges2d< std::int32_t >
gnash::RcInitFile::verbosityLevel
int verbosityLevel() const
Definition: rc.h:112
sound_handler.h
gnash::gnash_cursor_type
gnash_cursor_type
Enumerates mouse cursor types.
Definition: gui.h:81
gnash::key::GNASH_MOD_CONTROL
@ GNASH_MOD_CONTROL
Definition: GnashKey.h:37
gnash::RcInitFile::useActionDump
bool useActionDump() const
Definition: rc.h:74
gnash::geometry::Range2d< int >
gnash_canvas_get_renderer
std::shared_ptr< gnash::Renderer > gnash_canvas_get_renderer(GnashCanvas *canvas)
Get the Renderer for this canvas.
Definition: gtk_canvas.cpp:323
gnash::key::DOWN
@ DOWN
Definition: GnashKey.h:207
gnash::Gui::_renderer
std::shared_ptr< Renderer > _renderer
The handler which is called to update the client area of our window.
Definition: gui.h:506
gnash::GtkGui::createHelpMenu
void createHelpMenu(GtkWidget *obj)
Definition: gtk.cpp:1996
gnash::key::BACKSPACE
@ BACKSPACE
Definition: GnashKey.h:53
gnash::CURSOR_INPUT
@ CURSOR_INPUT
Definition: gui.h:84
gnash::GtkGui::~GtkGui
virtual ~GtkGui()
Definition: gtk.cpp:131
height
@ height
Definition: klash_part.cpp:329
gnash::GtkGui::setInvalidatedRegions
void setInvalidatedRegions(const InvalidatedRanges &ranges)
Definition: gtk.cpp:883
gnash::GtkGui::init
virtual bool init(int argc, char **argv[])
GUI interface implementation.
Definition: gtk.cpp:153
gnash::GtkGui::quitUI
virtual void quitUI()
End main rendering loop calling GUI-specific exit functions.
Definition: gtk.cpp:591
gnash::GtkGui::unsetFullscreen
virtual void unsetFullscreen()
Definition: gtk.cpp:357
gnash::QUALITY_BEST
@ QUALITY_BEST
Definition: GnashEnums.h:39
gnash::RcInitFile::updateFile
bool updateFile(const std::string &filespec)
Writes a valid gnashrc file. If the file already exists, is is overwritten.
Definition: rc.cpp:730
gnash::GtkGui::showMouse
virtual bool showMouse(bool show)
Sets whether the gui should show the system mouse pointer.
Definition: gtk.cpp:427
gnash::RunResources::getHWAccelBackend
std::string & getHWAccelBackend()
Definition: RunResources.h:141
versionText
GtkWidget * versionText
Definition: gtk.cpp:969
gnash::RcInitFile::setStreamsTimeout
void setStreamsTimeout(const double &x)
Set seconds of inactivity before timing out streams downloads.
Definition: rc.h:232
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
gnash::RcInitFile::setFlashSystemOS
void setFlashSystemOS(const std::string &value)
Definition: rc.h:208
y
std::int32_t y
Definition: BitmapData_as.cpp:435
gnash::key::i
@ i
Definition: GnashKey.h:155
gnash::RcInitFile::setSOLReadOnly
void setSOLReadOnly(bool x)
Definition: rc.h:279
stop
@ stop
Definition: klash_part.cpp:330
gnash::GtkGui::createMenu
virtual bool createMenu()
Definition: gtk.cpp:665
gnash::RunResources::getRenderBackend
std::string & getRenderBackend()
Definition: RunResources.h:136
gnash::GtkGui::getScreenDPI
virtual double getScreenDPI() const
Definition: gtk.cpp:517
gnash::RcInitFile::setLocalConnection
void setLocalConnection(bool x)
Definition: rc.h:283
rc.h
_
#define _(String)
Definition: log.h:44
Renderer.h
streamsTimeoutScale
GtkWidget * streamsTimeoutScale
Definition: gtk.cpp:960
gnash::key::modifier
modifier
Definition: GnashKey.h:34
gnash::GtkGui::renderBuffer
virtual void renderBuffer()
Definition: gtk.cpp:877
MediaHandler.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::Gui
Parent class from which all GUI implementations will depend.
Definition: gui.h:88
gnash::key::DELETEKEY
@ DELETEKEY
Definition: GnashKey.h:177
gnash::key::CONTROL
@ CONTROL
Definition: GnashKey.h:62
gnash::key::CAPSLOCK
@ CAPSLOCK
Definition: GnashKey.h:65
gnash::GtkGui::showMenu
virtual void showMenu(bool show)
Sets whether the menus should be shown (for fscommand)
Definition: gtk.cpp:471
gnash::key::F1
@ F1
Definition: GnashKey.h:190
gnash::GtkGui::screenResolution
virtual std::pair< int, int > screenResolution() const
Definition: gtk.cpp:511
gnash::RcInitFile::setMovieLibraryLimit
void setMovieLibraryLimit(int value)
Definition: rc.h:96
gnash::key::m
@ m
Definition: GnashKey.h:159
gnash::RcInitFile::popupMessages
bool popupMessages() const
Definition: rc.h:132
gnash::key::GNASH_MOD_NONE
@ GNASH_MOD_NONE
Definition: GnashKey.h:35
urlOpenerText
GtkWidget * urlOpenerText
Definition: gtk.cpp:970
gnash::key::n
@ n
Definition: GnashKey.h:160
gnash::QUALITY_MEDIUM
@ QUALITY_MEDIUM
Definition: GnashEnums.h:37
gnash::RcInitFile::setScriptsRecursionLimit
void setScriptsRecursionLimit(int x)
Definition: rc.h:355
gnash::GtkGui::createMenuBar
bool createMenuBar()
Create a menu bar for the application, attach to our window.
Definition: gtk.cpp:649
gnash::geometry::Range2d::getMinX
T getMinX() const
Get min X ordinate.
Definition: Range2d.h:603
gnash::RcInitFile::showMalformedSWFErrors
bool showMalformedSWFErrors() const
Definition: rc.h:89
solSandbox
GtkWidget * solSandbox
Definition: gtk.cpp:967
lockScriptLimitsToggle
GtkWidget * lockScriptLimitsToggle
Definition: gtk.cpp:978
gnash::GtkGui::resizeWindow
virtual void resizeWindow(int width, int height)
Definition: gtk.cpp:733
GnashEnums.h
gnash::key::KP_0
@ KP_0
Definition: GnashKey.h:179
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::geometry::Range2d::isNull
bool isNull() const
Returns true if this is the NULL Range2d.
Definition: Range2d.h:181
gnash::key::PGUP
@ PGUP
Definition: GnashKey.h:213
gnash::Gui::_runResources
RunResources & _runResources
Per-run resources.
Definition: gui.h:500
gnash::RunResources::setRenderer
void setRenderer(std::shared_ptr< Renderer > r)
Definition: RunResources.h:108
gnash::key::LEFT
@ LEFT
Definition: GnashKey.h:209
gnash::RcInitFile::saveLoadedMedia
void saveLoadedMedia(bool value)
Definition: rc.h:302
gnash::Gui::_fullscreen
bool _fullscreen
Definition: gui.h:513
gnash::key::RIGHT
@ RIGHT
Definition: GnashKey.h:208
gnash::media::MediaHandler
The MediaHandler class acts as a factory to provide parser and decoders.
Definition: MediaHandler.h:70
gnash::GtkGui::createMenuAlt
virtual bool createMenuAlt()
Definition: gtk.cpp:707
gnash::GtkGui::grabFocus
void grabFocus()
Grab focus so to receive all key events.
Definition: gtk.cpp:585
gnash::geometry::Intersection
Range2d< T > Intersection(const Range2d< T > &r1, const Range2d< T > &r2)
Return a rectangle being the intersetion of the two rectangles.
Definition: Range2d.h:762
color
const VGfloat color[4]
Definition: testr_gtk.cpp:82
gnash::geometry::Range2d::isFinite
bool isFinite() const
Returns true if this is a finite Range2d.
Definition: Range2d.h:210
librarySize
GtkWidget * librarySize
Definition: gtk.cpp:971
gnash::key::r
@ r
Definition: GnashKey.h:164
gnash::RcInitFile::useLocalDomain
bool useLocalDomain() const
Definition: rc.h:135
localDomainToggle
GtkWidget * localDomainToggle
Definition: gtk.cpp:961
gnash::GtkGui::setCursor
virtual void setCursor(gnash_cursor_type newcursor)
Sets the current mouse cursor for the Gui window.
Definition: gtk.cpp:392
gnash::key::GNASH_MOD_SHIFT
@ GNASH_MOD_SHIFT
Definition: GnashKey.h:36
gnash::GtkGui::GtkGui
GtkGui(unsigned long xid, float scale, bool loop, RunResources &r)
Definition: gtk.cpp:135
startStoppedToggle
GtkWidget * startStoppedToggle
Definition: gtk.cpp:972
BRANCH_NICK
#define BRANCH_NICK
Definition: revno.h:2
COMMIT_ID
#define COMMIT_ID
Definition: revno.h:3
gnash::key::INSERT
@ INSERT
Definition: GnashKey.h:210
gnash::key::ALT
@ ALT
Definition: GnashKey.h:63
gnash::key::PGDN
@ PGDN
Definition: GnashKey.h:214
gnash::key::END
@ END
Definition: GnashKey.h:212
solLocalDomainToggle
GtkWidget * solLocalDomainToggle
Definition: gtk.cpp:964
gnash::key::code
code
Definition: GnashKey.h:44
gnash::geometry::Range2d::getMinY
T getMinY() const
Get min Y ordinate.
Definition: Range2d.h:623
gnash::key::ENTER
@ ENTER
Definition: GnashKey.h:58
gnash::GtkGui::hideMenu
virtual void hideMenu()
Definition: gtk.cpp:381
play
@ play
Definition: klash_part.cpp:330
gnash::RcInitFile::useSound
bool useSound() const
Definition: rc.h:124
gnash::Gui::_width
int _width
Desired window width.
Definition: gui.h:494
gnash::geometry::Range2d::width
T width() const
Return width this Range2d.
Definition: Range2d.h:374
gnash::key::TAB
@ TAB
Definition: GnashKey.h:54
gnash::Gui::advance_movie
static bool advance_movie(Gui *gui)
Convenience static wrapper around advanceMovie for callbacks happiness.
Definition: gui.h:272
gnash::key::CLEAR
@ CLEAR
Definition: GnashKey.h:57
gnash::key::INVALID
@ INVALID
Definition: GnashKey.h:45
gnash::RcInitFile::showMouse
bool showMouse() const
Definition: rc.h:164
gnash::key::p
@ p
Definition: GnashKey.h:162
gnash::key::SHIFT
@ SHIFT
Definition: GnashKey.h:61
insecureSSLToggle
GtkWidget * insecureSSLToggle
Definition: gtk.cpp:966
gnash::RcInitFile::useLocalHost
bool useLocalHost() const
Whether to restrict access to the local host
Definition: rc.h:139
gnash::RcInitFile::saveStreamingMedia
void saveStreamingMedia(bool value)
Definition: rc.h:298
gnash::key::UP
@ UP
Definition: GnashKey.h:206
scriptsRecursionLimit
GtkWidget * scriptsRecursionLimit
Definition: gtk.cpp:977
gnash::key::HOME
@ HOME
Definition: GnashKey.h:211
gnash::GtkGui::error
virtual void error(const std::string &msg)
Handle error message from the core.
Definition: gtk.cpp:275
gnash::GtkGui::createWindow
virtual bool createWindow(int width, int height)
Definition: gtk.cpp:857
gnash::RcInitFile::lockScriptLimits
void lockScriptLimits(bool x)
Definition: rc.h:357
gnash::RunResources
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:54
gnash::RcInitFile::useParserDump
bool useParserDump() const
Definition: rc.h:77
gnash::Gui::_mouseShown
bool _mouseShown
Definition: gui.h:516
gnash::GtkGui::createControlMenu
void createControlMenu(GtkWidget *obj)
Definition: gtk.cpp:2106
gnash::geometry::SnappingRanges2d::size
size_type size() const
Returns the number of ranges in the list.
Definition: snappingrange.h:320
gnash_canvas_setup
void gnash_canvas_setup(GnashCanvas *canvas, std::string &hwaccel, std::string &renderer, int argc, char **argv[])
Select renderer and hwaccel, prep canvas for drawing.
Definition: gtk_canvas.cpp:200
VM.h
gnash::Gui::quit
void quit()
Always called on exit.
Definition: gui.cpp:215
gnash::CURSOR_HAND
@ CURSOR_HAND
Definition: gui.h:82
gnash::GtkGui::setClipboard
virtual void setClipboard(const std::string &copy)
Definition: gtk.cpp:306
gnash_canvas_new
GtkWidget * gnash_canvas_new()
allocate memory for canvas to draw in
Definition: gtk_canvas.cpp:80
gnash::GtkGui::createEditMenu
void createEditMenu(GtkWidget *obj)
Definition: gtk.cpp:1975
gnash::QUALITY_HIGH
@ QUALITY_HIGH
Definition: GnashEnums.h:38
log.h
gnash::GtkGui::run
virtual bool run()
Start main rendering loop.
Definition: gtk.cpp:254
localConnectionToggle
GtkWidget * localConnectionToggle
Definition: gtk.cpp:965
gnash_canvas_before_rendering
void gnash_canvas_before_rendering(GnashCanvas *canvas, gnash::movie_root *stage)
Definition: gtk_canvas.cpp:317
gnash::RcInitFile::setSOLSafeDir
void setSOLSafeDir(const std::string &x)
Definition: rc.h:271
logfileName
GtkWidget * logfileName
Definition: gtk.cpp:957
gnash::GtkGui::createFileMenu
void createFileMenu(GtkWidget *obj)
Definition: gtk.cpp:1923
gnash::key::ESCAPE
@ ESCAPE
Definition: GnashKey.h:72
gnashconfig.h
gnash::Gui::isStopped
bool isStopped() const
See stop(), play() and pause()
Definition: gui.h:343
gtk_canvas.h
gnash::RcInitFile::getDefaultInstance
static RcInitFile & getDefaultInstance()
Return the default instance of RC file.
Definition: rc.cpp:61
SPACE
#define SPACE
Definition: aos4_gnash_prefs.cpp:29
ASCodingErrorToggle
GtkWidget * ASCodingErrorToggle
Definition: gtk.cpp:956
gnash::geometry::Range2d::height
T height() const
Return height this Range2dangle.
Definition: Range2d.h:385
gnash::Gui::getStage
movie_root * getStage()
The root movie, or "Stage".
Definition: gui.h:407
RunResources.h
gnash::GtkGui::beforeRendering
virtual void beforeRendering()
Definition: gtk.cpp:871
gnash::Gui::_xid
unsigned long _xid
The X Window ID to attach to. If zero, we create a new window.
Definition: gui.h:486
gnash::key::c
@ c
Definition: GnashKey.h:149
localHostToggle
GtkWidget * localHostToggle
Definition: gtk.cpp:962
gnash::GtkGui::createViewMenu
void createViewMenu(GtkWidget *obj)
Definition: gtk.cpp:2015
gnash::QUALITY_LOW
@ QUALITY_LOW
Definition: GnashEnums.h:36
gnash::RcInitFile::setScriptsTimeout
void setScriptsTimeout(int x)
Definition: rc.h:351
VERSION
#define VERSION
Definition: gnashconfig.h:731
writeLogToggle
GtkWidget * writeLogToggle
Definition: gtk.cpp:958
gnash::geometry::Range2d::setTo
Range2d< T > & setTo(T x, T y)
Set ourself to bound the given point.
Definition: Range2d.h:339
gnash::Gui::_interval
unsigned int _interval
Main loop interval: the time between successive advance_movie calls.
Definition: gui.h:503
gnash::RcInitFile::ignoreShowMenu
void ignoreShowMenu(bool value)
Definition: rc.h:345
gnash::Gui::_validbounds
geometry::Range2d< int > _validbounds
Definition: gui.h:491
gnash::GtkGui::setInterval
virtual void setInterval(unsigned int interval)
Set main loop delay in milliseconds.
Definition: gtk.cpp:630
gnash::RcInitFile::startStopped
bool startStopped() const
Return true if user is willing to start the gui in "stop" mode.
Definition: rc.h:103
gui.h
gnash::key::GNASH_MOD_ALT
@ GNASH_MOD_ALT
Definition: GnashKey.h:38
gnash::key::NOBREAKSPACE
@ NOBREAKSPACE
Definition: GnashKey.h:227
gtksup.h
saveLoadedMediaToggle
GtkWidget * saveLoadedMediaToggle
Definition: gtk.cpp:975
solReadOnlyToggle
GtkWidget * solReadOnlyToggle
Definition: gtk.cpp:963
gnash::RcInitFile::insecureSSL
bool insecureSSL() const
Definition: rc.h:106
gnash::RcInitFile::setURLOpenerFormat
void setURLOpenerFormat(const std::string &value)
Definition: rc.h:244
gnash::RcInitFile::setDebugLog
void setDebugLog(const std::string &x)
Definition: rc.h:115
gnash::GtkGui::checkX11Extension
bool checkX11Extension(const std::string &ext)
Definition: gtk.cpp:2193
gnash::RcInitFile::setFlashVersionString
void setFlashVersionString(const std::string &value)
Definition: rc.h:200
gnash::geometry::SnappingRanges2d::getRange
const RangeType & getRange(size_type index) const
Returns the range at the specified index.
Definition: snappingrange.h:326
actionDumpToggle
GtkWidget * actionDumpToggle
Definition: gtk.cpp:953
mediaDir
GtkWidget * mediaDir
Definition: gtk.cpp:973
width
@ width
Definition: klash_part.cpp:329
saveStreamingMediaToggle
GtkWidget * saveStreamingMediaToggle
Definition: gtk.cpp:974
gnash::key::HELP
@ HELP
Definition: GnashKey.h:325
gnash::RcInitFile::useWriteLog
bool useWriteLog() const
Definition: rc.h:80
vaapi_utils.h
x
std::int32_t x
Definition: BitmapData_as.cpp:434
verbosityScale
GtkWidget * verbosityScale
Definition: gtk.cpp:959
gnash::RcInitFile::showASCodingErrors
bool showASCodingErrors() const
Definition: rc.h:86
gnash::GtkGui::setTimeout
virtual void setTimeout(unsigned int timeout)
Set the time in milliseconds after which the programme should exit.
Definition: gtk.cpp:268
gnash::GtkGui::getPixelAspectRatio
virtual double getPixelAspectRatio() const
For System.capabilities information.
Definition: gtk.cpp:495
data
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
gnash::key::e
@ e
Definition: GnashKey.h:151
gnash::RcInitFile::setMediaDir
void setMediaDir(const std::string &value)
Definition: rc.h:306
gnash::Gui::_height
int _height
Desired window height.
Definition: gui.h:497
BRANCH_REVNO
#define BRANCH_REVNO
Definition: revno.h:1
parserDumpToggle
GtkWidget * parserDumpToggle
Definition: gtk.cpp:954
gnash::GtkGui::setupEvents
virtual bool setupEvents()
Set up callbacks for key, mouse and other GTK events.
Definition: gtk.cpp:541
gnash::RcInitFile
Definition: rc.h:44
osText
GtkWidget * osText
Definition: gtk.cpp:968
gnash::GtkGui::setFullscreen
virtual void setFullscreen()
Definition: gtk.cpp:314
malformedSWFToggle
GtkWidget * malformedSWFToggle
Definition: gtk.cpp:955
gnash::RcInitFile::setSOLLocalDomain
void setSOLLocalDomain(bool x)
Definition: rc.h:275
scriptsTimeout
GtkWidget * scriptsTimeout
Definition: gtk.cpp:976
soundToggle
GtkWidget * soundToggle
Definition: gtk.cpp:952
gnash::key::NUM_LOCK
@ NUM_LOCK
Definition: GnashKey.h:223
GNASH_CANVAS
#define GNASH_CANVAS(object)
Definition: gtk_canvas.h:39