Qt 4.8
Classes | Macros | Typedefs | Functions | Variables
qapplication_qws.cpp File Reference
#include "qglobal.h"
#include "qlibrary.h"
#include "qcursor.h"
#include "qapplication.h"
#include "private/qapplication_p.h"
#include "qwidget.h"
#include "qbitarray.h"
#include "qpainter.h"
#include "qpixmapcache.h"
#include "qdatetime.h"
#include "qtextcodec.h"
#include "qdatastream.h"
#include "qbuffer.h"
#include "qsocketnotifier.h"
#include "qsessionmanager.h"
#include "qclipboard.h"
#include "qbitmap.h"
#include "qwssocket_qws.h"
#include "qtransportauth_qws.h"
#include "private/qtransportauth_qws_p.h"
#include "qwsevent_qws.h"
#include "private/qwscommand_qws_p.h"
#include "qwsproperty_qws.h"
#include "qscreen_qws.h"
#include "qscreenproxy_qws.h"
#include "qcopchannel_qws.h"
#include "private/qlock_p.h"
#include "private/qwslock_p.h"
#include "qwsmanager_qws.h"
#include "qwindowsystem_qws.h"
#include "private/qwindowsystem_p.h"
#include "qdecorationfactory_qws.h"
#include "qwsdisplay_qws.h"
#include "private/qwsdisplay_qws_p.h"
#include "private/qwsinputcontext_p.h"
#include "qfile.h"
#include "qhash.h"
#include "qdesktopwidget.h"
#include "qcolormap.h"
#include "private/qcursor_p.h"
#include "qsettings.h"
#include "qdebug.h"
#include "qeventdispatcher_qws_p.h"
#include "qeventdispatcher_glib_qws_p.h"
#include "private/qwidget_p.h"
#include "private/qbackingstore_p.h"
#include "private/qwindowsurface_qws_p.h"
#include "private/qfont_p.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <qvfbhdr.h>

Go to the source code of this file.

Classes

class  QETWidget
 

Macros

#define AllValues   0x000F
 
#define HeightValue   0x0008
 
#define NoValue   0x0000
 
#define WidthValue   0x0004
 
#define XNegative   0x0010
 
#define XValue   0x0001
 
#define YNegative   0x0020
 
#define YValue   0x0002
 

Typedefs

typedef void(* TransformFunc) (QScreen *, int)
 

Functions

static TransformFunc getTransformationFunction ()
 
static void init_display ()
 
static int parseGeometry (const char *string, int *x, int *y, int *width, int *height)
 
void Q_GUI_EXPORT qt_app_reinit (const QString &newAppName)
 
void qt_cleanup ()
 
void qt_client_enqueue (const QWSEvent *event)
 
void qt_directpainter_embedevent (QDirectPainter *dp, const QWSEmbedEvent *e)
 
void qt_directpainter_region (QDirectPainter *dp, const QRegion &alloc, int type)
 
QList< QWSCommand * > * qt_get_server_queue ()
 
void qt_init (QApplicationPrivate *priv, int type)
 
void qt_init_display ()
 
void qt_server_enqueue (const QWSCommand *command)
 
static void qt_set_qws_resources ()
 
static bool qt_try_modal (QWidget *, QWSEvent *)
 
QString qws_dataDir ()
 
Q_GUI_EXPORT QString qws_qtePipeFilename ()
 
void qws_setScreenTransformation (QScreen *, int)
 
static bool read_bool_env_var (const char *var, bool defaultvalue)
 
static int read_int_env_var (const char *var, int defaultvalue)
 
static int ReadInteger (char *string, char **NextString)
 
static void setMaxWindowRect (const QRect &rect)
 
static void setScreenTransformation (int screenNo, int transformation)
 

Variables

static const int AnyButton = (Qt::LeftButton | Qt::MidButton | Qt::RightButton)
 
static bool app_do_modal = false
 
static const char * appBGCol = 0
 
static const char * appBTNCol = 0
 
static const char * appFGCol = 0
 
static const char * appFont = 0
 
static QString appName
 
static QList< QWSEvent * > incoming
 
static int mouse_double_click_distance = 5
 
static int mouse_state = 0
 
static int mouse_x_root = -1
 
static int mouse_y_root = -1
 
static int mouseButtonPressed = 0
 
static int mouseButtonPressTime = 0
 
static QPointer< QWidget > * mouseInWidget = 0
 
static short mouseXPos
 
static short mouseYPos
 
static const char * mwGeometry = 0
 
static const char * mwTitle = 0
 
static int openPopupCount = 0
 
static QList< QWSCommand * > outgoing
 
static QWidgetpopupButtonFocus = 0
 
static bool popupCloseDownMode = false
 
static bool popupGrabOk
 
static QWidgetpopupOfPopupButtonFocus = 0
 
QApplication::Type qt_appType
 
QWidgetqt_button_down = 0
 
QDesktopWidgetqt_desktopWidget
 
Q_GUI_EXPORT QWSDisplayqt_fbdpy = 0
 
WId qt_last_cursor = 0xffffffff
 
QPointer< QWidgetqt_last_mouse_receiver = 0
 
int * qt_last_x = 0
 
int * qt_last_y = 0
 
QWidgetListqt_modal_stack
 
QWidgetqt_mouseGrb = 0
 
QWidgetqt_pressGrab = 0
 
int qt_servershmid = -1
 
bool qws_accel = true
 
Q_GUI_EXPORT int qws_client_id = 0
 
