/usr/include/Nux-4.0/Nux/WindowThread.h is in libnux-4.0-dev 4.0.6+14.04.20140409-0ubuntu1.
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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | /*
* Copyright 2010 Inalogic® Inc.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License, as
* published by the Free Software Foundation; either version 2.1 or 3.0
* of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the applicable version of the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of both the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Authored by: Jay Taoko <jaytaoko@inalogic.com>
*
*/
#ifndef WINDOWTHREAD_H
#define WINDOWTHREAD_H
#include "TimerProc.h"
#ifdef NUX_GESTURES_SUPPORT
#include "GeisAdapter.h"
#endif
#if defined(NUX_OS_LINUX) && defined(USE_X11)
#include "XIMController.h"
#endif
namespace nux
{
class BaseWindow;
class WindowThread;
class Layout;
class HLayout;
class GraphicsDisplay;
class ClientArea;
class WindowCompositor;
class AbstractThread;
class SystemThread;
class UXTheme;
class TimerHandler;
#if !defined(NUX_MINIMAL)
class Timeline;
#endif
class Event;
class Area;
struct ClientAreaDraw;
#if (defined(NUX_OS_LINUX) || defined(NUX_USE_GLIB_LOOP_ON_WINDOWS)) && (!defined(NUX_DISABLE_GLIB_LOOP))
class ExternalGLibSources;
gboolean nux_event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data);
gboolean nux_timeout_dispatch(gpointer user_data);
#endif
//! Event Inspector function prototype.
/*!
If an event inspector return true, then the event is discarded.
*/
typedef int(*EventInspector) (Area* area, Event* event, void* data);
//! Main class of a Nux window app.
/*!
Each WindowThread runs in its own loop. There cannot be more than one WindowThread per system thread.
*/
class WindowThread: public AbstractThread
{
NUX_DECLARE_OBJECT_TYPE(WindowThread, AbstractThread);
public:
WindowThread(const char *WindowTitle, int width, int height, AbstractThread *Parent, bool Modal);
virtual ~WindowThread();
//! Start the WindowThread in the current Thread.
/*!
Run the main loop of the window. \n;
The function blocks until the the main loop is stopped.
@param ptr Reserved.
*/
virtual int Run(void *ptr = NULL);
/*!
Start the user interface Window in it own thread. Start return immediately after the thread is created.
@param ptr Reserved.
*/
virtual ThreadState Start(void *ptr = NULL);
//! Exit from the WindowThread loop.
/*!
Exit the WindowThread loop.
*/
void ExitMainLoop();
//! Set window size.
/*!
Set window size.
@param width Window width.
@param height Window height.
*/
void SetWindowSize(int width, int height);
//! Set the background for the window.
/*!
Set the background for the window.
@param background_layer background layer.
*/
void SetWindowBackgroundPaintLayer(AbstractPaintLayer *background_layer);
/*!
Get the graphics display (this is the physical window of this thread).
@return The graphics display.
*/
GraphicsDisplay &GetGraphicsDisplay() const;
/*!
Get the graphics engine (this is the object that renders the graphics primitives).
@return The graphics display.
*/
GraphicsEngine &GetGraphicsEngine() const;
/*!
Get the UI compositor (this is processes events and renders ui objects).
@return The UI compositor.
*/
WindowCompositor& GetWindowCompositor() const;
/*!
Get the painter object.
@return The painter object.
*/
BasePainter &GetPainter() const;
/*!
Get the timer manager.
@return The timer manager.
*/
TimerHandler &GetTimerHandler() const;
/*!
Get the UI resource manager (load textures and other data for user interface rendering).
@param The ui resource manager.
*/
UXTheme &GetTheme() const;
//! Set the layout for this window thread.
/*!
@param layout The layout of the user interface.
*/
void SetLayout(Layout *layout);
//! Get the layout of this window.
/*!
@return The layout of this window.
*/
Layout* GetLayout();
//! Return true if the process is inside a layout cycle.
/*!
@return True if the process is inside a layout cycle.
*/
bool IsInsideLayoutCycle() const;
//! Deprecated. Replace with IsInsideLayoutCycle.
bool IsComputingLayout() const
{
return IsInsideLayoutCycle();
}
//! Schedule a size computation cycle on an area before the rendering is performed.
/*!
This list contains the area whose size need to be computed.
@param area The object that will perform a size computation cycle.
\sa ComputeQueuedLayout.
@return True if the object was succefully queued.
*/
bool QueueObjectLayout(Area *area);
//! Compute the layout of a specific element
/*!
Immediate size negotiation for a View or a layout.
*/
void ComputeElementLayout(Area* bo, bool recurse_to_top_level_layout = false);
//! Remove an area from the list of object whose size was scheduled to be computed before the rendering cycle.
/*!
@param area The object to remove form the list.
@return True if the object was in the _queued_layout_list and has been removed.
\sa ComputeQueuedLayout, QueueObjectLayout.
*/
bool RemoveObjectFromLayoutQueue(Area *area);
/*!
Return \i true while waiting for a modal window to return.
@return \i True while waiting for a modal window to return.
*/
bool IsWaitingforModalWindow() const;
/*!
Return \i true if this window is modal.
@return \i True if this window is modal.
*/
bool IsModalWindow() const;
/*!
Return true if this windowThread is embedded inside Compiz.
@return True if embedded inside Compiz.
*/
bool IsEmbeddedWindow() const;
#if defined(NUX_OS_WINDOWS)
bool ProcessForeignEvent(HWND hWnd, MSG msg, WPARAM wParam, LPARAM lParam, void *data);
#elif defined(USE_X11)
bool ProcessForeignEvent(XEvent *event, void *data);
#else
bool ProcessForeignEvent();
#endif
/*!
In embedded mode, allow presentation on any windows intersecting this
rect. The effect of this is culmulative for the frame, so it can be
called multiple times with many different rects until
RenderInterfaceFromForeignCmd is called.
\sa IsEmbeddedWindow
@param rect Region of the display to consider for presenting windows
*/
void PresentWindowsIntersectingGeometryOnThisFrame(Geometry const& rect);
/*!
Render the interface. This command is send from the pluging when the window thread is embedded.
The clip region matches the surface of one single monitor screen, or a region inside that screen.
\sa IsEmbeddedWindow.
@param clip Region of the display to render.
*/
void RenderInterfaceFromForeignCmd(Geometry const& clip);
/*!
Used to mark the end of the foreign frame. All calls to PresentInEmbeddedModeOnThisFrame
are now redirected to this upcoming frame where we will be called next.
*/
void ForeignFrameEnded();
/*!
Used to mark the cutoff point where all calls to PresentInEmbeddedModeOnThisFrame
should be effective on the next frame, and not this one, because the parent context
has stopped tracking damage events for this frame
*/
void ForeignFrameCutoff();
#if !defined(NUX_MINIMAL)
/*!
Add a timeline to our window
*/
void AddTimeline(Timeline* timeline);
void RemoveTimeline(Timeline* timeline);
bool ProcessTimelines(gint64 micro_secs);
long last_timeline_frame_time_sec_;
long last_timeline_frame_time_usec_;
#endif
void StartMasterClock();
void StopMasterClock();
sigc::signal<void> RedrawRequested;
sigc::signal<void, int, int, int, int> window_configuration; //!< emmitted when the window Geometry changes.
//! Set an event inspector function.
/*!
Inspect all events and returns the action to be taken for the event(process or discard).
If \a function as already been added, return its unique id.\n
If \a function is null, return 0.\n
@param function Event inspector function callback.
@param data User defined data.
@return Unique id for the event inspector callback.
*/
int InstallEventInspector(EventInspector function, void* data);
//! Remove an event inspector.
/*!
Remove the event inspector identified by the provided unique id.
@param event_inspector_id Unique id for the event inspector.
@return True If the event inspector exists and has been removed.
*/
bool RemoveEventInspector(int event_inspector_id);
//! Remove an event inspector.
/*!
Remove the event inspector identified by the provided function.
@param function Event inspector function callback.
@return True If the event inspector exists and has been removed.
*/
bool RemoveEventInspector(EventInspector function);
//! Call event inspectors.
/*!
Call event inspectors to have a look at the event.
@return True if the event should be discarded.
*/
bool CallEventInspectors(Event* event);
//! Sets a timer from a different thread.
/*!
Sets a timer and a callback. When the timer expires, the callback is executed. This function is meant to be called
from a different thread. This function very carefully avoid calling any thread specific objects (TLS).
@param time_ms Timer delay in milliseconds.
@param timeout_signal Pointer to a TimeOutSignal.
@param user_data Pointer to user data.
@return A timer handle.
*/
TimerHandle SetAsyncTimerCallback(int time_ms, TimeOutSignal* timeout_signal, void *user_data);
/*!
Return the Window title.
@return The window title.
*/
std::string GetWindowTitle() const;
void ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw);
void RequestRedraw();
void ClearRedrawFlag();
bool IsRedrawNeeded() const;
// DrawList - this is a maintained list of areas that will
// be completely redraw on the next frame
void AddToDrawList(View *view);
void ClearDrawList();
std::vector<Geometry> const& GetDrawList() const;
// PresentationList - this is a maintained list of areas that
// will be presented to the reference framebuffer or backbuffer
// in embedded mode on the next frame
bool AddToPresentationList(nux::BaseWindow*, bool force);
std::vector<Geometry> GetPresentationListGeometries() const;
Event GetNextEvent();
#ifdef NUX_GESTURES_SUPPORT
/*!
Simple wrapper for ProcessEvent for connection with GeisAdapter::event_ready
*/
void ProcessGestureEvent(GestureEvent &event) { ProcessEvent(event); }
GeisAdapter *GetGeisAdapter() const {return geis_adapter_.get();}
#endif
typedef std::function<void()> FdWatchCallback;
void WatchFdForEvents(int fd, const FdWatchCallback &);
void UnwatchFd(int fd);
#if defined(NUX_OS_LINUX) && defined(USE_X11)
void XICFocus(TextEntry* text_entry);
void XICUnFocus();
#endif
protected:
/*!
Constructor-like function for the thread.
Will be called by EntryPoint before executing the thread body.
For the main window, ThreadCtor is called in nux::CreateMainWindow.
ThreadCtor creates and initialize the following elements:
- Graphics Window
- Timer
- Painter
- Compositor
- Theme engine
After ThreadCtor is called, thread_ctor_called_ is set to true;
*/
virtual bool ThreadCtor();
#if defined(NUX_OS_WINDOWS)
/*!
Constructor-like function for the thread.
Will be called by EntryPoint before executing the thread body.
For the main window, ThreadCtor is called in nux::CreateMainWindow.
ThreadCtor creates and initialize the following elements:
- Graphics Window(from the externally created window)
- Timer
- Painter
- Compositor
- Theme engine
After ThreadCtor is called, thread_ctor_called_ is set to true;
This function is called when Nux is embedded. \sa IsEmbeddedWindow.
*/
virtual bool ThreadCtor(HWND WindowHandle, HDC WindowDCHandle, HGLRC OpenGLRenderingContext);
#elif defined(USE_X11)
#ifdef NUX_OPENGLES_20
/*!
Constructor-like function for the thread.
Will be called by EntryPoint before executing the thread body.
For the main window, ThreadCtor is called in nux::CreateMainWindow.
ThreadCtor creates and initialize the following elements:
- Graphics Window(from the externally created window)
- Timer
- Painter
- Compositor
- Theme engine
After ThreadCtor is called, thread_ctor_called_ is set to true;
This function is called when Nux is embedded. \sa IsEmbeddedWindow.
*/
virtual bool ThreadCtor(Display *X11Display, Window X11Window, EGLContext OpenGLContext);
#else
/*!
Constructor-like function for the thread.
Will be called by EntryPoint before executing the thread body.
For the main window, ThreadCtor is called in nux::CreateMainWindow.
ThreadCtor creates and initialize the following elements:
- Graphics Window(from the externally created window)
- Timer
- Painter
- Compositor
- Theme engine
After ThreadCtor is called, thread_ctor_called_ is set to true;
This function is called when Nux is embedded. \sa IsEmbeddedWindow.
*/
virtual bool ThreadCtor(Display *X11Display, Window X11Window, GLXContext OpenGLContext);
#endif
Display *x11display_;
bool ownx11display_;
#endif
/*!
Destructor-like function for the thread.
Will be called by EntryPoint after executing the thread body.
After ThreadDtor is called, thread_dtor_called_ is set to true.
ThreadDtor is also called in the destructor of the WindowThread but is protected by thread_dtor_called_ so it is not called twice.
In the case of the main window, ThreadDtor is called in the destructor of WindowThread.
*/
virtual bool ThreadDtor();
//! Causes the Main layout to be recomputed.
/*!
Causes the main layout to be recomputed. This will happen just before the next draw cycle.
*/
void QueueLayout();
//! Empty the queue of objects set for layout computation.
/*!
The queue was filled with calls to QueueObjectLayout.
*/
void RemoveQueuedLayout();
//! Compute the layout of this window thread.
/*!
Reconfigure the layout of this window. Start by setting the size of the layout to the size of this window.
ReconfigureLayout is executed following an event of type NUX_SIZE_CONFIGURATION or a call to QueueMainLayout.
\sa QueueMainLayout.
*/
void ReconfigureLayout();
/*!
Suspend Win32 Mouse and Keyboard inputs for this window thread and its
child thread that are also window (not SystemThread).
*/
void EnableMouseKeyboardInput();
/*!
Enable Win32 Mouse and Keyboard inputs for this window thread and its
child thread that are also window (not SystemThread).
*/
void DisableMouseKeyboardInput();
#if (!defined(NUX_OS_LINUX) && !defined(NUX_USE_GLIB_LOOP_ON_WINDOWS)) || defined(NUX_DISABLE_GLIB_LOOP)
//! Calls ProcessEvent in a loop
unsigned int ExecutionLoop();
#endif
/*!
It does the following:
* processes the input events
* resizes views
* draw the frame
This function is called when there is an input event, a gesture event or
when a timer has expired.
*/
unsigned int ProcessEvent(Event &event);
virtual ThreadState StartChildThread(AbstractThread *thread, bool Modal);
virtual void AddChildThread(AbstractThread *);
virtual void RemoveChildThread(AbstractThread *);
virtual void ChildHasFinished(AbstractThread *app);
virtual void TerminateChildThreads();
virtual ThreadState SuspendChildGraphics(WindowThread *app);
bool is_modal_window_;
bool wait_for_modal_window_;
WindowThread *modal_window_thread_;
private:
/*!
Internally called by ProcessEvent end ExecutionLopp after early return
check.
*/
unsigned int DoProcessEvent(Event &event);
void SetupMainLoop();
//! Execute the main loop of this thread.
/*!
Execute the main loop of this thread.
@return And exit code. 0 if there was no error.
*/
int MainLoop();
//! Custom callback to wake up the main thread and start the execution loop.
/*!
This function is executed when \i async_wake_up_signal_ expires. It doesn't do
anything when called, but the main thread will wake up and start the execution loop.
\sa async_wake_up_signal_
@param user_ptr Pointer to user data.
*/
void AsyncWakeUpCallback(void *user_ptr);
TimeOutSignal *async_wake_up_signal_;
TimerHandle async_wake_up_timer_handle_;
//! Informs the system of the start of a layout cycle.
/*!
This call merely sets a flag to true or false. This flag is used to decided if some actions should be
performed or not. Used by the system only.
*/
void StartLayoutCycle();
//! Informs the system of the end of a layout cycle.
/*!
This call merely sets a flag to true or false. This flag is used to decided if some actions should be
performed or not. Used by the system only.
*/
void StopLayoutCycle();
//! Execute the size computation cycle on objects.
/*
The objects whose size is to be computed are added to a list with a call to QueueObjectLayout.
Size computation is performed just before the rendering cycle.
\sa QueueObjectLayout
*/
void ComputeQueuedLayout();
GSource *_MasterClock;
WindowThread(const WindowThread &);
// Does not make sense for a singleton. This is a self assignment.
WindowThread& operator = (const WindowThread &);
// Declare operator address-of as private
WindowThread* operator & ();
bool _inside_main_loop;
bool _inside_timer_loop;
bool _pending_wake_up_timer;
//! This list contains the layout that need to be recomputed following the resizing of one of the sub element.
/*!
This list contains the layout that need to be recomputed following the resizing of one of the sub element.
*/
std::list<Area *> _queued_layout_list;
std::vector<Geometry> dirty_areas_;
typedef nux::ObjectWeakPtr<nux::BaseWindow> WeakBaseWindowPtr;
std::vector<WeakBaseWindowPtr> presentation_list_embedded_;
/*!
This list contains al lthe windows which will be presented on the next frame
(eg, after ForeignFrameEnded they are moved into m_presentation_list_embedded
and marked for presentation)
*/
std::vector<WeakBaseWindowPtr> presentation_list_embedded_next_frame_;
/*! Whether or not the current frame is "frozen" because the host WM has stopped tracking
damage events. If so we should put all presentation requests on the next frame instead
of this one
*/
bool foreign_frame_frozen_;
//! This variable is true while we are computing the layout the starting from the outmost layout(the Main Layout);
bool _inside_layout_cycle;
//! Set to true to schedule a compute cycle on the main layout.
bool queue_main_layout_;
#if !defined(NUX_MINIMAL)
std::list<Timeline*> *_Timelines;
#endif
bool first_pass_; //!< True when going through the ExecutionLoop for the first time.
unsigned int window_initial_width_; //!< Window height at startup.
unsigned int window_initial_height_; //!< Window width at startup.
std::string window_title_; //!< Window title.
bool _draw_requested_to_host_wm; //!< Flags signaling that a draw cycle has been requested to the host window manager.
Layout *main_layout_;
UXTheme *theme_;
BasePainter *painter_;
TimerHandler *timer_manager_;
//bool created_own_thread_; //!< If true, create a system thread and run the window in it.
GraphicsDisplay *graphics_display_;
WindowCompositor *window_compositor_;
bool m_WidgetInitialized;
WindowStyle window_style_;
/*!
True if the thread constructor has been called.
This is a form of per-WindowThread reentry protection.
*/
bool thread_ctor_called_;
/*!
True if the thread destructor has been called.
This is a form of per-WindowThread reentry protection.
*/
bool thread_dtor_called_;
/*!
True when running Ubuntu Unity+Nux has a plugin of Compiz.
*/
bool embedded_window_;
/*!
Record if there was a configuration nux_event(NUX_SIZE_CONFIGURATION) that requires a full redraw.
Used in the case where event processing and rendering are decoupled(with foreign windows).
*/
bool window_size_configuration_event_;
bool force_rendering_;
typedef struct _EventInspectorStorage
{
_EventInspectorStorage()
{
_function = 0;
_data = 0;
_uid = 0;
}
EventInspector _function;
void* _data;
int _uid;
} EventInspectorStorage;
//! Map of events inspectors
/*!
Events inspectors get to examine events before they are processed.
They may also stop an event from being processed if they return true.
*/
std::map<int, EventInspectorStorage> _event_inspectors_map; //!< map of events inspectors
typedef struct _ExternalFdData
{
int fd;
FdWatchCallback cb;
} ExternalFdData;
//! List of external sources. This might make more sense as a map,
// but providing a struct provides us much nicer GLib integration
std::list<ExternalFdData> _external_fds;
static bool FindDataByFd(const WindowThread::ExternalFdData &data, int fd);
#if (defined(NUX_OS_LINUX) || defined(NUX_USE_GLIB_LOOP_ON_WINDOWS)) && (!defined(NUX_DISABLE_GLIB_LOOP))
GMainLoop *main_loop_glib_;
GMainContext *main_loop_glib_context_;
friend gboolean nux_event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data);
friend gboolean nux_timeout_dispatch(gpointer user_data);
std::list<GSource*> child_window_list_;
std::unique_ptr<ExternalGLibSources> external_glib_sources_;
void InitGlibLoop();
void RunGlibLoop();
void StopGLibLoop();
void CleanupGlibLoop();
void AddFdToGLibLoop(int, gpointer, GSourceFunc);
void RemoveFdFromGLibLoop(gpointer);
bool AddChildWindowGlibLoop(WindowThread* wnd_thread);
static gboolean ExternalSourceCallback(gpointer user_data);
unsigned int AddGLibTimeout(unsigned int duration);
#else // no GLIB loop
Event input_event_;
GestureEvent gesture_event_;
Event *FetchNextEvent();
#endif
#ifdef NUX_GESTURES_SUPPORT
std::unique_ptr<GeisAdapter> geis_adapter_;
#endif
#if defined(NUX_OS_LINUX) && defined(USE_X11)
std::shared_ptr<XIMController> xim_controller_;
#endif
/*!
Add a timeout and return the timeout index.
This function is used internally by Nux.
@param timeout_delay Time laps before the timeout is fired.
@return An index for the timeout.
*/
unsigned int AddTimeout(unsigned int timeout_delay);
static const int MINIMUM_WINDOW_WIDTH; //!< Minimum width allowed for a window.
static const int MINIMUM_WINDOW_HEIGHT; //!< Minimum height allowed for a window.
friend class TimerHandler;
friend class BasePainter;
friend class SystemThread;
friend WindowThread *CreateGUIThread(const char *WindowTitle,
int width,
int height,
WindowThread *Parent,
ThreadUserInitFunc UserInitFunc,
void *InitData);
friend WindowThread *CreateNuxWindow(const char *WindowTitle,
int width,
int height,
ThreadUserInitFunc UserInitFunc,
void *InitData);
friend WindowThread *CreateNuxWindow(const char *window_title,
int width,
int height,
WindowStyle window_border_style,
AbstractThread *parent,
bool modal,
ThreadUserInitFunc user_init_func,
void *data);
friend WindowThread *CreateNuxWindowNewThread(const char *window_title,
int width,
int height,
WindowStyle window_border_style,
AbstractThread *parent,
bool modal,
ThreadUserInitFunc user_init_func,
void *data);
friend WindowThread *CreateWindowThread(WindowStyle WndStyle,
const char *WindowTitle,
int width,
int height,
WindowThread *Parent,
ThreadUserInitFunc UserInitFunc,
void *InitData);
friend WindowThread *CreateModalWindowThread(WindowStyle WndStyle,
const char *WindowTitle,
int width,
int height,
WindowThread *Parent,
ThreadUserInitFunc UserInitFunc,
void *InitData);
#if defined(NUX_OS_WINDOWS)
friend WindowThread *CreateFromForeignWindow(HWND WindowHandle, HDC WindowDCHandle, HGLRC OpenGLRenderingContext,
ThreadUserInitFunc UserInitFunc,
void *InitData);
#elif defined(USE_X11)
# ifdef NUX_OPENGLES_20
friend WindowThread *CreateFromForeignWindow (Window X11Window, EGLContext OpenGLContext,
ThreadUserInitFunc UserInitFunc,
void *InitData);
# else
friend WindowThread *CreateFromForeignWindow (Window X11Window, GLXContext OpenGLContext,
ThreadUserInitFunc UserInitFunc,
void *InitData);
# endif
#elif defined(NO_X11)
friend WindowThread *CreateFromForeignWindow (EGLDisplay disp, EGLContext OpenGLContext,
ThreadUserInitFunc UserInitFunc,
void *InitData);
#endif
friend SystemThread *CreateSystemThread(AbstractThread *Parent, ThreadUserInitFunc UserInitFunc, void *InitData);
};
}
#endif // WINDOWTHREAD_H
|