void DownloadRegionDialog::showEvent( QShowEvent * event )
{
    connect( d->m_widget, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)),
             this, SLOT(setVisibleLatLonAltBox(GeoDataLatLonAltBox)) );
    connect( d->m_widget, SIGNAL(themeChanged(QString)),
             this, SLOT(updateTextureLayer()) );

    emit shown();
    event->accept();
}
Exemple #2
0
void VSP_Window::UpdateChildren( VSP_Window* child)
{
    unsigned int i;

    for ( i = 0 ; i < m_Children.size() ; i++ )
    {
        VSP_Window* c = m_Children[i];

        if ( c && c != child )
        {
            int new_x, new_y;
            new_x = c->x();
            new_y = c->y();

            if ( c->GetAttachType() == WIN_ATT_RSIDE )
            {
                new_x = x() + w();
            }
            else if ( c->GetAttachType() == WIN_ATT_LSIDE )
            {
                new_x = x() - c->w();
            }
            else if ( c->GetAttachType() == WIN_ATT_BOTTOM )
            {
                new_y = y() + h();
            }
            else if ( c->GetAttachType() == WIN_ATT_TOP )
            {
                new_y = y() + c->h();
            }

            if ( c->GetAlignType() == WIN_ALN_RIGHT )
            {
                new_x = x();
            }
            else if ( c->GetAlignType() == WIN_ALN_LEFT )
            {
                new_x = x() + w() - c->w();
            }
            else if ( c->GetAlignType() == WIN_ALN_TOP )
            {
                new_y = y();
            }
            else if ( c->GetAlignType() == WIN_ALN_BOTTOM )
            {
                new_y = y() + h() - c->h();
            }

            c->resizeFromParent(new_x,new_y,c->w(),c->h());

            // Show Child if Parent is shown
            if ( shown() && c->shown() ) c->show();
        }
    }
}
void Display_Profile_Dialog::pick(
    const View_Widget * in,
    const Display_Profile & value)
{
    if (in == _view || ! shown() || ! visible())
    {
        return;
    }

    set(in, value);
}
Exemple #4
0
void VSP_Window::resizeFromParent(int x_in, int y_in, int w_in, int h_in)
{
    if ( m_GeomScreen && shown() )
    {
        m_x = x_in;
        m_y = y_in;
    }

    Fl_Double_Window::resize( x_in, y_in, w_in, h_in );
    UpdateChildren();
}
Exemple #5
0
void NotifyBox::show(void) {
	if(shown())
		return;

	EDEBUG(ESTRLOC ": %i %i\n", x(), y());
	resize_all();

	Fl_Window::show();
	is_shown = true;
	Fl::add_timeout(TIME_SHOWN, visible_timeout_cb, this);
}
Exemple #6
0
void iupmotCBstructure (Widget w, XtPointer data, XEvent *ev, Boolean *cont)
{
  Ihandle *n = (Ihandle*)data;
  Widget form = XtNameToWidget((Widget)handle(n),"*dialog_area");
  Iwidgetdata *wd;
  int state = -1;
  if (!form) return;
  XtVaGetValues (form, XmNuserData, &wd, NULL);
  if (!wd) return;

  switch(ev->type)
  {
    case MapNotify:
    {
      if ( iconic( wd->data ) ) /* IUP_RESTORE */
      {
        wd->data = (void*)(-((long)wd->data));
        state = IUP_RESTORE;
      }
      else /* IUP_SHOW */
      {
        Ihandle *startfocus = IupGetAttributeHandle(n, "STARTFOCUS");
        if (startfocus)
          IupSetFocus(startfocus);

        state = IUP_SHOW;
        iupmot_nvisiblewin++;
      }
      break;
    }

    case UnmapNotify:
    {
      if ( shown(wd->data) || popuped(wd->data) ) /* IUP_MINIMIZE */
      {
        wd->data = (void*)(-((long)wd->data));
        state = IUP_MINIMIZE;
      }
      break;
    }
  }
  {
    IFni cb = (IFni)IupGetCallback(n, IUP_SHOW_CB);
    if (cb && state>=0)
    {
      iupmot_incallback = TRUE;
      if (cb(n, state) == IUP_CLOSE) 
        iupmot_exitmainloop = 1;
      iupmot_incallback = FALSE;
    }
  }
}
Exemple #7
0
void Panel::show(void) {
	if(shown()) return;

	/* 
	 * hush known FLTK bug with XGetImage; a lot of errors will be print when menu icons goes
	 * outside screen; this also make ede-panel, at some point, unresponsible
	 */
	XSetErrorHandler((XErrorHandler) xerror_handler);
	update_size_and_pos(true, true);

	/* collect messages */
	Fl::add_handler(x_events);
}
void MSignallingWindow::showEvent(QShowEvent *event)
{
    MWindow::showEvent(event);

    QTimer::singleShot(200, this, SIGNAL(shown()));

    // Set the stacking layer
    Display *display = QX11Info::display();
    Atom stackingLayerAtom = X11Wrapper::XInternAtom(display, "_MEEGO_STACKING_LAYER", False);
    if (stackingLayerAtom != None) {
        long layer = 6;
        X11Wrapper::XChangeProperty(display, internalWinId(), stackingLayerAtom, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&layer, 1);
    }
}
Exemple #9
0
void Panel::show(void) {
	if(shown()) {
		Fl_Window::show();
		return;
	}

	int X, Y, W, H;

	fl_open_display();

	/* 
	 * hush known FLTK bug with XGetImage; a lot of errors will be print when menu icons goes
	 * outside screen; this also make ede-panel, at some point, unresponsible
	 */
	XSetErrorHandler((XErrorHandler) xerror_handler);

	/* position it */
	if(!netwm_workarea_get_size(X, Y, W, H))
		Fl::screen_xywh(X, Y, W, H);

	screen_x = X;
	screen_y = Y;
	screen_w = W;
	screen_h = H;
	screen_h_half = screen_h / 2;

	/* calculate panel percentage width if given */
	if(width_perc < 100) {
		W = (width_perc * screen_w) / 100;
		X = (screen_w / 2) - (W / 2);
	}

	/* set size as soon as possible, since do_layout() depends on it */
	size(W, DEFAULT_PANEL_H);

	do_layout();
	window_xid_create(this, make_me_dock);

	/* position it, this is done after XID was created */
	if(vpos == PANEL_POSITION_BOTTOM) {
		position(X, screen_h - h());
		if(width_perc >= 100)
			netwm_window_set_strut(fl_xid(this), 0, 0, 0, h());
	} else {
		/* FIXME: this does not work well with edewm (nor pekwm). kwin do it correctly. */
		position(X, Y);
		if(width_perc >= 100)
			netwm_window_set_strut(fl_xid(this), 0, 0, h(), 0);
	}
}
Exemple #10
0
void Splash::show(void) {
	if(shown())
		return;

	Fl_X::make_xid(this);
	/* 
	 * Edewm does not implement this for now. Alternative, working solution
	 * is used via register_top()/unregister_top(); also looks like later 
	 * is working on othe wm's too.
	 */
	Atom win_type   = XInternAtom(fl_display, "_NET_WM_WINDOW_TYPE", False);
	Atom win_splash = XInternAtom(fl_display, "_NET_WM_WINDOW_TYPE_SPLASH", False);
	XChangeProperty(fl_display, fl_xid(this), win_type, XA_ATOM, 32, PropModeReplace,
			(unsigned char*)&win_splash, sizeof(Atom));
}
Exemple #11
0
void File_Browser::show()
{
    //DJV_DEBUG("File_Browser::show");

    if (! shown())
    {
        //_value = File_Util::path_absolute(".");

        directory_update();
        widget_update();

        _value_widget->take_focus();
    }

    Dialog::show();
}
void Fl_Window::fullscreen()
{
    const Fl_Screen_Info& info = Fl::info();
    #ifndef _WIN32
    // Most X window managers will not place the window where we want it unless
    // the border is turned off. And most (all except Irix 4DWM, as far as I
    // can tell) will ignore attempts to change the border unless the window
    // is unmapped. Telling the window manager about the border changing
    // is done by i->sendxjunk(). Order is somewhat peculiar, we need to
    // have the window mapped before calling resize or some window managers
    // (KDE) ignore the positioning information:
    clear_border();
    if (shown()) i->sendxjunk();
    #endif
    resize(info.x, info.y, info.w, info.h);
}
Exemple #13
0
void
imWindow::drawit()
{
  if (!shown()) return;

  struct image_cb_data cbd;
  make_current();

  if (pixelType == MONOCHROME)
    {
      if (gamma > 0.0 && gamma < 1.0)
	{
	  cbd.pdata = pixelData;
	  cbd.ndisp = ndisp;
	  cbd.linesize = linesize;
	  cbd.skip = skipw;
	  cbd.gtab = gamtab;
	  fl_draw_image_mono(gamma_image_cb_fn, (void *)&cbd, xoff, yoff, width, height, 1);
	}
      else
        fl_draw_image_mono(pixelData, xoff, yoff, width, height, skipw, linesize);
    }
  else if (pixelType == RGB24)
    {
      if (gamma > 0.0 && gamma < 1.0)
	{
	  cbd.pdata = pixelData;
	  cbd.ndisp = ndisp;
	  cbd.linesize = linesize*3;
	  cbd.skip = skipw*3;
	  cbd.gtab = gamtab;
	  fl_draw_image(gamma_color_image_cb_fn, (void *)&cbd, xoff, yoff, width, height, 3);
	}
      else
	fl_draw_image(pixelData, xoff, yoff, width, height, skipw*3, linesize*3);
    }

  else if (pixelType == DISPARITY)
    {
      cbd.pdata = pixelData;
      cbd.ndisp = ndisp;
      cbd.linesize = linesize;
      cbd.skip = skipw;
      fl_draw_image(disp_image_cb_fn, (void *)&cbd, xoff, yoff, width, height, 3);
    }
}
Exemple #14
0
// Implement auto-hide or auto-gray modes
long TextLabel::onUpdate(FXObject* sender,FXSelector sel,void* ptr)
{
    if (!FXFrame::onUpdate(sender,sel,ptr))
    {
        if (options&TEXTFIELD_AUTOHIDE)
        {
            if (shown())
            {
                hide();
                recalc();
            }
        }
        if (options&TEXTFIELD_AUTOGRAY)
            disable();
    }
    return 1;
}
Exemple #15
0
void VSP_Window::resizeFromChild(int x_in, int y_in, int w_in, int h_in, VSP_Window * child)
{
    if ( m_GeomScreen && shown() )
    {
        m_x = x_in;
        m_y = y_in;
    }

    Fl_Double_Window::resize( x_in, y_in, w_in, h_in );

    bool update = ( x_in != x() || y_in != y() || w_in != w() || h_in != h() );
    if ( update )
    {
//        UpdateParent();
        UpdateChildren( child );
    }
}
int ListEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: shown((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 1: addListClicked(); break;
        case 2: removeListClicked(); break;
        case 3: load(); break;
        case 4: selectList((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
Exemple #17
0
void MovableIcon::show(void) {
	if(!shown())
		Fl_X::make_xid(this);

#ifdef HAVE_SHAPE
	if(icon->image()) {
		mask = create_mask(icon->image());
		if(mask) {
			XShapeCombineMask(fl_display, fl_xid(this), ShapeBounding, 0, 0, mask, ShapeSet);

			/* now set transparency; composite manager should handle the rest (if running) */
			unsigned int opacity = 0xc0000000;
			XChangeProperty(fl_display, fl_xid(this), opacity_atom, XA_CARDINAL, 32, PropModeReplace,
					(unsigned char*)&opacity, 1L);
		}
	}
#endif
}
Exemple #18
0
ViewWrapper2D::ViewWrapper2D(ViewPtr view, VisServicesPtr backend) :
	ViewWrapper(backend),
	mOrientationActionGroup(new QActionGroup(view.get()))
{
	qRegisterMetaType<Vector3D>("Vector3D");
	mView = view;
	this->connectContextMenu(mView);

	// disable vtk interactor: this wrapper IS an interactor
	mView->getRenderWindow()->GetInteractor()->Disable();
	mView->getRenderer()->GetActiveCamera()->SetParallelProjection(true);
	double clipDepth = 1.0; // 1mm depth, i.e. all 3D props rendered outside this range is not shown.
	double length = clipDepth*10;
	mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
	mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
	connect(settings(), SIGNAL(valueChangedFor(QString)), this, SLOT(settingsChangedSlot(QString)));

	// slice proxy
	mSliceProxy = SliceProxy::create(mServices->patient());

	mDataRepContainer.reset(new DataRepContainer());
	mDataRepContainer->setSliceProxy(mSliceProxy);
	mDataRepContainer->setView(mView);

	mViewFollower = ViewFollower::create(mServices->patient());
	mViewFollower->setSliceProxy(mSliceProxy);

	addReps();

	mZoom2D.reset(new Zoom2DHandler());
	connect(mZoom2D.get(), SIGNAL(zoomChanged()), this, SLOT(viewportChanged()));

	connect(mServices->tracking().get(), SIGNAL(activeToolChanged(const QString&)), this, SLOT(activeToolChangedSlot()));
	connect(mView.get(), SIGNAL(resized(QSize)), this, SLOT(viewportChanged()));
	connect(mView.get(), SIGNAL(shown()), this, SLOT(showSlot()));
	connect(mView.get(), SIGNAL(mousePress(int, int, Qt::MouseButtons)), this, SLOT(mousePressSlot(int, int, Qt::MouseButtons)));
	connect(mView.get(), SIGNAL(mouseMove(int, int, Qt::MouseButtons)), this, SLOT(mouseMoveSlot(int, int, Qt::MouseButtons)));
	connect(mView.get(), SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)), this, SLOT(mouseWheelSlot(int, int, int, int, Qt::MouseButtons)));

	connect(mServices->patient().get(), &PatientModelService::videoAddedToTrackedStream, this, &ViewWrapper2D::videoSourcesChangedSlot);

	this->activeToolChangedSlot();
	this->updateView();
}
Exemple #19
0
void VSP_Window::resize( int x_in, int y_in, int w_in, int h_in )
{
    if ( m_GeomScreen && shown() )
    {
        m_x = x_in;
        m_y = y_in;
    }

    bool update_par = ( x_in != x() || y_in != y() || w_in != w() || h_in != h() );

    Fl_Double_Window::resize(x_in,y_in,w_in,h_in);

    // Update parents location if the parent exists

    if ( m_Parent && update_par )
    {
 //       UpdateParent();
    }

    UpdateChildren();
}
Exemple #20
0
void MovableIcon::show(void) {
	if(!shown())
		Fl_X::make_xid(this);

#ifdef HAVE_SHAPE
	if(icon->icon_image()) {
		mask = create_mask(icon->icon_image());
		if(mask) {
			XShapeCombineMask(fl_display, fl_xid(this), ShapeBounding, 0, 0, mask, ShapeSet);

			/*
			 * now set transparency; composite manager should handle the rest (if running)
			 * TODO: should this be declared as part of the class ?
			 */
			Atom opacity_atom = XInternAtom(fl_display, "_NET_WM_WINDOW_OPACITY", False);
			unsigned int opacity = 0xc0000000;

			XChangeProperty(fl_display, fl_xid(this), opacity_atom, XA_CARDINAL, 32, PropModeReplace,
					(unsigned char*)&opacity, 1L);
		}
	}
#endif
}
// Update button input 
void UIButton::updateInput(KeyHandler* mKeyH, MouseHandler* mMouseH){
	if (shown()){
		// Check if button is hovered
		if (contains(mMouseH->getX(), mMouseH->getY())){
			hovered = true;
			if (showTooltip) reqFocus = true;
		}
		else {
			hovered = false;
			down = false;
		}

		// Check to see if mouse is pressing button 
		if (hovered && mMouseH->isLeftDown() && !mMouseH->wasLeftDown())
			down = true;

		// Check if button is clicked
		if (hovered && down && !mMouseH->isLeftDown()){
			clicked = true;
			down = false;
		}
	}
}
Exemple #22
0
void WindowManager::show()
{
	if(!shown())
	{
		create();

		// Destroy FLTK window
		XDestroyWindow(fl_display, Fl_X::i(this)->xid);
		// Set RootWindow to our xid
		Fl_X::i(this)->xid = RootWindow(fl_display, fl_screen);
		root_win = RootWindow(fl_display, fl_screen);

		// setting attributes on root window makes it the window manager:
		XSelectInput(fl_display, fl_xid(this),
			SubstructureRedirectMask | SubstructureNotifyMask |
			ColormapChangeMask | PropertyChangeMask |
			ButtonPressMask | ButtonReleaseMask |
			EnterWindowMask | LeaveWindowMask |
			KeyPressMask | KeyReleaseMask | KeymapStateMask);

		DBG("RootWindow ID set to xid");
		draw();
	}
}
Exemple #23
0
    Tempo_Point_Editor ( float *tempo ) : Fl_Menu_Window(  75, 58, "Edit Tempo" )
        {
            _sucess = false;
            _tempo = tempo;

            set_modal();

            Fl_Float_Input *fi = _fi = new Fl_Float_Input( 12, 0 + 24, 50, 24, "Tempo:" );
            fi->align( FL_ALIGN_TOP );
            fi->when( FL_WHEN_NOT_CHANGED | FL_WHEN_ENTER_KEY );
            fi->callback( &Tempo_Point_Editor::enter_cb, (void*)this );

            char pat[10];
            snprintf( pat, sizeof( pat ), "%.1f", *tempo );

            fi->value( pat );

            end();

            show();

            while ( shown() )
                Fl::wait();
        }
Exemple #24
0
void RDockWidget::showEvent(QShowEvent* event) {
    emit shown();
}
Exemple #25
0
  bool window::dispatch_event ( XEvent& evt )
	{
    switch ( evt.type )
		{
      case Expose:
        exposed();
        break;
		case ButtonPress:
	      if ( evt.xbutton.button & Button2 )
           on_right_button_down ( evt.xbutton.x, evt.xbutton.y );
		    else if ( evt.xbutton.button & Button1 )
           on_left_button_down ( evt.xbutton.x, evt.xbutton.y );
		    break;
		case ButtonRelease:
		    if ( evt.xbutton.button & Button2 )
            on_right_button_up ( evt.xbutton.x, evt.xbutton.y );
		    else if ( evt.xbutton.button & Button1 )
            on_left_button_up ( evt.xbutton.x, evt.xbutton.y );
		    break;
		case EnterNotify:
		    on_mouse_enter ( evt.xcrossing.x, evt.xcrossing.y );
		    break;
		case LeaveNotify:
		    on_mouse_exit ( evt.xcrossing.x, evt.xcrossing.y );
		    break;
		case MotionNotify:
		    on_mouse_move ( evt.xmotion.x, evt.xmotion.y );
		    break;
		case FocusIn:
		    on_got_focus();
		    break;
		case FocusOut:
		    on_lost_focus();
		    break;
		case KeyPress:
		case KeyRelease:
        {
          character cp;
          KeySym keysym;
          XComposeStatus status;
          int count = XLookupString ( &evt.xkey, cp.text, character::MAX_CHAR_TEXT, &keysym, &status );
          cp.text[count] = 0;
          if ( evt.type == KeyPress )
            on_key_press ( cp );
          else
            on_key_release ( cp );
        } break;

		case MapNotify:
		  state = WINDOW_SHOWN;
      shown();
		  break;

		case UnmapNotify:
		  state = WINDOW_HIDDEN;
	    hidden();
		  break;

    case ConfigureNotify:
      //XClearWindow ( env, hwnd );
	    //XFlush ( env );
      position_changed();
      break;

		case ClientMessage:
		  {
		    if ( atomDelete == (Atom)evt.xclient.data.l[0] )
          destroy();
		    break;
		  }
		}
    return true;
	}
Exemple #26
0
  const SUCCESS Events::handleEvent(const SDL_Event * const Event)
  {
    switch(Event->type)
    {  //newline brackets implemented since this is a lot of nesting
    case SDL_WINDOWEVENT: ///Some sort of input or output gained or lost
      {
        const Uint8 &winID = Event->window.windowID;
        switch(Event->window.event) 
        {
        case SDL_WINDOWEVENT_ENTER:   ///Mouse message handling gained or lost
          return mouseEnter(winID);
          
        case SDL_WINDOWEVENT_LEAVE:   ///General input message handling gained or lost
          return mouseLeave(winID);

        case SDL_WINDOWEVENT_MINIMIZED:   ///Output to the screen at all gained or lost
          return minimized(winID);
          
        case SDL_WINDOWEVENT_RESTORED:
          return restored(winID);
          
        case SDL_WINDOWEVENT_MAXIMIZED:
          return maximized(winID);
          
        case SDL_WINDOWEVENT_SHOWN:
          return shown(winID);
          
        case SDL_WINDOWEVENT_HIDDEN:
          return hidden(winID);
          
        case SDL_WINDOWEVENT_EXPOSED:
          return exposed(winID);
          
        case SDL_WINDOWEVENT_FOCUS_GAINED:
          return keyboardFocusGain(winID);
          
        case SDL_WINDOWEVENT_FOCUS_LOST:
          return keyboardFocusLost(winID);
          
        case SDL_WINDOWEVENT_SIZE_CHANGED:
            return changeSize(winID);
            
        case SDL_WINDOWEVENT_RESIZED:
          return resized(winID, Dimensions<int>(Event->window.data1, Event->window.data2));
          
        case SDL_WINDOWEVENT_MOVED:
          return moved(winID, Point<int>(Event->window.data1, Event->window.data2));
          
        case SDL_WINDOWEVENT_CLOSE:
          return windowExited(winID);
          
        default:   ///For some reason there is an unknown window event
          return FAILED;
        }
        break;
      }
    case SDL_KEYDOWN:
      {
        if(Event->key.repeat)
        {
          return keyHeld(Event->key.windowID, Event->key.keysym);
        }
        else
        {
          return keyPressed(Event->key.windowID, Event->key.keysym);
        }
        break;
      }
    case SDL_KEYUP:
        return keyReleased(Event->key.windowID, Event->key.keysym);
        
    case SDL_TEXTINPUT:
        return textInput(Event->text.windowID, Event->text.text);
        
    case SDL_TEXTEDITING:
        return textEdit(Event->edit.windowID, Event->edit.text, Event->edit.start, Event->edit.length);
        
    case SDL_MOUSEMOTION:
      return mouseMove(Event->motion.windowID, Event->motion.which,
                       Delta<Point<int> >(Point<int>(Event->motion.xrel, Event->motion.yrel), 
                                          Point<int>(Event->motion.x, Event->motion.y)),
                       bitset<N_MOUSE_BUTTONS>(Event->motion.state));
                       
    case SDL_MOUSEBUTTONDOWN:
      return mouseButtonPressed(Event->button.windowID, Event->button.which, Event->button.button, Event->button.clicks,
                                Point<int>(Event->button.x, Event->button.y));
      
    case SDL_MOUSEBUTTONUP:
        return mouseButtonReleased(Event->button.windowID, Event->button.which, Event->button.button, Event->button.clicks,
                                  Point<int>(Event->button.x, Event->button.y));
     
    case SDL_MOUSEWHEEL:
        return mouseWheel(Event->wheel.windowID, Event->wheel.which, Point<int>(Event->wheel.x, Event->wheel.y));
        
    case SDL_JOYAXISMOTION:
      return joyAxis(Event->jaxis.which, Event->jaxis.axis, Event->jaxis.value);
    
    case SDL_JOYBUTTONDOWN:
      return joyButtonPressed(Event->jbutton.which, Event->jbutton.button);
      
    case SDL_JOYBUTTONUP:
      return joyButtonReleased(Event->jbutton.which, Event->jbutton.button);
      
    case SDL_JOYHATMOTION:
      return joyHatChange(Event->jhat.which, Event->jhat.hat, Event->jhat.value);
        
    case SDL_JOYBALLMOTION:
      return joyBallMove(Event->jball.which, Event->jball.ball, Point<int>(Event->jball.xrel, Event->jball.yrel));
      
    case SDL_DROPFILE:
    {
      const SUCCESS ret = droppedFile(Event->drop.file);
      SDL_free(Event->drop.file);
      return ret;
    }
      
    case SDL_SYSWMEVENT:
      return unhandledSystemEvent(Event->syswm.msg);
     
    case SDL_QUIT:
      return appExited();
        
    case SDL_USEREVENT:
    default:
      {
        return userEvent(Event->user.windowID, Event->user.code, Event->user.data1, Event->user.data2);
      }
    }

    return FAILED;
  }
Exemple #27
0
void Splash::run(void) {
	E_ASSERT(slist != NULL);

	if(!show_splash) {
		while(next_client_nosplash()) 
			;
		return;
	}

	fl_register_images();

	String path, splash_theme_path;

#ifdef USE_LOCAL_CONFIG
	splash_theme_path = "splash-themes/";
#else
	splash_theme_path = Resource::find_data("themes/splash-themes", RES_SYS_ONLY);
	if(splash_theme_path.empty()) {
		E_WARNING(E_STRLOC ": Unable to locate splash themes in $XDG_DATA_DIRS directories\n");
		return;
	}
#endif
	splash_theme_path += E_DIR_SEPARATOR;
	splash_theme_path += *splash_theme;

	if(!file_test(splash_theme_path.c_str(), FILE_TEST_IS_DIR)) {
		E_WARNING(E_STRLOC ": Unable to locate '%s' in '%s' theme directory\n", 
				splash_theme->c_str(), splash_theme_path.c_str());
		return;
	}

	/* setup widgets */
	begin();
		Fl_Box* bimg = new Fl_Box(0, 0, w(), h());
		Fl_Image* splash_img = 0;

		path = build_filename(splash_theme_path.c_str(), "background.png");
		splash_img = Fl_Shared_Image::get(path.c_str());

		if(splash_img) {
			int W = splash_img->w();
			int H = splash_img->h();
			/* update window and Box sizes */
			size(W, H);
			bimg->size(W, H);

			bimg->image(splash_img);
		}

		/*
		 * place message box at the bottom with
		 * nice offset (10 px) from window borders
		 */
		msgbox = new Fl_Box(10, h() - 25 - 10, w() - 20, 25);

		/*
		 * Setup icons positions, based on position of msgbox assuming someone 
		 * will not abuse splash to start hundrets of programs, since icons will 
		 * be placed only in horizontal order, one line, so in case their large
		 * number, some of them will go out of window borders.
		 *
		 * Icon box will be 64x64 so larger icons can fit too.
		 *
		 * This code will use Fl_Group (moving group, later, will move all icons
		 * saving me from code mess), but will not update it's w() for two reasons:
		 * icons does not use it, and will be drawn correctly, and second, setting
		 * width will initiate fltk layout engine which will mess everything up.
		 */
		Fl_Group* icon_group = new Fl_Group(10, msgbox->y() - 10 - 64, 0, 64);
		int X = icon_group->x();
		int Y = icon_group->y();

		/* offset between icons */
		int ioffset = 5;

		/* FIXME: use malloc/something instead this */
		icons = new Fl_Box*[slist->size()];

		icon_group->begin();
			int         i = 0;
			const char* imgpath;
			Fl_Image*   iconimg = 0;

			for(StartupItemListIter it = slist->begin(); it != slist->end(); ++it, ++i) {
				Fl_Box* bb = new Fl_Box(X, Y, 64, 64);

				path = build_filename(splash_theme_path.c_str(), (*it)->icon.c_str());
				imgpath = path.c_str();
				iconimg = Fl_Shared_Image::get(imgpath);

				if(!iconimg) {
					bb->label(_("No image"));
					bb->align(FL_ALIGN_INSIDE | FL_ALIGN_WRAP);
				} else 
					bb->image(iconimg);

				bb->hide();

				X += bb->w() + ioffset;
				icons[i] = bb;
			}
		icon_group->end();

		/* see X as width of all icons */
		int gx = w()/2 - X/2;
		/* gx can be negative */
		gx = (gx > 10) ? gx : 10;
		icon_group->position(gx, Y);
	end();

	clear_border();

	/*
	 * If set_override() is used, message boxes will be
	 * popped behind splash. Using it or not ???
	 */
	set_override();

	// make sure window is centered
	int sw = DisplayWidth(fl_display, fl_screen);
	int sh = DisplayHeight(fl_display, fl_screen);
	position(sw/2 - w()/2, sh/2 - h()/2);

	show();
	Fl::add_timeout(TIMEOUT_START, runner_cb, this);

	// to keep splash at the top
#ifndef EDEWM_HAVE_NET_SPLASH
	global_splash = this;
	XSelectInput(fl_display, RootWindow(fl_display, fl_screen), SubstructureNotifyMask);
	Fl::add_handler(splash_xmessage_handler);
#endif
	
	while(shown())
		Fl::wait();

#ifndef EDEWM_HAVE_NET_SPLASH
	Fl::remove_handler(splash_xmessage_handler);
#endif
}
void QAppIndicatorMenuItem::hide() { emit shown(false); }
Exemple #29
0
int dispatcher::execute( void )
{
	xcb_flush( _connection );
	_exit_code = 0;

	bool done = false;
	while ( !done )
	{
		auto event = core::wrap_cptr( xcb_wait_for_event( _connection ) );
		if ( !event )
			break;
		switch ( event->response_type & ~0x80 )
		{
			case XCB_EXPOSE:
			{
				auto *ev = reinterpret_cast<xcb_expose_event_t*>( event.get() );
				if ( ev->count == 0 )
					_windows[ev->window]->exposed();
				xcb_flush( _connection );
				break;
			}

			case XCB_CONFIGURE_NOTIFY:
			{
				auto *ev = reinterpret_cast<xcb_configure_notify_event_t*>( event.get() );
				auto w = _windows[ev->window];
				if ( w->check_last_position( ev->x, ev->y ) )
					w->moved( ev->x, ev->y );
				if ( w->check_last_size( ev->width, ev->height ) )
					w->resize_canvas( ev->width, ev->height );
				break;
			}

			case XCB_DESTROY_NOTIFY:
			{
				auto *ev = reinterpret_cast<xcb_destroy_notify_event_t*>( event.get() );
				auto w = _windows[ev->window];
				w->closed();
				break;
			}

			case XCB_MAP_NOTIFY:
			{
				auto *ev = reinterpret_cast<xcb_map_notify_event_t*>( event.get() );
				auto w = _windows[ev->window];
				w->shown();
				w->restored();
				break;
			}

			case XCB_UNMAP_NOTIFY:
			{
				auto *ev = reinterpret_cast<xcb_unmap_notify_event_t*>( event.get() );
				auto w = _windows[ev->window];
				w->hidden();
				w->minimized();
				break;
			}

			case XCB_ENTER_NOTIFY:
			{
				auto *ev = reinterpret_cast<xcb_enter_notify_event_t*>( event.get() );
				auto w = _windows[ev->event];
				w->entered();
				break;
			}

			case XCB_LEAVE_NOTIFY:
			{
				auto *ev = reinterpret_cast<xcb_leave_notify_event_t*>( event.get() );
				auto w = _windows[ev->event];
				w->exited();
				break;
			}

			case XCB_KEY_PRESS:
			{
				auto *ev = reinterpret_cast<xcb_key_press_event_t*>( event.get() );
				auto w = _windows[ev->event];
				platform::scancode sc = _keyboard->get_scancode( ev->detail );
				w->key_pressed( _keyboard, sc );
				break;
			}

			case XCB_KEY_RELEASE:
			{
				auto *ev = reinterpret_cast<xcb_key_press_event_t*>( event.get() );
				auto w = _windows[ev->event];
				platform::scancode sc = _keyboard->get_scancode( ev->detail );
				w->key_released( _keyboard, sc );
				break;
			}

			case XCB_MAPPING_NOTIFY:
			{
				auto *ev = reinterpret_cast<xcb_mapping_notify_event_t*>( event.get() );
				if ( ev->request == XCB_MAPPING_MODIFIER || ev->request == XCB_MAPPING_KEYBOARD )
					_keyboard->update_mapping();
				break;
			}

			case XCB_BUTTON_PRESS:
			{
				auto *ev = reinterpret_cast<xcb_button_press_event_t*>( event.get() );
				auto w = _windows[ev->event];
				switch ( ev->detail )
				{
					case 1:
					case 2:
					case 3:
						w->mouse_pressed( _mouse, { double(ev->event_x), double(ev->event_y) }, ev->detail );
						break;

					case 4: // Mouse wheel up
					case 5: // Mouse wheel down
						break;
				}
				break;
			}

			case XCB_BUTTON_RELEASE:
			{
				auto *ev = reinterpret_cast<xcb_button_press_event_t*>( event.get() );
				auto w = _windows[ev->event];
				switch ( ev->detail )
				{
					case 1:
					case 2:
					case 3:
						w->mouse_released( _mouse, { double(ev->event_x), double(ev->event_y) }, ev->detail );
						break;

					case 4: // Mouse wheel up
					case 5: // Mouse wheel down
						break;
				}
				break;
			}

			case XCB_MOTION_NOTIFY:
			{
				auto *ev = reinterpret_cast<xcb_motion_notify_event_t*>( event.get() );
				auto w = _windows[ev->event];
				w->mouse_moved( _mouse, { double(ev->event_x), double(ev->event_y) } );
				break;
			}

			case XCB_VISIBILITY_NOTIFY:
			case XCB_REPARENT_NOTIFY:
				break;

			case XCB_CLIENT_MESSAGE:
			{
				auto *ev = reinterpret_cast<xcb_client_message_event_t*>( event.get() );
				if ( ev->data.data32[0] == _atom_delete_window )
				{
					auto w = _windows[ev->window];
					w->hide();
					_windows.erase( w->id() );
					done = _windows.empty();
				}
				break;
			}

			default:
				std::cout << "Unknown event: " << uint32_t( event->response_type & ~0x80 ) << ' ' << uint32_t( event->response_type ) << std::endl;
		}
	}

	return _exit_code;
}
void QAppIndicatorMenuItem::show() { emit shown(true); }