static int qws_connection_timeout = 5
 
Q_GUI_EXPORT int qws_display_id = 0
 
QByteArray qws_display_spec (":0")
 
bool qws_overrideCursor = false
 
bool qws_savefonts = false
 
bool qws_screen_is_interlaced =false
 
bool qws_shared_memory = false
 
static bool qws_single_process
 
bool qws_sw_cursor = true
 
const int qwsSharedRamSize = 1 * 1024
 
static bool sm_blockUserInput = false
 

Macro Definition Documentation

◆ AllValues

#define AllValues   0x000F

Definition at line 2392 of file qapplication_qws.cpp.

◆ HeightValue

#define HeightValue   0x0008

◆ NoValue

#define NoValue   0x0000

Definition at line 2387 of file qapplication_qws.cpp.

Referenced by parseGeometry().

◆ WidthValue

#define WidthValue   0x0004

◆ XNegative

#define XNegative   0x0010

◆ XValue

#define XValue   0x0001

◆ YNegative

#define YNegative   0x0020

◆ YValue

#define YValue   0x0002

Typedef Documentation

◆ TransformFunc

typedef void(* TransformFunc) (QScreen *, int)

Definition at line 270 of file qapplication_qws.cpp.

Function Documentation

◆ getTransformationFunction()

static TransformFunc getTransformationFunction ( )
static

Definition at line 274 of file qapplication_qws.cpp.

Referenced by QApplicationPrivate::setScreenTransformation().

275 {
276  static TransformFunc func = 0;
277 
278  if (!func) {
279 #ifdef QT_NO_QWS_TRANSFORMED
280 # ifndef QT_NO_LIBRARY
281  // symbol is not built into the library, search for the plugin
282  const QStringList paths = QApplication::libraryPaths();
283  foreach (const QString &path, paths) {
284  const QString file = path + QLatin1String("/gfxdrivers/libqgfxtransformed");
285  func = (TransformFunc)QLibrary::resolve(file,
286  "qws_setScreenTransformation");
287  if (func)
288  break;
289  }
290 # endif
291 #else
293 #endif
294  if (!func)
295  func = (TransformFunc)-1;
296  }
297 
298  if (func == (TransformFunc)-1)
299  return 0;
300 
301  return func;
302 }
void qws_setScreenTransformation(QScreen *, int)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void * resolve(const char *symbol)
Returns the address of the exported symbol symbol.
Definition: qlibrary.cpp:1155
The QString class provides a Unicode character string.
Definition: qstring.h:83
void(* TransformFunc)(QScreen *, int)
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static QStringList libraryPaths()
Returns a list of paths that the application will search when dynamically loading libraries...

◆ init_display()

static void init_display ( )
static

Definition at line 2126 of file qapplication_qws.cpp.

Referenced by qt_init(), and qt_init_display().

2127 {
2128  if (qt_fbdpy) return; // workaround server==client case
2129 
2130  // Connect to FB server
2131  qt_fbdpy = new QWSDisplay();
2132 
2133  // Get display parameters
2134  // Set paintdevice parameters
2135  // XXX initial info sent from server
2136  // Misc. initialization
2137 
2140 #ifndef QT_NO_CURSOR
2142 #endif
2143 
2144  qApp->setObjectName(appName);
2145 
2147 #ifdef QT_NO_FREETYPE
2148  QFont f = QFont(QLatin1String("helvetica"), 10);
2149 #else
2150  QFont f = QFont(QLatin1String("DejaVu Sans"), 12);
2151 #endif
2153  }
2155 }
The QWSDisplay class provides a display for QWS; it is an internal class.
static void qt_set_qws_resources()
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QString appName
static QFont * sys_font
static void setSystemFont(const QFont &font)
static void initialize()
Internal function that initializes the font system.
Definition: qfont_mac.cpp:131
#define qApp
Q_GUI_EXPORT QWSDisplay * qt_fbdpy
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
static void initialize()
static void initialize()
Definition: qcursor.cpp:417

◆ parseGeometry()

static int parseGeometry ( const char *  string,
int *  x,
int *  y,
int *  width,
int *  height 
)
static

Definition at line 2461 of file qapplication_qws.cpp.

