Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 461251 - [GTK3] PaintItem not sent
Summary: [GTK3] PaintItem not sent
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-02 18:44 EST by ArronM CLA
Modified: 2015-07-05 13:17 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ArronM CLA 2015-03-02 18:44:12 EST
GTK3 doesn't fire PaintItem event

Tested on GTK 3.14.5, SWT 4510

Probably broken by https://bugs.eclipse.org/bugs/show_bug.cgi?id=427480#c6
which disables "sendEvent (SWT.PaintItem, event)" when GTK version is >= 3.9.

Sample code below should paint "This text should be drawn" as it does on GTK2 and other platforms:


	public static void main(String[] args) {
		Display display = new Display();
		Shell shellMain = new Shell(display, SWT.SHELL_TRIM);
		shellMain.setLayout(new FillLayout(SWT.VERTICAL));

		Tree tree = new Tree(shellMain, SWT.BORDER);
		new TreeItem(tree, SWT.NONE).setText("setText");

		tree.addListener(SWT.PaintItem, new Listener() {
			public void handleEvent(Event event) {
				System.out.println("PaintItem");
				Rectangle bounds = ((TreeItem) event.item).getBounds(event.index);
				event.gc.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
				event.gc.drawText("This text should be drawn", bounds.x, bounds.y, true);
			}
		});
		

		shellMain.open();

		while (!shellMain.isDisposed()) {
			try {
				if (!display.readAndDispatch())
					display.sleep();
			} catch (Throwable t) {
				t.printStackTrace();
			}
		}
		display.dispose();
	}
Comment 1 ArronM CLA 2015-05-08 16:44:23 EDT
Still not working in 4524
Comment 2 ArronM CLA 2015-07-05 13:17:56 EDT
Fixed by commits from Bug 427511 and/or Bug 446075