~nux-team/nux/nux.attempt-to-fix-widgets-new

« back to all changes in this revision

Viewing changes to Nux/MainLoopGLib.cpp

  • Committer: Eleni Maria Stea
  • Date: 2012-12-13 15:17:26 UTC
  • mfrom: (700.2.40 trunk)
  • Revision ID: elene.mst@gmail.com-20121213151726-0lve6hjs74nddksb
local merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    unsigned int return_code = 1;
50
50
 
51
51
    dd->window_thread->_inside_timer_loop = true;
52
 
    repeat = GetTimer().ExecTimerHandler(dd->id)? true : false;
 
52
    repeat = GetTimer().ExecTimerHandler(dd->id);
53
53
    dd->window_thread->_inside_timer_loop = false;
54
54
 
55
55
    if (dd->window_thread->IsEmbeddedWindow())
80
80
 
81
81
    gboolean retval;
82
82
    *timeout = -1;
83
 
  #if defined(NUX_OS_WINDOWS)
 
83
#if defined(NUX_OS_WINDOWS)
84
84
    MSG msg;
85
85
    retval = PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE) ? TRUE : FALSE;
86
 
  #elif defined(NUX_OS_LINUX)
 
86
#elif defined(NUX_OS_LINUX)
 
87
# if defined(USE_X11)
87
88
    retval = GetGraphicsDisplay()->HasXPendingEvent() ? TRUE : FALSE;
88
 
  #else
89
 
  #error Not implemented.
90
 
  #endif
 
89
# else
 
90
    retval = false;
 
91
# endif
 
92
#else
 
93
# error Not implemented.
 
94
#endif
91
95
 
92
96
    nux_glib_threads_unlock();
93
97
    return retval;
97
101
  {
98
102
    nux_glib_threads_lock();
99
103
 
100
 
    gboolean retval;
 
104
    gboolean retval = FALSE;
101
105
    NuxEventSource *event_source = (NuxEventSource*) source;
102
106
 
103
107
    if ((event_source->event_poll_fd.revents & G_IO_IN))
104
108
    {
105
 
  #if defined(NUX_OS_WINDOWS)
 
109
#if defined(NUX_OS_WINDOWS)
106
110
      MSG msg;
107
111
      retval = PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE) ? TRUE : FALSE;
108
 
  #elif defined(NUX_OS_LINUX)
 
112
#elif defined(NUX_OS_LINUX)
 
113
#  if defined(USE_X11)
109
114
      retval = GetGraphicsDisplay()->HasXPendingEvent() ? TRUE : FALSE;
110
 
  #else
111
 
  #error Not implemented.
112
 
  #endif
113
 
    }
114
 
    else
115
 
    {
116
 
      retval = FALSE;
 
115
#  endif
 
116
#else
 
117
#  error Not implemented.
 
118
#endif
117
119
    }
118
120
 
119
121
    nux_glib_threads_unlock();
166
168
 
167
169
  static gboolean nux_timeline_dispatch(GSource *source, GSourceFunc /* callback */, gpointer user_data)
168
170
  {
 
171
#if !defined(NUX_MINIMAL)
169
172
    bool has_timelines_left = false;
170
173
    nux_glib_threads_lock();
171
174
    gint64 micro_secs = g_source_get_time(source);
182
185
    }
183
186
 
184
187
    nux_glib_threads_unlock();
 
188
#endif
185
189
    return TRUE;
186
190
  }
187
191
 
248
252
#if defined(NUX_OS_WINDOWS)
249
253
    event_source->event_poll_fd.fd = G_WIN32_MSG_HANDLE;
250
254
#elif defined(NUX_OS_LINUX)
 
255
#  if defined(USE_X11)
251
256
    event_source->event_poll_fd.fd = ConnectionNumber(GetGraphicsDisplay().GetX11Display());
 
257
#  endif
252
258
#else
253
 
#error Not implemented.
 
259
#  error Not implemented.
254
260
#endif
255
261
 
256
262
    event_source->event_poll_fd.events = G_IO_IN;
278
284
        sigc::mem_fun(this, &WindowThread::ProcessGestureEvent));
279
285
#endif
280
286
 
281
 
    if (_Timelines->size() > 0)
 
287
#if !defined(NUX_MINIMAL)
 
288
    if (!_Timelines->empty())
282
289
      StartMasterClock();
 
290
#endif
283
291
 
284
292
    if (!IsEmbeddedWindow())
285
293
    {
386
394
      else if (main_loop_glib_context_ != 0)
387
395
        g_source_attach(_MasterClock, main_loop_glib_context_);
388
396
 
389
 
 
 
397
#if !defined(NUX_MINIMAL)
390
398
      gint64 micro_secs = g_source_get_time(_MasterClock);
391
399
      last_timeline_frame_time_sec_ = micro_secs / 1000000;
392
400
      last_timeline_frame_time_usec_ = micro_secs % 1000000;
 
401
#endif
393
402
    }
394
403
  }
395
404