2463 {
2464  int mask = NoValue;
2465  register char *strind;
2466  unsigned int tempWidth=0, tempHeight=0;
2467  int tempX=0, tempY=0;
2468  char *nextCharacter;
2469 
2470  if (!string || (*string == '\0')) return mask;
2471  if (*string == '=')
2472  string++; /* ignore possible '=' at beg of geometry spec */
2473 
2474  strind = const_cast<char *>(string);
2475  if (*strind != '+' && *strind != '-' && *strind != 'x') {
2476  tempWidth = ReadInteger(strind, &nextCharacter);
2477  if (strind == nextCharacter)
2478  return 0;
2479  strind = nextCharacter;
2480  mask |= WidthValue;
2481  }
2482 
2483  if (*strind == 'x' || *strind == 'X') {
2484  strind++;
2485  tempHeight = ReadInteger(strind, &nextCharacter);
2486  if (strind == nextCharacter)
2487  return 0;
2488  strind = nextCharacter;
2489  mask |= HeightValue;
2490  }
2491 
2492  if ((*strind == '+') || (*strind == '-')) {
2493  if (*strind == '-') {
2494  strind++;
2495  tempX = -ReadInteger(strind, &nextCharacter);
2496  if (strind == nextCharacter)
2497  return 0;
2498  strind = nextCharacter;
2499  mask |= XNegative;
2500 
2501  }
2502  else
2503  { strind++;
2504  tempX = ReadInteger(strind, &nextCharacter);
2505  if (strind == nextCharacter)
2506  return 0;
2507  strind = nextCharacter;
2508  }
2509  mask |= XValue;
2510  if ((*strind == '+') || (*strind == '-')) {
2511  if (*strind == '-') {
2512  strind++;
2513  tempY = -ReadInteger(strind, &nextCharacter);
2514  if (strind == nextCharacter)
2515  return 0;
2516  strind = nextCharacter;
2517  mask |= YNegative;
2518 
2519  }
2520  else
2521  {
2522  strind++;
2523  tempY = ReadInteger(strind, &nextCharacter);
2524  if (strind == nextCharacter)
2525  return 0;
2526  strind = nextCharacter;
2527  }
2528  mask |= YValue;
2529  }
2530  }
2531 
2532  /* If strind isn't at the end of the string then it's an invalid
2533  geometry specification. */
2534 
2535  if (*strind != '\0') return 0;
2536 
2537  if (mask & XValue)
2538  *x = tempX;
2539  if (mask & YValue)
2540  *y = tempY;
2541  if (mask & WidthValue)
2542  *width = tempWidth;
2543  if (mask & HeightValue)
2544  *height = tempHeight;
2545  return mask;
2546 }
#define YValue
#define XValue
static int ReadInteger(char *string, char **NextString)
#define YNegative
#define WidthValue
#define NoValue
#define HeightValue
#define XNegative

◆ qt_app_reinit()

void Q_GUI_EXPORT qt_app_reinit ( const QString newAppName)

Definition at line 690 of file qapplication_qws.cpp.

Referenced by QWSDisplay::instance().

691 {
692  qt_fbdpy->d->reinit( newAppName );
693 }
void reinit(const QString &newAppName)
Q_GUI_EXPORT QWSDisplay * qt_fbdpy

◆ qt_cleanup()

void qt_cleanup ( )

Definition at line 2336 of file qapplication_qws.cpp.

2337 {
2339 #ifndef QT_NO_CURSOR
2341 #endif
2342  QFont::cleanup();
2344 
2345  if (qws_single_process) {
2347  }
2348 
2350  outgoing.clear();
2352  incoming.clear();
2353 
2354  if (qt_is_gui_used) {
2355  delete qt_fbdpy;
2356  }
2357  qt_fbdpy = 0;
2358 
2359 #ifndef QT_NO_QWS_MANAGER
2360  delete qws_decoration;
2361  qws_decoration = 0;
2362 #endif
2363 
2364  delete mouseInWidget;
2365  mouseInWidget = 0;
2366 
2367 #if !defined(QT_NO_IM)
2370 #endif
2371 }
static void cleanup()
Internal function that cleans up the font system.
Definition: qfont_mac.cpp:93
static bool qws_single_process
static void closedown()
static void clear()
Removes all pixmaps from the cache.
void clear()
Removes all items from the list.
Definition: qlist.h:764
Q_GUI_EXPORT QWSDisplay * qt_fbdpy
static QList< QWSEvent * > incoming
static QInputContext * inputContext
static QList< QWSCommand * > outgoing
static void cleanup()
Definition: qcursor.cpp:402
bool qt_is_gui_used
static QPointer< QWidget > * mouseInWidget
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
Definition: qalgorithms.h:319
static void cleanup()

◆ qt_client_enqueue()

void qt_client_enqueue ( const QWSEvent event)

Definition at line 474 of file qapplication_qws.cpp.

Referenced by QWSClient::sendEvent(), and QWSScreenSaver::~QWSScreenSaver().

475 {
476  QWSEvent *copy = QWSEvent::factory(event->type);
477  copy->copyFrom(event);
478  incoming.append(copy);
479 }
void copyFrom(const QWSProtocolItem *item)
The QWSEvent class encapsulates an event in Qt for Embedded Linux.
Definition: qwsevent_qws.h:59
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
static QList< QWSEvent * > incoming
static QWSEvent * factory(int type)

◆ qt_directpainter_embedevent()

void qt_directpainter_embedevent ( QDirectPainter dp,
const QWSEmbedEvent e 
)

Definition at line 244 of file qdirectpainter_qws.cpp.

Referenced by QApplication::qwsProcessEvent(), and QDirectPainter::region().

245 {
246  if (event->type | QWSEmbedEvent::Region) {
247  QScreen *screen = dp->d_func()->surface->screen();
248  QRegion r = event->region;
249  if (screen->isTransformed()) {
250  const QSize screenSize(screen->width(), screen->height());
251  r = screen->mapToDevice(r, screenSize);
252  }
253  dp->setRegion(r);
254  }
255 }
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
EventRef event
virtual QSize mapToDevice(const QSize &) const
Maps the given size from the coordinate space used by the application to the framebuffer coordinate s...
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
void setRegion(const QRegion &)
Requests to reserve the given region of the framebuffer.
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ qt_directpainter_region()

void qt_directpainter_region ( QDirectPainter dp,
const QRegion alloc,
int  type 
)

Definition at line 223 of file qdirectpainter_qws.cpp.

Referenced by QApplication::qwsProcessEvent(), and QDirectPainter::region().

224 {
225  QDirectPainterPrivate *d = dp->d_func();
226 
227  QRegion r = alloc;
228  QScreen *screen = d->surface->screen();
229  if (screen->isTransformed()) {
230  const QSize screenSize(screen->width(), screen->height());
231  r = screen->mapToDevice(r, screenSize);
232  }
234  d->surface->setClipRegion(alloc);
235  d->seenRegion = true;
237  if (!d->surface->flushingRegionEvents) // recursion guard
238  dp->regionChanged(r);
239  }
240  }
241 }
QWSDirectPainterSurface * surface
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
virtual QSize mapToDevice(const QSize &) const
Maps the given size from the coordinate space used by the application to the framebuffer coordinate s...
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
virtual void regionChanged(const QRegion &exposedRegion)
This function is called when the allocated region changes.
void setClipRegion(const QRegion &)
Sets the region currently visible on the screen to be the given clip region.
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static QDirectPainter * staticPainter

◆ qt_get_server_queue()

QList<QWSCommand*>* qt_get_server_queue ( )

Definition at line 481 of file qapplication_qws.cpp.

Referenced by QEventDispatcherQWS::processEvents(), qwsEventSourceCheck(), qwsEventSourcePrepare(), QWSClient::readMoreCommand(), and QWSScreenSaver::~QWSScreenSaver().

482 {
483  return &outgoing;
484 }
static QList< QWSCommand * > outgoing

◆ qt_init()

void qt_init ( QApplicationPrivate priv,
int  type 
)

Definition at line 2180 of file qapplication_qws.cpp.

2181 {
2182 #ifdef QT_NO_QWS_MULTIPROCESS
2185 #endif
2187  qt_is_gui_used = false; //we'll turn it on in a second
2188  qws_sw_cursor = read_bool_env_var("QWS_SW_CURSOR",qws_sw_cursor);
2189  qws_screen_is_interlaced = read_bool_env_var("QWS_INTERLACE",false);
2190 
2191  const char *display = ::getenv("QWS_DISPLAY");
2192 
2193 #ifdef QT_QWS_DEFAULT_DRIVER_NAME
2194  if (!display) display = QT_QWS_DEFAULT_DRIVER_NAME;
2195 #endif
2196 
2197  if (display)
2198  qws_display_spec = display; // since we setenv later!
2199 
2200  //qws_savefonts = qgetenv("QWS_SAVEFONTS") != 0;
2201  //qws_shared_memory = qgetenv("QWS_NOSHARED") == 0;
2202 
2203  mouse_double_click_distance = read_int_env_var("QWS_DBLCLICK_DISTANCE", 5);
2204 
2205  priv->inputContext = 0;
2206 
2207  int flags = 0;
2208  char *p;
2209  int argc = priv->argc;
2210  char **argv = priv->argv;
2211  int j;
2212 
2213  // Set application name
2214 
2215  if (argv && *argv) { //apparently, we allow people to pass 0 on the other platforms
2216  p = strrchr(argv[0], '/');
2217  appName = QString::fromLocal8Bit(p ? p + 1 : argv[0]);
2218  }
2219 
2220  // Get command line params
2221 
2222  j = argc ? 1 : 0;
2223  QString decoration;
2224  for (int i=1; i<argc; i++) {
2225  if (argv[i] && *argv[i] != '-') {
2226  argv[j++] = argv[i];
2227  continue;
2228  }
2229  QByteArray arg = argv[i];
2230  if (arg == "-fn" || arg == "-font") {
2231  if (++i < argc)
2232  appFont = argv[i];
2233  } else if (arg == "-bg" || arg == "-background") {
2234  if (++i < argc)
2235  appBGCol = argv[i];
2236  } else if (arg == "-btn" || arg == "-button") {
2237  if (++i < argc)
2238  appBTNCol = argv[i];
2239  } else if (arg == "-fg" || arg == "-foreground") {
2240  if (++i < argc)
2241  appFGCol = argv[i];
2242  } else if (arg == "-name") {
2243  if (++i < argc)
2244  appName = QString::fromLocal8Bit(argv[i]);
2245  } else if (arg == "-title") {
2246  if (++i < argc)
2247  mwTitle = argv[i];
2248  } else if (arg == "-geometry") {
2249  if (++i < argc)
2250  mwGeometry = argv[i];
2251  } else if (arg == "-shared") {
2252  qws_shared_memory = true;
2253  } else if (arg == "-noshared") {
2254  qws_shared_memory = false;
2255  } else if (arg == "-savefonts") {
2256  qws_savefonts = true;
2257  } else if (arg == "-nosavefonts") {
2258  qws_savefonts = false;
2259  } else if (arg == "-swcursor") {
2260  qws_sw_cursor = true;
2261  } else if (arg == "-noswcursor") {
2262  qws_sw_cursor = false;
2263  } else if (arg == "-keyboard") {
2264  flags &= ~QWSServer::DisableKeyboard;
2265  } else if (arg == "-nokeyboard") {
2266  flags |= QWSServer::DisableKeyboard;
2267  } else if (arg == "-mouse") {
2268  flags &= ~QWSServer::DisableMouse;
2269  } else if (arg == "-nomouse") {
2270  flags |= QWSServer::DisableMouse;
2271  } else if (arg == "-qws") {
2273  } else if (arg == "-interlaced") {
2274  qws_screen_is_interlaced = true;
2275  } else if (arg == "-display") {
2276  if (++i < argc)
2277  qws_display_spec = argv[i];
2278  } else if (arg == "-decoration") {
2279  if (++i < argc)
2280  decoration = QString::fromLocal8Bit(argv[i]);
2281  } else {
2282  argv[j++] = argv[i];
2283  }
2284  }
2285  if(j < priv->argc) {
2286  priv->argv[j] = 0;
2287  priv->argc = j;
2288  }
2289 
2291 
2293  QRegExp regexp(QLatin1String(":(\\d+)$"));
2294  if (regexp.lastIndexIn(disp) != -1) {
2295  const QString capture = regexp.cap(1);
2296  bool ok = false;
2297  int id = capture.toInt(&ok);
2298  if (ok)
2299  qws_display_id = id;
2300  }
2301 
2302  if (type == QApplication::GuiServer) {
2304  qws_single_process = true;
2305  QWSServer::startup(flags);
2306  if (!display) // if not already set
2307  qputenv("QWS_DISPLAY", qws_display_spec);
2308  }
2309 
2310  if(qt_is_gui_used) {
2311  init_display();
2312 #ifndef QT_NO_QWS_MANAGER
2313  if (decoration.isEmpty() && !qws_decoration) {
2315  if (!keys.isEmpty())
2316  decoration = keys.first();
2317  }
2318  if (!decoration.isEmpty())
2319  qws_decoration = QApplication::qwsSetDecoration(decoration);
2320 #endif // QT_NO_QWS_MANAGER
2321 #ifndef QT_NO_QWS_INPUTMETHODS
2322  qApp->setInputContext(new QWSInputContext(qApp));
2323 #endif
2324  }
2325 
2326 /*### convert interlace style
2327  if (qws_screen_is_interlaced)
2328  QApplication::setStyle(new QInterlaceStyle);
2329 */
2330 }
bool qws_screen_is_interlaced
static const char * appBGCol
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
Definition: qstring.cpp:4245
int type
Definition: qmetatype.cpp:239
QApplication::Type qt_appType
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
static bool read_bool_env_var(const char *var, bool defaultvalue)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
bool qws_shared_memory
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QString appName
static bool qws_single_process
static const char * mwTitle
The QString class provides a Unicode character string.
Definition: qstring.h:83
QStringList keys
static const char * appFGCol
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
static QStringList keys()
Returns the list of valid keys, i.e., the available decorations.
bool qws_sw_cursor
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
static void init_display()
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define qApp
static const char * mwGeometry
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QByteArray qws_display_spec(":0")
bool qws_savefonts
static void startup(int flags)
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
static int read_int_env_var(const char *var, int defaultvalue)
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
static QInputContext * inputContext
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
Q_GUI_EXPORT int qws_display_id
static int mouse_double_click_distance
Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray &value)
static const char * appBTNCol
static const char * appFont
bool qt_is_gui_used
static QPointer< QWidget > * mouseInWidget

◆ qt_init_display()

void qt_init_display ( )

Definition at line 2157 of file qapplication_qws.cpp.

Referenced by QWSServerPrivate::openDisplay(), and QWSScreenSaver::~QWSScreenSaver().

2158 {
2159  qt_is_gui_used = true;
2160  qws_single_process = true;
2161  init_display();
2162 }
static bool qws_single_process
static void init_display()
bool qt_is_gui_used

◆ qt_server_enqueue()

void qt_server_enqueue ( const QWSCommand command)

Definition at line 486 of file qapplication_qws.cpp.

Referenced by QWSDisplay::Data::init(), QWSDisplay::Data::sendCommand(), and QWSDisplay::Data::sendSynchronousCommand().

487 {
488  QWSCommand *copy = QWSCommand::factory(command->type);
489  QT_TRY {
490  copy->copyFrom(command);
491  outgoing.append(copy);
492  } QT_CATCH(...) {
493  delete copy;
494  QT_RETHROW;
495  }
496 }
static QWSCommand * factory(int type)
void copyFrom(const QWSProtocolItem *item)
#define QT_RETHROW
Definition: qglobal.h:1539
#define QT_CATCH(A)
Definition: qglobal.h:1537
static QList< QWSCommand * > outgoing
#define QT_TRY
Definition: qglobal.h:1536

◆ qt_set_qws_resources()

static void qt_set_qws_resources ( )
static

Definition at line 1902 of file qapplication_qws.cpp.

Referenced by init_display().

1904 {
1906  QApplicationPrivate::qws_apply_settings();
1907 
1908  if (appFont)
1910 
1911  if (appBGCol || appBTNCol || appFGCol) {
1912  (void) QApplication::style(); // trigger creation of application style and system palettes
1913  QColor btn;
1914  QColor bg;
1915  QColor fg;
1916  if (appBGCol)
1917  bg = QColor(appBGCol);
1918  else
1920  if (appFGCol)
1921  fg = QColor(appFGCol);
1922  else
1924  if (appBTNCol)
1925  btn = QColor(appBTNCol);
1926  else
1928 
1929  int h,s,v;
1930  fg.getHsv(&h,&s,&v);
1931  QColor base = Qt::white;
1932  bool bright_mode = false;
1933  if (v >= 255 - 50) {
1934  base = btn.darker(150);
1935  bright_mode = true;
1936  }
1937 
1938  QPalette pal(fg, btn, btn.lighter(), btn.darker(), btn.darker(150), fg, Qt::white, base, bg);
1939  if (bright_mode) {
1941  pal.setColor(QPalette::Highlight, Qt::white);
1942  } else {
1943  pal.setColor(QPalette::HighlightedText, Qt::white);
1944  pal.setColor(QPalette::Highlight, Qt::darkBlue);
1945  }
1946  QColor disabled((fg.red() + btn.red()) / 2,
1947  (fg.green() + btn.green())/ 2,
1948  (fg.blue() + btn.blue()) / 2);
1949  pal.setColorGroup(QPalette::Disabled, disabled, btn, btn.lighter(125),
1950  btn.darker(), btn.darker(150), disabled, Qt::white, Qt::white, bg);
1951  if (bright_mode) {
1952  pal.setColor(QPalette::Disabled, QPalette::HighlightedText, base);
1953  pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::white);
1954  } else {
1955  pal.setColor(QPalette::Disabled, QPalette::HighlightedText, Qt::white);
1957  }
1959 
1960  }
1961 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
static const char * appBGCol
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
Definition: qstring.cpp:4245
#define disabled
static QStyle * style()
Returns the application&#39;s style object.
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Definition: qpalette.h:107
static const uint base
Definition: qurl.cpp:268
static const char * appFGCol
void getHsv(int *h, int *s, int *v, int *a=0) const
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (tra...
Definition: qcolor.cpp:679
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
Definition: qcolor.h:301
static QPalette * sys_pal
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
Definition: qpalette.h:201
static bool desktopSettingsAware()
Returns true if Qt is set to use the system&#39;s standard colors, fonts, etc.
static void setSystemPalette(const QPalette &pal)
static const char * appBTNCol
static const char * appFont
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
Definition: qcolor.h:298
static void setFont(const QFont &, const char *className=0)
Changes the default application font to font.
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ qt_try_modal()

static bool qt_try_modal ( QWidget widget,
QWSEvent event 
)
static

Definition at line 3172 of file qapplication_qws.cpp.

Referenced by QApplication::qwsProcessEvent(), and QScreen::setTransformation().

3173 {
3174  QWidget * top = 0;
3175 
3176  if (QApplicationPrivate::tryModalHelper(widget, &top))
3177  return true;
3178 
3179  bool block_event = false;
3180  bool paint_event = false;
3181 
3182  switch (event->type) {
3183  case QWSEvent::Focus:
3184  if (!static_cast<QWSFocusEvent*>(event)->simpleData.get_focus)
3185  break;
3186  // drop through
3187  case QWSEvent::Mouse: // disallow mouse/key events
3188  case QWSEvent::Key:
3189  block_event = true;
3190  break;
3191  }
3192 
3193  if (top->parentWidget() == 0 && (block_event || paint_event))
3194  top->raise();
3195 
3196  return !block_event;
3197 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void raise()
Raises this widget to the top of the parent widget&#39;s stack.
Definition: qwidget.cpp:11901
static bool tryModalHelper(QWidget *widget, QWidget **rettop=0)

◆ qws_dataDir()

QString qws_dataDir ( )

Definition at line 181 of file qapplication_qws.cpp.

Referenced by qws_fontCacheDir(), and qws_qtePipeFilename().

182 {
183  static QString result;
184  if (!result.isEmpty())
185  return result;
186  result = QT_VFB_DATADIR(qws_display_id);
187  QByteArray dataDir = result.toLocal8Bit();
188 
189 #if defined(Q_OS_INTEGRITY)
190  /* ensure filesystem is ready before starting requests */
191  WaitForFileSystemInitialization();
192 #endif
193 
194  if (QT_MKDIR(dataDir, 0700)) {
195  if (errno != EEXIST) {
196  qFatal("Cannot create Qt for Embedded Linux data directory: %s", dataDir.constData());
197  }
198  }
199 
200  QT_STATBUF buf;
201  if (QT_LSTAT(dataDir, &buf))
202  qFatal("stat failed for Qt for Embedded Linux data directory: %s", dataDir.constData());
203 
204  if (!S_ISDIR(buf.st_mode))
205  qFatal("%s is not a directory", dataDir.constData());
206 
207 #if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) && !defined(Q_OS_QNX)
208  if (buf.st_uid != getuid())
209  qFatal("Qt for Embedded Linux data directory is not owned by user %d: %s", getuid(), dataDir.constData());
210 
211  if ((buf.st_mode & 0677) != 0600)
212  qFatal("Qt for Embedded Linux data directory has incorrect permissions: %s", dataDir.constData());
213 #endif
214 
215  result.append(QLatin1Char('/'));
216  return result;
217 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define QT_VFB_DATADIR(DISPLAY)
Definition: qvfbhdr.h:74
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4049
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
Q_CORE_EXPORT void qFatal(const char *,...)
QString & append(QChar c)
Definition: qstring.cpp:1777
#define S_ISDIR(x)
Definition: qzip.cpp:63
Q_GUI_EXPORT int qws_display_id
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
int errno

◆ qws_qtePipeFilename()

Q_GUI_EXPORT QString qws_qtePipeFilename ( )

◆ qws_setScreenTransformation()

void qws_setScreenTransformation ( QScreen ,
int   
)

Definition at line 97 of file qscreentransformed_qws.cpp.

Referenced by getTransformationFunction().

98 {
99  QTransformedScreen *tscreen = static_cast<QTransformedScreen*>(that);
101 }
Transformation
This enum describes the various rotations a transformed screen can have.
void setTransformation(Transformation t)
Rotates this screen object according to the specified transformation.
The QTransformedScreen class implements a screen driver for a transformed screen. ...

◆ read_bool_env_var()

static bool read_bool_env_var ( const char *  var,
bool  defaultvalue 
)
static

Definition at line 2164 of file qapplication_qws.cpp.

Referenced by qt_init().

2165 {
2166  // returns true if env variable is set to non-zero
2167  // returns false if env var is set to zero
2168  // returns defaultvalue if env var not set
2169  char *x = ::getenv(var);
2170  return (x && *x) ? (strcmp(x,"0") != 0) : defaultvalue;
2171 }

◆ read_int_env_var()

static int read_int_env_var ( const char *  var,
int  defaultvalue 
)
static

Definition at line 2173 of file qapplication_qws.cpp.

Referenced by qt_init().

2174 {
2175  bool ok;
2176  int r = qgetenv(var).toInt(&ok);
2177  return ok ? r : defaultvalue;
2178 }
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...

◆ ReadInteger()

static int ReadInteger ( char *  string,
char **  NextString 
)
static

Definition at line 2438 of file qapplication_qws.cpp.

Referenced by parseGeometry().

2439 {
2440  register int Result = 0;
2441  int Sign = 1;
2442 
2443  if (*string == '+')
2444  string++;
2445  else if (*string == '-')
2446  {
2447  string++;
2448  Sign = -1;
2449  }
2450  for (; (*string >= '0') && (*string <= '9'); string++)
2451  {
2452  Result = (Result * 10) + (*string - '0');
2453  }
2454  *NextString = string;
2455  if (Sign >= 0)
2456  return Result;
2457  else
2458  return -Result;
2459 }

◆ setMaxWindowRect()

static void setMaxWindowRect ( const QRect rect)
static

Definition at line 226 of file qapplication_qws.cpp.

Referenced by QApplicationPrivate::maxWindowRect(), and QWSServer::KeyboardFilter::~KeyboardFilter().

227 {
228  const QList<QScreen*> subScreens = qt_screen->subScreens();
229  QScreen *screen = qt_screen;
230  int screenNo = 0;
231  for (int i = 0; i < subScreens.size(); ++i) {
232  if (subScreens.at(i)->region().contains(rect)) {
233  screen = subScreens.at(i);
234  screenNo = i;
235  break;
236  }
237  }
238 
240  ap->setMaxWindowRect(screen, screenNo, rect);
241 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
void setMaxWindowRect(const QScreen *screen, int screenNo, const QRect &rect)
static QApplicationPrivate * instance()
virtual QRegion region() const
Returns the region covered by this screen driver.
Definition: qscreen_qws.h:284
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool contains(const QPoint &p) const
Returns true if the region contains the point p; otherwise returns false.
Definition: qregion.cpp:4104
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ setScreenTransformation()

static void setScreenTransformation ( int  screenNo,
int  transformation 
)
static

Definition at line 304 of file qapplication_qws.cpp.

Referenced by QApplicationPrivate::maxWindowRect().

305 {
306  QScreen *screen = QScreen::instance();
307  const QList<QScreen*> subScreens = screen->subScreens();
308 
309  if (screenNo == -1)
310  screenNo = 0;
311 
312  if (screenNo == -1 && !subScreens.isEmpty())
313  screenNo = 0;
314 
315  if (subScreens.isEmpty() && screenNo == 0) {
316  // nothing
317  } else if (screenNo < 0 || screenNo >= subScreens.size()) {
318  qWarning("setScreenTransformation: invalid screen %i", screenNo);
319  return;
320  }
321 
322  if (screenNo < subScreens.size())
323  screen = subScreens.at(screenNo);
324 
326  ap->setScreenTransformation(screen, screenNo, transformation);
327 }
static QApplicationPrivate * instance()
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
Q_CORE_EXPORT void qWarning(const char *,...)
static QScreen * instance()
Returns a pointer to the application&#39;s QScreen instance.
Definition: qscreen_qws.h:201
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
void setScreenTransformation(QScreen *screen, int screenNo, int transformation)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

Variable Documentation

◆ AnyButton

const int AnyButton = (Qt::LeftButton | Qt::MidButton | Qt::RightButton)
static

◆ app_do_modal

bool app_do_modal = false
static

◆ appBGCol

const char* appBGCol = 0
static

Definition at line 399 of file qapplication_qws.cpp.

Referenced by qt_init(), and qt_set_qws_resources().

◆ appBTNCol

const char* appBTNCol = 0
static

Definition at line 401 of file qapplication_qws.cpp.

Referenced by qt_init(), and qt_set_qws_resources().

◆ appFGCol

const char* appFGCol = 0
static

Definition at line 400 of file qapplication_qws.cpp.

Referenced by qt_init(), and qt_set_qws_resources().

◆ appFont

const char* appFont = 0
static

Definition at line 398 of file qapplication_qws.cpp.

Referenced by qt_init(), and qt_set_qws_resources().

◆ appName

QString appName
static

Definition at line 397 of file qapplication_qws.cpp.

◆ incoming

QList<QWSEvent*> incoming
static

Definition at line 471 of file qapplication_qws.cpp.

◆ mouse_double_click_distance

int mouse_double_click_distance = 5
static

Definition at line 145 of file qapplication_qws.cpp.

Referenced by qt_init(), and QETWidget::translateMouseEvent().

◆ mouse_state

int mouse_state = 0
static

◆ mouse_x_root

int mouse_x_root = -1
static

Definition at line 142 of file qapplication_qws.cpp.

Referenced by QApplication::qwsProcessEvent().

◆ mouse_y_root

int mouse_y_root = -1
static

Definition at line 143 of file qapplication_qws.cpp.

Referenced by QApplication::qwsProcessEvent().

◆ mouseButtonPressed

int mouseButtonPressed = 0
static

Definition at line 410 of file qapplication_qws.cpp.

Referenced by QETWidget::translateMouseEvent().

◆ mouseButtonPressTime

int mouseButtonPressTime = 0
static

Definition at line 411 of file qapplication_qws.cpp.

Referenced by QETWidget::translateMouseEvent().

◆ mouseInWidget

QPointer<QWidget>* mouseInWidget = 0
static

Definition at line 420 of file qapplication_qws.cpp.

Referenced by qt_cleanup(), and QETWidget::translateMouseEvent().

◆ mouseXPos

short mouseXPos
static

Definition at line 412 of file qapplication_qws.cpp.

Referenced by QETWidget::translateMouseEvent().

◆ mouseYPos

short mouseYPos
static

Definition at line 412 of file qapplication_qws.cpp.

Referenced by QETWidget::translateMouseEvent().

◆ mwGeometry

const char* mwGeometry = 0
static

Definition at line 402 of file qapplication_qws.cpp.

Referenced by parseGeometry(), and qt_init().

◆ mwTitle

const char* mwTitle = 0
static

Definition at line 403 of file qapplication_qws.cpp.

Referenced by parseGeometry(), and qt_init().

◆ openPopupCount

int openPopupCount = 0
static

Definition at line 3199 of file qapplication_qws.cpp.

Referenced by QETWidget::translateMouseEvent().

◆ outgoing

QList<QWSCommand*> outgoing
static

Definition at line 472 of file qapplication_qws.cpp.

Referenced by qt_get_server_queue().

◆ popupButtonFocus

QWidget* popupButtonFocus = 0
static

Definition at line 416 of file qapplication_qws.cpp.

Referenced by QETWidget::translateMouseEvent().

◆ popupCloseDownMode

bool popupCloseDownMode = false
static

Definition at line 418 of file qapplication_qws.cpp.

Referenced by QETWidget::translateMouseEvent().

◆ popupGrabOk

bool popupGrabOk
static

Definition at line 419 of file qapplication_qws.cpp.

◆ popupOfPopupButtonFocus

QWidget* popupOfPopupButtonFocus = 0
static

Definition at line 417 of file qapplication_qws.cpp.

◆ qt_appType

QApplication::Type qt_appType

◆ qt_button_down

QWidget* qt_button_down = 0

Definition at line 425 of file qapplication_qws.cpp.

Referenced by QETWidget::translateMouseEvent().

◆ qt_desktopWidget

QDesktopWidget* qt_desktopWidget

Definition at line 560 of file qapplication.cpp.

◆ qt_fbdpy

Q_GUI_EXPORT QWSDisplay* qt_fbdpy = 0

◆ qt_last_cursor

WId qt_last_cursor = 0xffffffff

◆ qt_last_mouse_receiver

QPointer<QWidget> qt_last_mouse_receiver = 0

Definition at line 421 of file qapplication_qws.cpp.

◆ qt_last_x

int* qt_last_x = 0

◆ qt_last_y

int* qt_last_y = 0

◆ qt_modal_stack

QWidgetList* qt_modal_stack

Definition at line 564 of file qapplication.cpp.

Referenced by QApplication::qwsSetCustomColors().

◆ qt_mouseGrb

QWidget* qt_mouseGrb = 0

Definition at line 138 of file qapplication_qws.cpp.

◆ qt_pressGrab

QWidget* qt_pressGrab = 0

Definition at line 137 of file qapplication_qws.cpp.

◆ qt_servershmid

int qt_servershmid = -1

◆ qws_accel

bool qws_accel = true

Definition at line 133 of file qapplication_qws.cpp.

Referenced by QScreen::shutdownDevice(), and QScreen::subScreenIndexAt().

◆ qws_client_id

Q_GUI_EXPORT int qws_client_id = 0

◆ qws_connection_timeout

int qws_connection_timeout = 5
static

Definition at line 1088 of file qapplication_qws.cpp.

Referenced by QWSDisplay::Data::waitForConnection().

◆ qws_display_id

Q_GUI_EXPORT int qws_display_id = 0

◆ qws_display_spec

QByteArray qws_display_spec(":0")

◆ qws_overrideCursor

bool qws_overrideCursor = false

Definition at line 149 of file qapplication_qws.cpp.

Referenced by parseGeometry(), and QApplication::qwsProcessEvent().

◆ qws_savefonts

bool qws_savefonts = false

Definition at line 129 of file qapplication_qws.cpp.

Referenced by qt_init().

◆ qws_screen_is_interlaced

bool qws_screen_is_interlaced =false

Definition at line 130 of file qapplication_qws.cpp.

Referenced by qt_init().

◆ qws_shared_memory

bool qws_shared_memory = false

Definition at line 131 of file qapplication_qws.cpp.

Referenced by qt_init().

◆ qws_single_process

bool qws_single_process
static

◆ qws_sw_cursor

bool qws_sw_cursor = true

Definition at line 132 of file qapplication_qws.cpp.

Referenced by QScreenCursor::enabled(), and qt_init().

◆ qwsSharedRamSize

const int qwsSharedRamSize = 1 * 1024

Definition at line 121 of file qapplication_qws.cpp.

Referenced by QWSDisplay::Data::init().

◆ sm_blockUserInput

bool sm_blockUserInput = false
static